[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 03/54: Cleaned up buttons
From: |
gnunet |
Subject: |
[taler-taler-ios] 03/54: Cleaned up buttons |
Date: |
Fri, 30 Jun 2023 22:33:35 +0200 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit 9101f27a720efa9d9f4a51e9851316962bcc7a91
Author: Marc Stibane <marc@taler.net>
AuthorDate: Mon Jun 12 19:09:11 2023 +0200
Cleaned up buttons
---
TalerWallet1/Views/HelperViews/Buttons.swift | 81 +++-------------------
TalerWallet1/Views/Payment/PaymentAcceptView.swift | 3 +-
TalerWallet1/Views/Transactions/ThreeAmounts.swift | 3 +-
.../WithdrawAcceptView.swift | 3 +-
.../WithdrawBankIntegrated/WithdrawTOSView.swift | 3 +-
5 files changed, 17 insertions(+), 76 deletions(-)
diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift
b/TalerWallet1/Views/HelperViews/Buttons.swift
index 68d17eb..7b9d074 100644
--- a/TalerWallet1/Views/HelperViews/Buttons.swift
+++ b/TalerWallet1/Views/HelperViews/Buttons.swift
@@ -93,59 +93,6 @@ struct ReloadButton : View {
}
}
-struct BigBlueButton: View {
- let title: String
- var font: Font?
- let disabled: Bool
- let action: () -> Void
- var body: some View {
- Button(action: action) {
- let colors: [Color] = disabled ? [Color.gray, Color.blue]
- : [Color.red, Color.blue]
- let back = LinearGradient(gradient: Gradient(colors: colors),
- startPoint: .leading, endPoint:
.trailing)
- Text(title)
- .frame(minWidth: 50, maxWidth: 500)
- .padding()
- .foregroundColor(.white)
- .background(disabled ? .gray : .blue) // back
- .cornerRadius(20)
- .font(font ?? .title)
- }
- .disabled(disabled)
- }
-}
-struct BorderedButton: View {
- let title: String
- var font: Font?
- let action: () -> Void
-
- var body: some View {
- Button(action: action) {
- Text(title)
- .frame(minWidth: 50, maxWidth: 500)
- .padding()
- .font(font ?? .title)
- }
- .buttonStyle(.bordered)
- }
-}
-struct ProminentButton: View {
- let title: String
- var font: Font?
- let action: () -> Void
-
- var body: some View {
- Button(action: action) {
- Text(title)
- .frame(minWidth: 50, maxWidth: 500)
- .padding()
- .font(font ?? .title)
- }
- .buttonStyle(.borderedProminent)
- }
-}
-
struct TalerButtonStyle: ButtonStyle {
@Environment(\.isEnabled) private var isEnabled: Bool
func disabled() -> Bool { !isEnabled }
@@ -233,19 +180,6 @@ struct TalerButtonStyle: ButtonStyle {
}
-
-struct GrowingButton: ButtonStyle {
- func makeBody(configuration: Configuration) -> some View {
- configuration.label
- .padding()
- .background(.blue)
- .foregroundColor(.white)
- .clipShape(Capsule())
- .scaleEffect(configuration.isPressed ? 1.2 : 1)
- .animation(.easeOut(duration: 0.2), value: configuration.isPressed)
- }
-}
-
struct Buttons_Previews: PreviewProvider {
static var previews: some View {
VStack {
@@ -256,15 +190,18 @@ struct Buttons_Previews: PreviewProvider {
PlusButton() {}
.padding()
HStack {
- ReloadButton(disabled: false) {}
+ ReloadButton(disabled: false) {
+ AudioServicesPlaySystemSound(1000)
+ }
.padding()
ReloadButton(disabled: true) {}
.padding()
}
- BigBlueButton(title: "DisabledButton", disabled: true) {
AudioServicesPlaySystemSound(1015) }
- .padding()
- BigBlueButton(title: "BigBlueButton", disabled: false) {
AudioServicesPlaySystemSound(1000) }
- .padding()
+ Button(String(localized: "Accept"), action: {
+ AudioServicesPlaySystemSound(1015)
+ })
+ .buttonStyle(TalerButtonStyle(type: .prominent))
+ .padding(.horizontal)
}
}
}
@@ -285,7 +222,7 @@ struct ContentView: View {
animate = false
// Because .opacity is animated, we need to switch it
// back so the button shows.
- DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
+ DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
animate = true
}
}
diff --git a/TalerWallet1/Views/Payment/PaymentAcceptView.swift
b/TalerWallet1/Views/Payment/PaymentAcceptView.swift
index 3b15583..75cd0c1 100644
--- a/TalerWallet1/Views/Payment/PaymentAcceptView.swift
+++ b/TalerWallet1/Views/Payment/PaymentAcceptView.swift
@@ -58,7 +58,8 @@ struct PaymentAcceptView: View {
baseURL:
detailsForAmount.contractTerms.exchanges.first?.url)
// TODO: payment: popup with all possible exchanges, check fees
.safeAreaInset(edge: .bottom) {
- ProminentButton(title: "Accept", action: acceptAction)
+ Button(String(localized: "Accept"), action: acceptAction)
+ .buttonStyle(TalerButtonStyle(type: .prominent))
.padding(.horizontal)
}
}
diff --git a/TalerWallet1/Views/Transactions/ThreeAmounts.swift
b/TalerWallet1/Views/Transactions/ThreeAmounts.swift
index d016089..25e0231 100644
--- a/TalerWallet1/Views/Transactions/ThreeAmounts.swift
+++ b/TalerWallet1/Views/Transactions/ThreeAmounts.swift
@@ -100,7 +100,8 @@ struct ThreeAmounts_Previews: PreviewProvider {
List {
ThreeAmounts(common: common, topTitle: "Withdrawal", baseURL:
DEMOEXCHANGE, large: 1==1)
.safeAreaInset(edge: .bottom) {
- ProminentButton(title: "Accept", action: {})
+ Button(String(localized: "Accept"), action: {})
+ .buttonStyle(TalerButtonStyle(type: .prominent))
.padding(.horizontal)
}
}
diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptView.swift
b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptView.swift
index d0a1269..72ce825 100644
--- a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptView.swift
+++ b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptView.swift
@@ -47,7 +47,8 @@ struct WithdrawAcceptView: View {
large: false, pending: false, incoming:
true,
baseURL: baseURL)
.safeAreaInset(edge: .bottom) {
- ProminentButton(title: String(localized: "Accept"),
action: acceptAction)
+ Button(String(localized: "Accept"), action:
acceptAction)
+ .buttonStyle(TalerButtonStyle(type: .prominent))
.padding(.horizontal)
}
case .waitingForWithdrAck, .receivedWithdrAck:
diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawTOSView.swift
b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawTOSView.swift
index 48a8c0e..3d24025 100644
--- a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawTOSView.swift
+++ b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawTOSView.swift
@@ -77,7 +77,8 @@ extension WithdrawTOSView {
List (components, id: \.self) { term in
Text(term)
}.safeAreaInset(edge: .bottom) {
- ProminentButton(title: String(localized: "Accept"),
action: acceptAction)
+ Button(String(localized: "Accept"), action: acceptAction)
+ .buttonStyle(TalerButtonStyle(type: .prominent))
.padding(.horizontal)
}
.listStyle(myListStyle.style)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (7ce9180 -> f7f01e5), gnunet, 2023/06/30
- [taler-taler-ios] 02/54: Moved AgePicker in its own file, gnunet, 2023/06/30
- [taler-taler-ios] 05/54: cleanup, back to Swift 5.8 (for now until Xcode 15 is usable), gnunet, 2023/06/30
- [taler-taler-ios] 04/54: PopToRoot instead of dismiss sheet, gnunet, 2023/06/30
- [taler-taler-ios] 03/54: Cleaned up buttons,
gnunet <=
- [taler-taler-ios] 11/54: Accessibility, gnunet, 2023/06/30
- [taler-taler-ios] 18/54: remove loaded, gnunet, 2023/06/30
- [taler-taler-ios] 09/54: Launch animation, SideBarView, gnunet, 2023/06/30
- [taler-taler-ios] 01/54: Big update after DD37, gnunet, 2023/06/30
- [taler-taler-ios] 13/54: Overhaul withdraw + p2p, gnunet, 2023/06/30
- [taler-taler-ios] 17/54: for debugging time-outs, gnunet, 2023/06/30
- [taler-taler-ios] 10/54: Reduce Logging, gnunet, 2023/06/30
- [taler-taler-ios] 12/54: Localization, gnunet, 2023/06/30
- [taler-taler-ios] 08/54: Preparations for localization + accessability, gnunet, 2023/06/30
- [taler-taler-ios] 19/54: remove dismissFirst, gnunet, 2023/06/30