commit 05eed763d0f142dd2ebd78fcae4dc35fc6663824
parent 3a12615ed43b9f9754aaec9315ce9d5daacbbedb
Author: Marc Stibane <marc@taler.net>
Date: Fri, 8 Nov 2024 22:15:28 +0100
Settings
Diffstat:
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/TalerWallet1/Model/Model+Settings.swift b/TalerWallet1/Model/Model+Settings.swift
@@ -34,8 +34,8 @@ fileprivate struct WithdrawTestBalanceRequest: WalletBackendFormattedRequest {
}
}
extension WalletModel {
- @MainActor func loadTestKudosM(_ test: Int, amount: Amount, viewHandles: Bool = false)
- async throws { // M for MainActor
+ nonisolated func loadTestKudos(_ test: Int, amount: Amount, viewHandles: Bool = false)
+ async throws {
let request = WithdrawTestBalanceRequest(amount: amount,
bankBaseUrl: test == 2 ? HEADBANK
: test == 1 ? TESTBANK : DEMOBANK,
@@ -43,7 +43,7 @@ extension WalletModel {
: test == 1 ? TESTEXCHANGE : DEMOEXCHANGE)
let response = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles)
}
-} // loadTestKudosM()
+} // loadTestKudos
// MARK: -
/// A request to add a test balance to the wallet.
fileprivate struct RunIntegrationTest: WalletBackendFormattedRequest {
@@ -77,8 +77,8 @@ fileprivate struct RunIntegrationTest: WalletBackendFormattedRequest {
}
}
extension WalletModel {
- @MainActor func runIntegrationTestM(newVersion: Bool, test: Bool, viewHandles: Bool = false)
- async throws { // M for MainActor
+ nonisolated func runIntegrationTest(newVersion: Bool, test: Bool, viewHandles: Bool = false)
+ async throws {
let amountW = Amount(currency: test ? TESTCURRENCY : DEMOCURRENCY, cent: 300)
let amountS = Amount(currency: test ? TESTCURRENCY : DEMOCURRENCY, cent: 100)
let request = RunIntegrationTest(newVersion: newVersion,
@@ -90,7 +90,7 @@ extension WalletModel {
amountToSpend: amountS)
let _ = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles)
}
-} // runIntegrationTestM()
+} // runIntegrationTest
// MARK: -
/// A request to add a test balance to the wallet.
fileprivate struct InfiniteTransactionLoop: WalletBackendFormattedRequest {
@@ -110,9 +110,9 @@ fileprivate struct InfiniteTransactionLoop: WalletBackendFormattedRequest {
}
}
extension WalletModel {
- func testingInfiniteTransaction(delayMs: Int32, shouldFetch: Bool, viewHandles: Bool = false)
+ nonisolated func testingInfiniteTransaction(delayMs: Int32, shouldFetch: Bool, viewHandles: Bool = false)
async throws {
let request = InfiniteTransactionLoop(delayMs: delayMs, shouldFetch: shouldFetch)
let _ = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles)
}
-} // runIntegrationTestM()
+} // testingInfiniteTransaction
diff --git a/TalerWallet1/Views/Main/WalletEmptyView.swift b/TalerWallet1/Views/Main/WalletEmptyView.swift
@@ -45,7 +45,7 @@ struct WalletEmptyView: View {
Task { // runs on MainActor
let amount = Amount(currency: DEMOCURRENCY, cent: 2500)
symLog.log("Withdraw KUDOS")
- try? await model.loadTestKudosM(0, amount: amount)
+ try? await model.loadTestKudos(0, amount: amount)
}
}
.buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, disabled: withDrawDisabled, aligned: .center))
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -167,7 +167,7 @@ struct SettingsView: View {
Task { // runs on MainActor
symLog.log("Withdraw DEMO KUDOS")
let amount = Amount(currency: DEMOCURRENCY, cent: 1100)
- try? await model.loadTestKudosM(0, amount: amount)
+ try? await model.loadTestKudos(0, amount: amount)
}
}
.buttonStyle(.bordered)
@@ -181,7 +181,7 @@ struct SettingsView: View {
Task { // runs on MainActor
symLog.log("Withdraw TESTKUDOS")
let amount = Amount(currency: TESTCURRENCY, cent: 1100)
- try? await model.loadTestKudosM(1, amount: amount)
+ try? await model.loadTestKudos(1, amount: amount)
}
}
.buttonStyle(.bordered)
@@ -195,16 +195,17 @@ struct SettingsView: View {
Task { // runs on MainActor
symLog.log("Withdraw HEAD KUDOS")
let amount = Amount(currency: DEMOCURRENCY, cent: 1100)
- try? await model.loadTestKudosM(2, amount: amount)
+ try? await model.loadTestKudos(2, amount: amount)
}
}
.buttonStyle(.bordered)
.disabled(withDrawDisabled)
}.id("head1withdraw")
SettingsToggle(name: String("Set 2 seconds delay"),
- value: $developDelay.onChange({ delay in
- walletCore.developDelay = delay}), id1: "delay",
- description: hideDescriptions ? nil : String("After each wallet-core action"))
+ value: $developDelay.onChange({ delay in
+ walletCore.developDelay = delay}),
+ id1: "delay",
+ description: hideDescriptions ? nil : String("After each wallet-core action"))
.id("delay")
#if DEBUG
SettingsItem(name: String("Run Dev Experiment"), id1: "applyDevExperiment",
@@ -228,7 +229,7 @@ struct SettingsView: View {
checkDisabled = true // don't run twice
Task { // runs on MainActor
symLog.log("running integration test on demo")
- try? await model.runIntegrationTestM(newVersion: false, test: false)
+ try? await model.runIntegrationTest(newVersion: false, test: false)
}
}
.buttonStyle(.bordered)
@@ -241,7 +242,7 @@ struct SettingsView: View {
checkDisabled = true // don't run twice
Task { // runs on MainActor
symLog.log("running integration test on test")
- try? await model.runIntegrationTestM(newVersion: false, test: true)
+ try? await model.runIntegrationTest(newVersion: false, test: true)
}
}
.buttonStyle(.bordered)
@@ -254,7 +255,7 @@ struct SettingsView: View {
checkDisabled = true // don't run twice
Task { // runs on MainActor
symLog.log("running integration test V2 on demo")
- try? await model.runIntegrationTestM(newVersion: true, test: false)
+ try? await model.runIntegrationTest(newVersion: true, test: false)
}
}
.buttonStyle(.bordered)
@@ -267,7 +268,7 @@ struct SettingsView: View {
checkDisabled = true // don't run twice
Task { // runs on MainActor
symLog.log("running integration test V2 on test")
- try? await model.runIntegrationTestM(newVersion: true, test: true)
+ try? await model.runIntegrationTest(newVersion: true, test: true)
}
}
.buttonStyle(.bordered)