gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 01/10: PaymentView


From: gnunet
Subject: [taler-taler-ios] 01/10: PaymentView
Date: Tue, 08 Aug 2023 12:29:20 +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 f6a838560b5d7fc6f80b74b33c4baf099c30e331
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Aug 8 11:54:49 2023 +0200

    PaymentView
---
 TalerWallet.xcodeproj/project.pbxproj              |  8 +--
 TalerWallet1/Views/HelperViews/SelectDays.swift    | 12 ++--
 TalerWallet1/Views/Payment/DeleteMe.swift          | 79 ----------------------
 .../{PaymentURIView.swift => PaymentView.swift}    |  8 ++-
 TalerWallet1/Views/Peer2peer/PaymentPurpose.swift  | 24 +++----
 TalerWallet1/Views/Peer2peer/SendPurpose.swift     | 24 +++----
 TalerWallet1/Views/Sheets/URLSheet.swift           |  2 +-
 7 files changed, 41 insertions(+), 116 deletions(-)

diff --git a/TalerWallet.xcodeproj/project.pbxproj 
b/TalerWallet.xcodeproj/project.pbxproj
index 8352c2c..5024d76 100644
--- a/TalerWallet.xcodeproj/project.pbxproj
+++ b/TalerWallet.xcodeproj/project.pbxproj
@@ -68,7 +68,7 @@
                4EB095502989CBFE0043A8A1 /* SettingsItem.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = 4EB095262989CBFE0043A8A1 /* SettingsItem.swift 
*/; };
                4EB095522989CBFE0043A8A1 /* ExchangeListView.swift in Sources 
*/ = {isa = PBXBuildFile; fileRef = 4EB095292989CBFE0043A8A1 /* 
ExchangeListView.swift */; };
                4EB095542989CBFE0043A8A1 /* Model+Payment.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = 4EB0952C2989CBFE0043A8A1 /* Model+Payment.swift 
*/; };
-               4EB095552989CBFE0043A8A1 /* PaymentURIView.swift in Sources */ 
= {isa = PBXBuildFile; fileRef = 4EB0952D2989CBFE0043A8A1 /* 
PaymentURIView.swift */; };
+               4EB095552989CBFE0043A8A1 /* PaymentView.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = 4EB0952D2989CBFE0043A8A1 /* PaymentView.swift 
*/; };
                4EB095562989CBFE0043A8A1 /* TransactionsListView.swift in 
Sources */ = {isa = PBXBuildFile; fileRef = 4EB0952F2989CBFE0043A8A1 /* 
TransactionsListView.swift */; };
                4EB095572989CBFE0043A8A1 /* TransactionRowView.swift in Sources 
*/ = {isa = PBXBuildFile; fileRef = 4EB095302989CBFE0043A8A1 /* 
TransactionRowView.swift */; };
                4EB095582989CBFE0043A8A1 /* TransactionDetailView.swift in 
Sources */ = {isa = PBXBuildFile; fileRef = 4EB095312989CBFE0043A8A1 /* 
TransactionDetailView.swift */; };
@@ -206,7 +206,7 @@
                4EB095262989CBFE0043A8A1 /* SettingsItem.swift */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path 
= SettingsItem.swift; sourceTree = "<group>"; };
                4EB095292989CBFE0043A8A1 /* ExchangeListView.swift */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path 
= ExchangeListView.swift; sourceTree = "<group>"; };
                4EB0952C2989CBFE0043A8A1 /* Model+Payment.swift */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path 
= "Model+Payment.swift"; sourceTree = "<group>"; };
-               4EB0952D2989CBFE0043A8A1 /* PaymentURIView.swift */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path 
= PaymentURIView.swift; sourceTree = "<group>"; };
+               4EB0952D2989CBFE0043A8A1 /* PaymentView.swift */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path 
= PaymentView.swift; sourceTree = "<group>"; };
                4EB0952F2989CBFE0043A8A1 /* TransactionsListView.swift */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.swift; path = TransactionsListView.swift; sourceTree = "<group>"; };
                4EB095302989CBFE0043A8A1 /* TransactionRowView.swift */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; 
path = TransactionRowView.swift; sourceTree = "<group>"; };
                4EB095312989CBFE0043A8A1 /* TransactionDetailView.swift */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.swift; path = TransactionDetailView.swift; sourceTree = "<group>"; };
