From cdae092c65c088cf62f1a071b1dcc37b29294aa5 Mon Sep 17 00:00:00 2001 From: alexchornyi <85160203+alexchornyi@users.noreply.github.com> Date: Mon, 5 Jul 2021 13:06:38 +0300 Subject: [PATCH] fixed issue 82 (#83) SecureStorage: Missing argument for parameter 'fileName' in call Co-authored-by: Alexandr Chernyy --- .../xcshareddata/swiftpm/Package.resolved | 11 ++++++++++- DGCAWallet/Models/LocalData.swift | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/DGCAWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DGCAWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8d4802c..d8e0f15 100644 --- a/DGCAWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DGCAWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -10,12 +10,21 @@ "version": "5.4.3" } }, + { + "package": "ASN1Decoder", + "repositoryURL": "https://github.com/filom/ASN1Decoder", + "state": { + "branch": null, + "revision": "65953a42a0f039f53c73e48fd88c02809f7db607", + "version": "1.8.0" + } + }, { "package": "SwiftDGC", "repositoryURL": "https://github.com/eu-digital-green-certificates/dgca-app-core-ios", "state": { "branch": "main", - "revision": "2f9ce82dada06cd44147316ac9d8edbcef919690", + "revision": "96a5bf0ec02fc56bb5c59a4fd579f381f5da9a55", "version": null } }, diff --git a/DGCAWallet/Models/LocalData.swift b/DGCAWallet/Models/LocalData.swift index 69c0fa9..343f5b9 100644 --- a/DGCAWallet/Models/LocalData.swift +++ b/DGCAWallet/Models/LocalData.swift @@ -39,7 +39,14 @@ struct DatedCertString: Codable { } struct LocalData: Codable { - static let appVersion = (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ?? "?.?.?" + private enum Constants { + static let pubKeysStorageFilename = "secure" + static let bundleVersion = "CFBundleShortVersionString" + static let unknown = "?.?.?" + static let versions = "versions" + static let defaultVer = "default" + } + static let appVersion = (Bundle.main.infoDictionary?[Constants.bundleVersion] as? String) ?? Constants.unknown static var sharedInstance = LocalData() var certStrings = [DatedCertString]() @@ -55,7 +62,7 @@ struct LocalData: Codable { sharedInstance.save() } - static let storage = SecureStorage() + static let storage = SecureStorage(fileName: Constants.pubKeysStorageFilename) static func initialize(completion: @escaping () -> Void) { storage.loadOverride(fallback: LocalData.sharedInstance) { success in @@ -74,9 +81,9 @@ struct LocalData: Codable { } var versionedConfig: JSON { - if config["versions"][Self.appVersion].exists() { - return config["versions"][Self.appVersion] + if config[Constants.versions][Self.appVersion].exists() { + return config[Constants.versions][Self.appVersion] } - return config["versions"]["default"] + return config[Constants.versions][Constants.defaultVer] } }