gnunet-svn
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]