gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 12/25: KYC - wip


From: gnunet
Subject: [taler-taler-ios] 12/25: KYC - wip
Date: Mon, 06 Nov 2023 20:40:19 +0100

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 1c8b9fdac4b6aaa1495ea101cc54007abde23d47
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Nov 4 08:27:12 2023 +0100

    KYC - wip
---
 TalerWallet1/Model/Transaction.swift   |  1 +
 TalerWallet1/Views/Main/MainView.swift | 35 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/TalerWallet1/Model/Transaction.swift 
b/TalerWallet1/Model/Transaction.swift
index 823e1d7..5c9f16e 100644
--- a/TalerWallet1/Model/Transaction.swift
+++ b/TalerWallet1/Model/Transaction.swift
@@ -150,6 +150,7 @@ struct TransactionCommon: Decodable, Sendable {
     var transactionId: String
     var timestamp: Timestamp
     var txActions: [TxAction]
+    var kycUrl: String?
 
     func localizedType(_ type: TransactionType) -> String {
         switch type {
diff --git a/TalerWallet1/Views/Main/MainView.swift 
b/TalerWallet1/Views/Main/MainView.swift
index 56b166e..0edd3ef 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -89,6 +89,19 @@ extension MainView {
         let settingsTitle = String(localized: "TitleSettings", defaultValue: 
"Settings")
 #if TABBAR  // Taler Wallet
         @State private var selectedTab: Tab = .balances
+        @State private var showKycAlert: Bool = false
+
+        private var openKycButton: some View {
+            Button("KYC") {
+                showKycAlert = false
+//                UIApplication.shared.open(URL(string: 
UIApplication.openSettingsURLString)!)
+            }
+        }
+        private var dismissAlertButton: some View {
+            Button("Cancel", role: .cancel) {
+                showKycAlert = false
+            }
+        }
 
         private func tabSelection() -> Binding<Tab> {
             Binding { //this is the get block
@@ -220,7 +233,27 @@ extension MainView {
                   hamburgerAction: hamburgerAction)
             }
 #endif
-          }
+          } .onNotification(.TransactionStateTransition) { notification in
+              // show an alert with the KYC link (button) which opens in Safari
+                if let transition = 
notification.userInfo?[TRANSACTIONTRANSITION] as? TransactionTransition {
+                    if transition.newTxState.major == .pending {
+                        if let newMinor = transition.newTxState.minor {
+                            if newMinor == .kyc {       // user did confirm on 
bank website
+                                logger.log(".onNotification(): KYC required")
+                                showKycAlert = true
+                            }
+                        }
+                    }
+                } else { // should never happen
+                    logger.error("Yikes! TransactionStateTransition without 
transition")
+//                    symLog.log(notification.userInfo as Any)
+                }
+            }
+            .alert("You need to pass a KYC procedure",
+                 isPresented: $showKycAlert,
+                 actions: {   openKycButton
+                              dismissAlertButton },
+                 message: {   Text("Tap the button to go to the KYC website.") 
})
             .onNotification(.BalanceChange) { notification in
               // reload balances on receiving BalanceChange notification ...
                 logger.info(".onNotification(.BalanceChange) ==> reload")

-- 
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]