From 92e6613a5de415d531ba890dc047573377e255f1 Mon Sep 17 00:00:00 2001 From: "Tzouvaras, Stilianos" Date: Fri, 13 Sep 2024 13:23:57 +0300 Subject: [PATCH] WalletKit Update to 0.6.7 --- .../xcshareddata/swiftpm/Package.resolved | 4 +-- Modules/logic-core/Package.swift | 2 +- .../Controller/WalletKitController.swift | 27 +++++++++---------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/EudiReferenceWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/EudiReferenceWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index b3eaa6ba..9f67955c 100644 --- a/EudiReferenceWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/EudiReferenceWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-wallet-kit.git", "state" : { - "revision" : "5e952df008bf0d7954372a0d53b9ec228e98dafb", - "version" : "0.6.6" + "revision" : "39dc4b004ce04911e1851194327dc987c9b740e8", + "version" : "0.6.7" } }, { diff --git a/Modules/logic-core/Package.swift b/Modules/logic-core/Package.swift index 89f9abfb..8b6971f1 100644 --- a/Modules/logic-core/Package.swift +++ b/Modules/logic-core/Package.swift @@ -14,7 +14,7 @@ let package = Package( dependencies: [ .package( url: "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-wallet-kit.git", - exact: "0.6.6" + exact: "0.6.7" ), .package( name: "logic-resources", diff --git a/Modules/logic-core/Sources/Controller/WalletKitController.swift b/Modules/logic-core/Sources/Controller/WalletKitController.swift index fa3c3f65..8a011abb 100644 --- a/Modules/logic-core/Sources/Controller/WalletKitController.swift +++ b/Modules/logic-core/Sources/Controller/WalletKitController.swift @@ -122,11 +122,11 @@ final class WalletKitControllerImpl: WalletKitController { } public func clearDocuments(status: DocumentStatus) async throws { - return try await wallet.storage.deleteDocuments(status: status) + return try await wallet.deleteDocuments(status: status) } public func deleteDocument(with id: String, status: DocumentStatus) async throws { - return try await wallet.storage.deleteDocument(id: id, status: status) + return try await wallet.deleteDocument(id: id, status: status) } public func loadDocuments() async throws { @@ -321,33 +321,30 @@ extension WalletKitController { return .image(imageName.image) } + guard let document = fetchDocument(with: documentId) else { + return .unavailable(LocalizableString.shared.get(with: .errorUnableFetchDocument)) + } + // Convert the Stored models to their [Key: Value] array - let displayStrings = wallet.storage.mdocModels - .first(where: { $0.id == documentId })?.displayStrings + var displayStrings = document.displayStrings .decodeGender() .decodeUserPseudonym() .parseDates(parser: parser) .mapTrueFalseToLocalizable() - // Check if document type matches one of known models (pid or mdl) - guard var displayStrings = displayStrings else { - return .unavailable(LocalizableString.shared.get(with: .unavailableField)) - } - - if documentType == .MDL, - let mdl = wallet.storage.mdlModel { + if documentType == .MDL { // Flatten properties in order to be made in a Key: Value structure - if let drivingPrivileges = mdl.getDrivingPrivileges(parser: parser) { + if let drivingPrivileges = document.getDrivingPrivileges(parser: parser) { displayStrings.appendOrReplace(drivingPrivileges) } displayStrings.appendOrReplace( - contentsOf: decodeAgeOver(ageOverDictionary: mdl.ageOverXX) + contentsOf: decodeAgeOver(ageOverDictionary: document.ageOverXX) ) - } else if documentType == .PID, let pid = wallet.storage.pidModel { + } else if documentType == .PID { displayStrings.appendOrReplace( - contentsOf: decodeAgeOver(ageOverDictionary: pid.ageOverXX) + contentsOf: decodeAgeOver(ageOverDictionary: document.ageOverXX) ) } // Find the first Value that Matches given Key for document