@@ -451,7 +451,7 @@
                4EB0952A2989CBFE0043A8A1 /* Payment */ = {
                        isa = PBXGroup;
                        children = (
-                               4EB0952D2989CBFE0043A8A1 /* 
PaymentURIView.swift */,
+                               4EB0952D2989CBFE0043A8A1 /* PaymentView.swift 
*/,
                        );
                        path = Payment;
                        sourceTree = "<group>";
@@ -775,7 +775,7 @@
                                4E578E942A4822D500F21F1C /* P2pPayURIView.swift 
in Sources */,
                                4EB095542989CBFE0043A8A1 /* Model+Payment.swift 
in Sources */,
                                4EB0954F2989CBFE0043A8A1 /* SettingsView.swift 
in Sources */,
-                               4EB095552989CBFE0043A8A1 /* 
PaymentURIView.swift in Sources */,
+                               4EB095552989CBFE0043A8A1 /* PaymentView.swift 
in Sources */,
                                4EB095612989CBFE0043A8A1 /* 
WithdrawURIView.swift in Sources */,
                                4EF840A72A0B85F400EE0D47 /* CopyShare.swift in 
Sources */,
                                4EB094ED298979620043A8A1 /* 
TalerWallet1App.swift in Sources */,
diff --git a/TalerWallet1/Views/HelperViews/SelectDays.swift 
b/TalerWallet1/Views/HelperViews/SelectDays.swift
index 208c4e2..95a7182 100644
--- a/TalerWallet1/Views/HelperViews/SelectDays.swift
+++ b/TalerWallet1/Views/HelperViews/SelectDays.swift
@@ -65,9 +65,9 @@ struct SelectDays: View {
     }
 }
 
-struct SelectDays_Previews: PreviewProvider {
-    static var previews: some View {
-        @State var expireDays: UInt = 1
-        SelectDays(selected: $expireDays, maxExpiration: 20)
-    }
-}
+//struct SelectDays_Previews: PreviewProvider {
+//    static var previews: some View {
+//        @State var expireDays: UInt = 1
+//        SelectDays(selected: $expireDays, maxExpiration: 20)
+//    }
+//}
diff --git a/TalerWallet1/Views/Payment/DeleteMe.swift 
b/TalerWallet1/Views/Payment/DeleteMe.swift
deleted file mode 100644
index 1ff5352..0000000
--- a/TalerWallet1/Views/Payment/DeleteMe.swift
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of GNU Taler, ©2022-23 Taler Systems S.A.
- * See LICENSE.md
- */
-import SwiftUI
-import taler_swift
-import AVFoundation
-import SymLog
-
-struct PaymentAcceptView: View {
-    private let symLog = SymLogV()
-
-    let detailsForUri: PaymentDetailsForUri
-    let acceptAction: () -> Void
-
-    let navTitle = String(localized: "Accept Payment")
-
-    @State private var disabled = false
-    var body: some View {
-        Group {
-            let raw = detailsForUri.amountRaw
-            let effective = detailsForUri.amountEffective
-            let currency = raw.currencyStr
-            let fee = try! Amount.diff(raw, effective)      // TODO: different 
currencies
-            ThreeAmountsView(topTitle: String(localized: "Amount to pay:"),
-                             topAmount: raw, fee: fee,
-                             bottomTitle: String(localized: "\(currency) to be 
spent:"),
-                             bottomAmount: effective,
-                             large: true, pending: false, incoming: false,
-                             baseURL: 
detailsForUri.contractTerms.exchanges.first?.url)
-                // TODO: payment: popup with all possible exchanges, check fees
-            .safeAreaInset(edge: .bottom) {
-                Button(String(localized: "Accept"), action: acceptAction)
-                    .buttonStyle(TalerButtonStyle(type: .prominent))
-                    .padding(.horizontal)
-            }
-        }
-            .navigationTitle(navTitle)
-    }
-}
-// MARK: -
-struct PaymentAccept_Previews: PreviewProvider {
-    static var previews: some View {
-        let merchant = Merchant(name: "Merchant")
-        let extra = Extra(articleName: "articleName")
-        let product = Product(description: "description")
-        let terms = ContractTerms(amount: try! Amount(fromString: LONGCURRENCY 
+ ":2.2"),
-                                  maxFee: try! Amount(fromString: LONGCURRENCY 
+ ":0.2"),
-                                  maxWireFee: try! Amount(fromString: 
LONGCURRENCY + ":0.2"),
-                                  merchant: merchant,
-                                  extra: extra,
-                                  summary: "summary",
-                                  timestamp: Timestamp.now(),
-                                  payDeadline: Timestamp.tomorrow(),
-                                  refundDeadline: Timestamp.tomorrow(),
-                                  wireTransferDeadline: Timestamp.tomorrow(),
-                                  merchantBaseURL: "merchantBaseURL",
-                                  fulfillmentURL: "fulfillmentURL",
-                                  publicReorderURL: "publicReorderURL",
-                                  auditors: [],
-                                  exchanges: [],
-                                  orderID: "orderID",
-                                  nonce: "nonce",
-                                  merchantPub: "merchantPub",
-                                  products: [product],
-                                  hWire: "hWire",
-                                  wireMethod: "wireMethod",
-                                  wireFeeAmortization: 0)
-        let details = PaymentDetailsForUri(
-            amountRaw: try! Amount(fromString: LONGCURRENCY + ":2.2"),
-            amountEffective: try! Amount(fromString: LONGCURRENCY + ":2.4"),
-            noncePriv: "noncePriv",
-            proposalId: "proposalId",
-            contractTerms: terms,
-            contractTermsHash: "termsHash"
-        )
-        PaymentAcceptView(detailsForUri: details, acceptAction: {})
-    }
-}
diff --git a/TalerWallet1/Views/Payment/PaymentURIView.swift 
b/TalerWallet1/Views/Payment/PaymentView.swift
similarity index 96%
rename from TalerWallet1/Views/Payment/PaymentURIView.swift
rename to TalerWallet1/Views/Payment/PaymentView.swift
index 4b0150d..27db640 100644
--- a/TalerWallet1/Views/Payment/PaymentURIView.swift
+++ b/TalerWallet1/Views/Payment/PaymentView.swift
@@ -8,7 +8,7 @@ import SymLog
 
 // Will be called either by the user scanning a QR code or tapping the 
provided link,
 // both from the shop's website. We show the payment details
-struct PaymentURIView: View {
+struct PaymentView: View {
     private let symLog = SymLogV()
     let navTitle = String(localized: "Confirm Payment", comment:"pay merchant")
 
@@ -84,6 +84,10 @@ struct PaymentURIView: View {
                 }
             }
             .navigationTitle(navTitle)
+            .onAppear() {
+                symLog.log("onAppear")
+                DebugViewC.shared.setSheetID(SHEET_PAYMENT)
+            }
         } else {
             let badURL = "Error in Link: \(url)"
             WithdrawProgressView(message: url.host ?? badURL)
@@ -148,6 +152,6 @@ struct PaymentURIView_Previews: PreviewProvider {
         )
         let url = URL(string: "taler://pay/some_amount")!
         
-        PaymentURIView(url: url, preparePayResult: details)
+        PaymentView(url: url, preparePayResult: details)
     }
 }
