commit 17472d4bc8eef1b16413206e0f16d6c5119c2b54
parent b4613fca14e20d1f4645150215cc7b74282e8aab
Author: Marc Stibane <marc@taler.net>
Date: Fri, 9 May 2025 14:58:25 +0000
add OIM to ready
Diffstat:
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/TalerWallet1/Views/Actions/Peer2peer/P2PReadyV.swift b/TalerWallet1/Views/Actions/Peer2peer/P2PReadyV.swift
@@ -20,6 +20,7 @@ struct P2PReadyV: View {
let amountToTransfer: Amount
@Binding var transactionStarted: Bool
+ @EnvironmentObject private var controller: Controller
@EnvironmentObject private var model: WalletModel
#if DEBUG
@AppStorage("developerMode") var developerMode: Bool = true
@@ -31,6 +32,7 @@ struct P2PReadyV: View {
let navTitle = String(localized: "Ready")
@State private var transactionId: String? = nil
@State private var noTransaction: TalerTransaction? = nil
+ @Namespace var namespace
@MainActor
private func initiateP2P() async {
@@ -64,6 +66,10 @@ struct P2PReadyV: View {
}
}
+ func doneAction() {
+ dismissTop(stack.push())
+ }
+
var body: some View {
#if PRINT_CHANGES
let _ = Self._printChanges()
@@ -85,7 +91,7 @@ struct P2PReadyV: View {
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled() // can only use "Done" button to dismiss
.safeAreaInset(edge: .bottom) {
- Button("Done") { dismissTop(stack.push()) }
+ Button("Done", action: doneAction)
.buttonStyle(TalerButtonStyle(type: .prominent))
.padding(.horizontal)
}
@@ -107,6 +113,17 @@ struct P2PReadyV: View {
.onDisappear {
// print("❗️ P2PReadyV onDisappear")
}
+#if OIM
+ .overlay { if #available(iOS 16.4, *) {
+ if controller.oimModeActive {
+ OIMp2pReadyView(stack: stack.push(),
+ transactionId: $transactionId,
+ scope: scope,
+ action: doneAction)
+ .environmentObject(NamespaceWrapper(namespace)) // keep OIMviews apart
+ }
+ } }
+#endif
}
}
// MARK: -
diff --git a/TalerWallet1/Views/OIM/OIMp2pReadyView.swift b/TalerWallet1/Views/OIM/OIMp2pReadyView.swift
@@ -0,0 +1,45 @@
+/*
+ * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
+ * See LICENSE.md
+ */
+/**
+ * @author Marc Stibane
+ */
+import SwiftUI
+import taler_swift
+
+// MARK: -
+@available(iOS 16.4, *)
+struct OIMp2pReadyView: View {
+ let stack: CallStack
+ @Binding var transactionId: String?
+ let scope: ScopeInfo
+ let action: () -> Void
+
+ @EnvironmentObject private var wrapper: NamespaceWrapper
+
+ @State private var sending = false // user tapped on Send
+ @State private var appeared = false
+
+
+ var body: some View {
+// let _ = Self._printChanges()
+
+ OIMbackground() {
+ VStack {
+ if let transactionId {
+ Text("transaction sent")
+ } else {
+ LoadingView(stack: stack.push(),
+ scopeInfo: scope,
+ message: nil)
+ }
+ }
+// .border(.red)
+ }.task {
+ withAnimation(.basic1) {
+ appeared = true
+ }
+ }
+ }
+}