Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SecureStorage: Missing argument for parameter 'fileName' in call

Co-authored-by: Alexandr Chernyy <[email protected]>
  • Loading branch information
alexchornyi and pingus-nikalex authored Jul 5, 2021
1 parent 6f53d64 commit cdae092
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
},
Expand Down
17 changes: 12 additions & 5 deletions DGCAWallet/Models/LocalData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]()
Expand All @@ -55,7 +62,7 @@ struct LocalData: Codable {
sharedInstance.save()
}

static let storage = SecureStorage<LocalData>()
static let storage = SecureStorage<LocalData>(fileName: Constants.pubKeysStorageFilename)

static func initialize(completion: @escaping () -> Void) {
storage.loadOverride(fallback: LocalData.sharedInstance) { success in
Expand All @@ -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]
}
}

0 comments on commit cdae092

Please sign in to comment.