diff options
author | Marc Stibane <marc@taler.net> | 2023-11-04 07:10:02 +0100 |
---|---|---|
committer | Marc Stibane <marc@taler.net> | 2023-11-04 07:27:20 +0100 |
commit | fa60cb70ea24cfd58d4fd5ae87196d338d758338 (patch) | |
tree | b2891ac55a67c7d8fbdc5553abd01771f86eb107 | |
parent | 11c152522bcbb20046b6513190e724407cc5a55d (diff) | |
download | taler-ios-fa60cb70ea24cfd58d4fd5ae87196d338d758338.tar.gz taler-ios-fa60cb70ea24cfd58d4fd5ae87196d338d758338.tar.bz2 taler-ios-fa60cb70ea24cfd58d4fd5ae87196d338d758338.zip |
IncompleteRowV
-rw-r--r-- | TalerWallet.xcodeproj/project.pbxproj | 12 | ||||
-rw-r--r-- | TalerWallet1/Helper/WalletColors.swift | 2 | ||||
-rw-r--r-- | TalerWallet1/Model/Model+Transactions.swift | 2 | ||||
-rw-r--r-- | TalerWallet1/Views/Balances/BalancesSectionView.swift | 28 | ||||
-rw-r--r-- | TalerWallet1/Views/Balances/IncompleteRowV.swift | 39 | ||||
-rw-r--r-- | TalerWallet1/Views/Balances/UncompletedRowView.swift | 34 | ||||
-rw-r--r-- | TalerWallet1/Views/Transactions/TransactionRowView.swift | 2 |
7 files changed, 61 insertions, 58 deletions
diff --git a/TalerWallet.xcodeproj/project.pbxproj b/TalerWallet.xcodeproj/project.pbxproj index 485a9a7..aee8ed1 100644 --- a/TalerWallet.xcodeproj/project.pbxproj +++ b/TalerWallet.xcodeproj/project.pbxproj @@ -42,7 +42,7 @@ 4E3EAE2D2A990778009F1BE8 /* Model+Exchange.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E3B4BC82A42BC4800CC88B8 /* Model+Exchange.swift */; }; 4E3EAE2E2A990778009F1BE8 /* QRCodeDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E5A88F42A38A4FD00072618 /* QRCodeDetailView.swift */; }; 4E3EAE2F2A990778009F1BE8 /* TransactionsEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E87C8722A31CB7F001C6406 /* TransactionsEmptyView.swift */; }; - 4E3EAE302A990778009F1BE8 /* UncompletedRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E87C8742A34B411001C6406 /* UncompletedRowView.swift */; }; + 4E3EAE302A990778009F1BE8 /* IncompleteRowV.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E87C8742A34B411001C6406 /* IncompleteRowV.swift */; }; 4E3EAE312A990778009F1BE8 /* SendAmount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E40E0BD29F25ABB00B85369 /* SendAmount.swift */; }; 4E3EAE332A990778009F1BE8 /* EqualIconWidthDomain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8E25322A1CD39700A27BFA /* EqualIconWidthDomain.swift */; }; 4E3EAE342A990778009F1BE8 /* SuperScriptDigits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA563E2A7FD9390084948B /* SuperScriptDigits.swift */; }; @@ -159,7 +159,7 @@ 4E753A082A0B6A5F002D9328 /* ShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E753A072A0B6A5F002D9328 /* ShareSheet.swift */; }; 4E7940DE29FC307C00A9AEA1 /* SendPurpose.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E7940DD29FC307C00A9AEA1 /* SendPurpose.swift */; }; 4E87C8732A31CB7F001C6406 /* TransactionsEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E87C8722A31CB7F001C6406 /* TransactionsEmptyView.swift */; }; - 4E87C8752A34B411001C6406 /* UncompletedRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E87C8742A34B411001C6406 /* UncompletedRowView.swift */; }; + 4E87C8752A34B411001C6406 /* IncompleteRowV.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E87C8742A34B411001C6406 /* IncompleteRowV.swift */; }; 4E8C17202A6509BB005B2392 /* Atkinson-Hyperlegible-Regular-102.otf in Resources */ = {isa = PBXBuildFile; fileRef = 4E8C171C2A6509BB005B2392 /* Atkinson-Hyperlegible-Regular-102.otf */; }; 4E8C17212A6509BB005B2392 /* Atkinson-Hyperlegible-Italic-102.otf in Resources */ = {isa = PBXBuildFile; fileRef = 4E8C171D2A6509BB005B2392 /* Atkinson-Hyperlegible-Italic-102.otf */; }; 4E8C17222A6509BB005B2392 /* Atkinson-Hyperlegible-Bold-102.otf in Resources */ = {isa = PBXBuildFile; fileRef = 4E8C171E2A6509BB005B2392 /* Atkinson-Hyperlegible-Bold-102.otf */; }; @@ -336,7 +336,7 @@ 4E7940DD29FC307C00A9AEA1 /* SendPurpose.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendPurpose.swift; sourceTree = "<group>"; }; 4E7CFD372A532CE100CBAFF3 /* WhatToTest.en-US.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "WhatToTest.en-US.txt"; sourceTree = "<group>"; }; 4E87C8722A31CB7F001C6406 /* TransactionsEmptyView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionsEmptyView.swift; sourceTree = "<group>"; }; - 4E87C8742A34B411001C6406 /* UncompletedRowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UncompletedRowView.swift; sourceTree = "<group>"; }; + 4E87C8742A34B411001C6406 /* IncompleteRowV.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IncompleteRowV.swift; sourceTree = "<group>"; }; 4E8C171C2A6509BB005B2392 /* Atkinson-Hyperlegible-Regular-102.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Atkinson-Hyperlegible-Regular-102.otf"; sourceTree = "<group>"; }; 4E8C171D2A6509BB005B2392 /* Atkinson-Hyperlegible-Italic-102.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Atkinson-Hyperlegible-Italic-102.otf"; sourceTree = "<group>"; }; 4E8C171E2A6509BB005B2392 /* Atkinson-Hyperlegible-Bold-102.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Atkinson-Hyperlegible-Bold-102.otf"; sourceTree = "<group>"; }; @@ -706,7 +706,7 @@ 4EB095362989CBFE0043A8A1 /* BalanceRowView.swift */, 4EB065432A4CD1A80039B91D /* TwoRowButtons.swift */, 4EB095382989CBFE0043A8A1 /* PendingRowView.swift */, - 4E87C8742A34B411001C6406 /* UncompletedRowView.swift */, + 4E87C8742A34B411001C6406 /* IncompleteRowV.swift */, ); path = Balances; sourceTree = "<group>"; @@ -1064,7 +1064,7 @@ 4E3EAE2D2A990778009F1BE8 /* Model+Exchange.swift in Sources */, 4E3EAE2E2A990778009F1BE8 /* QRCodeDetailView.swift in Sources */, 4E3EAE2F2A990778009F1BE8 /* TransactionsEmptyView.swift in Sources */, - 4E3EAE302A990778009F1BE8 /* UncompletedRowView.swift in Sources */, + 4E3EAE302A990778009F1BE8 /* IncompleteRowV.swift in Sources */, 4E605DAF2AADDD13002FB9A7 /* UIScreen+screenSize.swift in Sources */, 4E3EAE312A990778009F1BE8 /* SendAmount.swift in Sources */, 4E3EAE332A990778009F1BE8 /* EqualIconWidthDomain.swift in Sources */, @@ -1173,7 +1173,7 @@ 4E3B4BC92A42BC4800CC88B8 /* Model+Exchange.swift in Sources */, 4E5A88F52A38A4FD00072618 /* QRCodeDetailView.swift in Sources */, 4E87C8732A31CB7F001C6406 /* TransactionsEmptyView.swift in Sources */, - 4E87C8752A34B411001C6406 /* UncompletedRowView.swift in Sources */, + 4E87C8752A34B411001C6406 /* IncompleteRowV.swift in Sources */, 4E605DB02AADDD13002FB9A7 /* UIScreen+screenSize.swift in Sources */, 4E40E0BE29F25ABB00B85369 /* SendAmount.swift in Sources */, 4E8E25332A1CD39700A27BFA /* EqualIconWidthDomain.swift in Sources */, diff --git a/TalerWallet1/Helper/WalletColors.swift b/TalerWallet1/Helper/WalletColors.swift index 815da41..a358caf 100644 --- a/TalerWallet1/Helper/WalletColors.swift +++ b/TalerWallet1/Helper/WalletColors.swift @@ -45,7 +45,7 @@ public struct WalletColors { Color(.systemBackground) } - var uncompletedColor: Color { + var incompleteColor: Color { gray1 } func pendingColor(_ incoming: Bool) -> Color { diff --git a/TalerWallet1/Model/Model+Transactions.swift b/TalerWallet1/Model/Model+Transactions.swift index 6c3869d..f8e171f 100644 --- a/TalerWallet1/Model/Model+Transactions.swift +++ b/TalerWallet1/Model/Model+Transactions.swift @@ -25,7 +25,7 @@ extension WalletModel { transaction.isPending } } - static func uncompletedTransactions(_ transactions: [Transaction]) -> [Transaction] { + static func incompleteTransactions(_ transactions: [Transaction]) -> [Transaction] { transactions.filter { transaction in !transaction.isDone && !transaction.isPending } diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift index a588698..9cf169a 100644 --- a/TalerWallet1/Views/Balances/BalancesSectionView.swift +++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift @@ -31,7 +31,7 @@ struct BalancesSectionView { @State private var transactions: [Transaction] = [] @State private var completedTransactions: [Transaction] = [] @State private var pendingTransactions: [Transaction] = [] - @State private var uncompletedTransactions: [Transaction] = [] + @State private var incompleteTransactions: [Transaction] = [] func reloadOneAction(_ transactionId: String) async throws -> Transaction { return try await model.getTransactionByIdT(transactionId) @@ -54,10 +54,10 @@ struct BalancesSectionView { // sectionID = UUID() } - func reloadUncompleted(_ stack: CallStack) async -> () { + func reloadIncomplete(_ stack: CallStack) async -> () { let currency = balance.scopeInfo.currency transactions = await model.transactionsT(stack.push(), currency: currency) - uncompletedTransactions = WalletModel.uncompletedTransactions(transactions) + incompleteTransactions = WalletModel.incompleteTransactions(transactions) // sectionID = UUID() } } @@ -87,8 +87,7 @@ extension BalancesSectionView: View { completedTransactions: $completedTransactions, reloadAllAction: reloadCompleted, reloadOneAction: reloadOneAction) - let hasPending = pendingTransactions.count > 0 - if hasPending { + if pendingTransactions.count > 0 { BalancesPendingRowView(symLog: symLog, stack: stack.push(), currencyInfo: currencyInfo, @@ -96,21 +95,20 @@ extension BalancesSectionView: View { reloadPending: reloadPending, reloadOneAction: reloadOneAction) } - let hasUncompleted = uncompletedTransactions.count > 0 - if hasUncompleted { + if incompleteTransactions.count > 0 { NavigationLink { -//let _ = print("button: Uncompleted Transactions: \(currency)") +//let _ = print("button: Incomplete Transactions: \(currency)") LazyView { TransactionsListView(stack: stack.push(), - navTitle: String(localized: "Uncompleted"), + navTitle: String(localized: "Incomplete", comment: "ViewTitle of TransactionList"), currencyInfo: currencyInfo, - transactions: uncompletedTransactions, + transactions: incompleteTransactions, showUpDown: false, - reloadAllAction: reloadUncompleted, + reloadAllAction: reloadIncomplete, reloadOneAction: reloadOneAction) } } label: { - UncompletedRowView(uncompletedTransactions: $uncompletedTransactions) + IncompleteRowV(incompleteTransactions: $incompleteTransactions) } } @@ -123,7 +121,7 @@ extension BalancesSectionView: View { let response = await model.transactionsT(stack.push(".task - reload Transactions"), currency: currency) transactions = response pendingTransactions = WalletModel.pendingTransactions(response) - uncompletedTransactions = WalletModel.uncompletedTransactions(response) + incompleteTransactions = WalletModel.incompleteTransactions(response) completedTransactions = WalletModel.completedTransactions(response) shownSectionID = sectionID // } else { @@ -199,7 +197,7 @@ fileprivate struct BalancesPendingRowView: View { //let _ = print("button: Pending Transactions: \(currency)") LazyView { TransactionsListView(stack: stack.push(), - navTitle: String(localized: "Pending"), + navTitle: String(localized: "Pending", comment: "ViewTitle of TransactionList"), currencyInfo: currencyInfo, transactions: pendingTransactions, showUpDown: false, @@ -274,7 +272,7 @@ fileprivate struct BalancesNavigationLinksView: View { NavigationLink(destination: LazyView { TransactionsListView(stack: stack.push(), - navTitle: String(localized: "Transactions"), + navTitle: String(localized: "Transactions", comment: "ViewTitle of TransactionList"), currencyInfo: currencyInfo, transactions: completedTransactions, showUpDown: true, diff --git a/TalerWallet1/Views/Balances/IncompleteRowV.swift b/TalerWallet1/Views/Balances/IncompleteRowV.swift new file mode 100644 index 0000000..f76e7fc --- /dev/null +++ b/TalerWallet1/Views/Balances/IncompleteRowV.swift @@ -0,0 +1,39 @@ +/* + * This file is part of GNU Taler, ©2022-23 Taler Systems S.A. + * See LICENSE.md + */ +import SwiftUI +import taler_swift + +/// This view shows an incompleteTransactions row in a currency section, below the balance +struct IncompleteRowV: View { + @Binding var incompleteTransactions: [Transaction] + + var body: some View { + let count = incompleteTransactions.count + HStack { + Spacer() + Text("\(count) incomplete transactions") + .accessibilityFont(.title2) + .foregroundColor(WalletColors().incompleteColor) + Spacer() + } + } +} +// MARK: - Preview +#if DEBUG +fileprivate struct IncompleteRowContainer: View { + @State var incompleteTransactions: [Transaction] = [] + + var body: some View { + IncompleteRowV(incompleteTransactions: $incompleteTransactions) + } +} +struct IncompleteRowV_Previews: PreviewProvider { + static var previews: some View { + List { + IncompleteRowContainer() + } + } +} +#endif diff --git a/TalerWallet1/Views/Balances/UncompletedRowView.swift b/TalerWallet1/Views/Balances/UncompletedRowView.swift deleted file mode 100644 index a9436b6..0000000 --- a/TalerWallet1/Views/Balances/UncompletedRowView.swift +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of GNU Taler, ©2022-23 Taler Systems S.A. - * See LICENSE.md - */ -import SwiftUI -import taler_swift - -/// This view shows an uncompleted transaction row in a currency section -struct UncompletedRowView: View { - @Binding var uncompletedTransactions: [Transaction] - - var body: some View { - let count = uncompletedTransactions.count - HStack { - Spacer() - Text("\(count) uncompleted transactions") - .accessibilityFont(.title2) - .foregroundColor(WalletColors().uncompletedColor) - Spacer() - } - .accessibilityElement(children: .combine) - } -} -// MARK: - -#if DEBUG -//struct UncompletedRowView_Previews: PreviewProvider { -// static var previews: some View { -// let uncompletedTransactions: [Transaction] = [] -// List { -// UncompletedRowView(uncompletedTransactions: uncompletedTransactions) -// } -// } -//} -#endif diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift b/TalerWallet1/Views/Transactions/TransactionRowView.swift index fc28f09..0c63c5c 100644 --- a/TalerWallet1/Views/Transactions/TransactionRowView.swift +++ b/TalerWallet1/Views/Transactions/TransactionRowView.swift @@ -79,7 +79,7 @@ struct TransactionRowView: View { let incoming = common.incoming() let foreColor = pending ? WalletColors().pendingColor(incoming) : done ? WalletColors().transactionColor(incoming) - : WalletColors().uncompletedColor + : WalletColors().incompleteColor SingleAxisGeometryReader { width in Group { |