blob: 46cb38753a736bb269553374b08b17e2293e1de3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* This file is part of GNU Taler, ©2022-24 Taler Systems S.A.
* See LICENSE.md
*/
/**
* @author Marc Stibane
*/
import SwiftUI
import SymLog
import taler_swift
/// This view shows hints if a wallet is empty
/// It is the very first thing the user sees after installing the app
struct WalletEmptyView: View {
private let symLog = SymLogV(0)
let stack: CallStack
@EnvironmentObject private var model: WalletModel
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
@State private var withDrawDisabled = false
var body: some View {
List {
Section {
Text("There is no digital cash in your wallet.")
.talerFont(.title3)
}
Section {
Text("Use the QR code scan button to start a withdrawal if your bank already supports Taler payments.")
.talerFont(.body)
.listRowSeparator(.hidden)
Text("You can also add a payment service manually in the Settings.")
.talerFont(.body)
}
Section {
Text("Demo: get digital cash to experience how to pay with the money of the future.")
// Text("You can register an account in the demo bank, then withdraw some digital cash to experience how to pay with the money of the future.")
.talerFont(.body)
.listRowSeparator(.hidden)
let title = String(localized: "LinkTitle_Test_Money", defaultValue: "Get demo money")
Button(title) {
withDrawDisabled = true // don't run twice
Task { // runs on MainActor
let amount = Amount(currency: DEMOCURRENCY, cent: 2500)
symLog.log("Withdraw KUDOS")
try? await model.loadTestKudosM(test: false, amount: amount)
}
}
.buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, disabled: withDrawDisabled, aligned: .center))
.disabled(withDrawDisabled)
// Link(title, destination: URL(string: DEMOBANK)!)
// .buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, aligned: .center))
// .padding(.vertical)
// .accessibilityHint("Will go to the demo bank website.")
}
}
.listStyle(myListStyle.style).anyView
.talerFont(.title2)
.background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all))
.onAppear() {
DebugViewC.shared.setViewID(VIEW_EMPTY_WALLET, stack: stack.push("onAppear")) // 10
}
}
}
struct WalletEmptyView_Previews: PreviewProvider {
static var previews: some View {
WalletEmptyView(stack: CallStack("Preview"))
}
}
|