commit 2f26f868c8e7a28dcba49ac5d0f3d30a9f0e1802
parent 80e43e75337111da398bc5befbd160ef51ffba1f
Author: Marc Stibane <marc@taler.net>
Date: Tue, 22 Jul 2025 11:47:07 +0200
historyTapped
Diffstat:
4 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalanceCellV.swift b/TalerWallet1/Views/Balances/BalanceCellV.swift
@@ -15,6 +15,7 @@ struct BalanceCellV: View {
let amount: Amount
// let sizeCategory: ContentSizeCategory
// let rowAction: () -> Void
+ @Binding var historyTapped: Bool
let balanceDest: TransactionsListView
@Environment(\.colorScheme) private var colorScheme
@@ -29,6 +30,8 @@ struct BalanceCellV: View {
}
}
+ private func buttonAction() { historyTapped = true }
+
/// Renders the Balance button. "Balance" leading, amountStr trailing. If it doesn't fit in one row then
/// amount (trailing) goes underneath "Balance" (leading).
var body: some View {
@@ -75,8 +78,13 @@ struct BalanceCellV: View {
} else { vLayout } // view for iOS 15
}
}
- NavigationLink { balanceDest } label: {
+ let actions = Group {
+ NavLink($historyTapped) { balanceDest }
+ }
+
+ Button(action: buttonAction) {
balanceCell
+ .background(actions)
.accessibilityElement(children: .combine)
.accessibilityHint(String(localized: "Will go to main transactions list.", comment: "a11y"))
// .accessibilityLabel(balanceTitleStr + SPACE + amountStr) // TODO: CurrencyFormatter!
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -25,6 +25,8 @@ struct BalancesListView: View {
@State private var amountToTransfer = Amount.zero(currency: EMPTYSTRING) // Update currency when used
@State private var summary = EMPTYSTRING
+
+ @State private var historyTapped = false
@Namespace var namespace
private static func className() -> String {"\(self)"}
@@ -40,7 +42,7 @@ struct BalancesListView: View {
let _ = Self._printChanges()
let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear
#endif
- Group {
+// Group {
let count = controller.balances.count
if controller.balances.isEmpty {
WalletEmptyView(stack: stack.push("isEmpty"))
@@ -60,6 +62,7 @@ struct BalancesListView: View {
sectionCount: count,
amountToTransfer: $amountToTransfer, // does still have the wrong currency
summary: $summary,
+ historyTapped: $historyTapped,
reloadTransactions: $reloadTransactions)
}
.onAppear() {
@@ -77,12 +80,13 @@ struct BalancesListView: View {
OIMbalances(stack: stack.push(),
selectedBalance: $selectedBalance, // set to user choice
selectedChestIndex: $selectedChestIndex, // OIM TODO: use balance
- qrButtonTapped: $qrButtonTapped)
+ qrButtonTapped: $qrButtonTapped,
+ historyTapped: $historyTapped)
.environmentObject(NamespaceWrapper(namespace)) // keep OIMviews apart
}
} }
#endif
- }
- }
+ } // not empty
+// }
}
}
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -24,6 +24,7 @@ struct BalancesSectionView {
let sectionCount: Int
@Binding var amountToTransfer: Amount // does still have the wrong currency
@Binding var summary: String
+ @Binding var historyTapped: Bool
@Binding var reloadTransactions: Int
@EnvironmentObject private var model: WalletModel
@@ -110,6 +111,7 @@ extension BalancesSectionView: View {
BalanceCellV(stack: stack.push("BalanceCell"),
scope: balance.scopeInfo,
amount: balance.available,
+ historyTapped: $historyTapped,
balanceDest: balanceDest)
// .listRowSeparator(.hidden)
// .border(.red)
diff --git a/TalerWallet1/Views/OIM/OIMbalances.swift b/TalerWallet1/Views/OIM/OIMbalances.swift
@@ -32,6 +32,7 @@ struct OIMbalances: View {
@Binding var selectedBalance: Balance? // return user's choice
@Binding var selectedChestIndex: Int? // OIM TODO: use balance
@Binding var qrButtonTapped: Bool
+ @Binding var historyTapped: Bool
@EnvironmentObject private var controller: Controller
@EnvironmentObject private var wrapper: NamespaceWrapper
@@ -143,6 +144,17 @@ struct OIMbalances: View {
print("openHistory", delay)
withAnimation(.basic1) {
viewState = .historyShown
+ DispatchQueue.main.asyncAfter(deadline: .now() + Animation.talerDuration2) {
+ var transaction = Transaction()
+ transaction.disablesAnimations = true
+ withTransaction(transaction) {
+ historyTapped = true // ==> go to transaction list
+ }
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
+ cash.moveBack()
+ viewState = .chestIsOpen
+ }
+ }
}
}
}