commit 76b8056176d02607e9db8041ddd66631e268d030
parent a6701681236a61c5e09e6b8369b7e114ea0ae8e8
Author: Marc Stibane <marc@taler.net>
Date: Tue, 24 Jun 2025 07:21:00 +0200
Export as json
Diffstat:
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/TalerWallet1/Model/WalletModel.swift b/TalerWallet1/Model/WalletModel.swift
@@ -450,19 +450,31 @@ extension WalletModel {
// MARK: -
fileprivate struct ExportDbToFile: WalletBackendFormattedRequest {
func operation() -> String { "exportDbToFile" }
- func args() -> Args { Args(directory: directory, stem: stem) }
+ func args() -> Args { Args(directory: directory, stem: stem, forceFormat: "json") }
var directory: String
var stem: String
struct Args: Encodable {
var directory: String
var stem: String
- } // no arguments needed
+ var forceFormat: String
+ }
struct Response: Decodable, Sendable { // path of the copied DB
var path: String
}
}
+fileprivate struct ImportDbFromFile: WalletBackendFormattedRequest {
+ func operation() -> String { "importDbFromFile" }
+ func args() -> Args { Args(path: path ) }
+
+ var path: String
+ struct Args: Encodable {
+ var path: String
+ }
+ struct Response: Decodable {}
+}
+
extension WalletModel {
/// export DB
nonisolated func exportDbToFile(stem: String, viewHandles: Bool = false)
@@ -477,6 +489,11 @@ extension WalletModel {
return nil
}
}
+ nonisolated func importDbFromFile(path: String, viewHandles: Bool = false)
+ async throws {
+ let request = ImportDbFromFile(path: path)
+ _ = try await sendRequest(request, viewHandles: viewHandles)
+ }
}
// MARK: -
fileprivate struct DevExperimentRequest: WalletBackendFormattedRequest {