diff --git a/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift 
b/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
index 373aceb..eb4a054 100644
--- a/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
+++ b/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
@@ -95,17 +95,17 @@ struct PaymentPurpose: View {
 }
 // MARK: -
 #if DEBUG
-struct PaymentPurpose_Previews: PreviewProvider {
-    static var previews: some View {
-        let scopeInfo = ScopeInfo(type: ScopeInfo.ScopeInfoType.exchange, 
exchangeBaseUrl: DEMOEXCHANGE, currency: LONGCURRENCY)
-        @State var summary: String = "pUrPoSe"
-        @State var expireDays: UInt = 0
-        PaymentPurpose(scopeInfo: scopeInfo,
-                 centsToTransfer: 5,
-                             fee: "fee",
-                         summary: $summary,
-                      expireDays: $expireDays)
+//struct PaymentPurpose_Previews: PreviewProvider {
+//    static var previews: some View {
+//        let scopeInfo = ScopeInfo(type: ScopeInfo.ScopeInfoType.exchange, 
exchangeBaseUrl: DEMOEXCHANGE, currency: LONGCURRENCY)
+//        @State var summary: String = "pUrPoSe"
+//        @State var expireDays: UInt = 0
+//        PaymentPurpose(scopeInfo: scopeInfo,
+//                 centsToTransfer: 5,
+//                             fee: "fee",
+//                         summary: $summary,
+//                      expireDays: $expireDays)
 //        { print("deactivateAction") }
-    }
-}
+//    }
+//}
 #endif
diff --git a/TalerWallet1/Views/Peer2peer/SendPurpose.swift 
b/TalerWallet1/Views/Peer2peer/SendPurpose.swift
index fa8202b..463d79c 100644
--- a/TalerWallet1/Views/Peer2peer/SendPurpose.swift
+++ b/TalerWallet1/Views/Peer2peer/SendPurpose.swift
@@ -103,17 +103,17 @@ struct SendPurpose: View {
 }
 // MARK: -
 #if DEBUG
-struct SendPurpose_Previews: PreviewProvider {
-    static var previews: some View {
-        @State var summary: String = ""
-        @State var expireDays: UInt = 0
-        let amount = Amount(currency: LONGCURRENCY, integer: 10, fraction: 0)
-        SendPurpose(amountAvailable: amount,
-                    centsToTransfer: 543,
-                                fee: "0,43",
-                            summary: $summary,
-                         expireDays: $expireDays)
+//struct SendPurpose_Previews: PreviewProvider {
+//    static var previews: some View {
+//        @State var summary: String = ""
+//        @State var expireDays: UInt = 0
+//        let amount = Amount(currency: LONGCURRENCY, integer: 10, fraction: 0)
+//        SendPurpose(amountAvailable: amount,
+//                    centsToTransfer: 543,
+//                                fee: "0,43",
+//                            summary: $summary,
+//                         expireDays: $expireDays)
 //        { print("deactivateAction") }
-    }
-}
+//    }
+//}
 #endif
diff --git a/TalerWallet1/Views/Sheets/URLSheet.swift 
b/TalerWallet1/Views/Sheets/URLSheet.swift
index 4a3cacd..42ec8b2 100644
--- a/TalerWallet1/Views/Sheets/URLSheet.swift
+++ b/TalerWallet1/Views/Sheets/URLSheet.swift
@@ -19,7 +19,7 @@ struct URLSheet: View {
                 case .withdraw:
                     WithdrawURIView(url: urlToOpen)
                 case .pay:
-                    PaymentURIView(url: urlToOpen)
+                    PaymentView(url: urlToOpen)
                 case .payPull:
                     P2pPayURIView(url: urlToOpen)
                 case .payPush:

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