diff --git a/CHANGELOG.md b/CHANGELOG.md index dccdbe08a..864ad5553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Release Notes +## 10.2.5 + +#### Fixed +* Job status history full data parsing causing a crash during polling + ## 10.2.4 #### Fixed diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 4b51ccb5a..3db08726a 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -4,7 +4,7 @@ PODS: - Sentry (8.31.1): - Sentry/Core (= 8.31.1) - Sentry/Core (8.31.1) - - SmileID (10.2.4): + - SmileID (10.2.5): - lottie-ios (~> 4.4.2) - Zip (~> 2.1.0) - SwiftLint (0.55.1) @@ -32,7 +32,7 @@ SPEC CHECKSUMS: lottie-ios: fcb5e73e17ba4c983140b7d21095c834b3087418 netfox: 9d5cc727fe7576c4c7688a2504618a156b7d44b7 Sentry: 9c1188876ea1291d1a9db4b38c3f17ebd8e6985e - SmileID: d36a5ed65e9c2ee44b5199bc97bb0f174834c326 + SmileID: 09d42fdc65cd4d2b0d33fd33e14e8c85a189a64b SwiftLint: 3fe909719babe5537c552ee8181c0031392be933 Zip: b3fef584b147b6e582b2256a9815c897d60ddc67 diff --git a/SmileID.podspec b/SmileID.podspec index 45bd48c76..84acbc933 100644 --- a/SmileID.podspec +++ b/SmileID.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = 'SmileID' - s.version = '10.2.4' + s.version = '10.2.5' s.summary = 'The Official Smile Identity iOS SDK.' s.homepage = 'https://docs.usesmileid.com/integration-options/mobile/ios-v10-beta' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Japhet' => 'japhet@usesmileid.com', 'Juma Allan' => 'juma@usesmileid.com', 'Vansh Gandhi' => 'vansh@usesmileid.com'} - s.source = { :git => "https://github.com/smileidentity/ios.git", :tag => "v10.2.4" } + s.source = { :git => "https://github.com/smileidentity/ios.git", :tag => "v10.2.5" } s.ios.deployment_target = '13.0' s.dependency 'Zip', '~> 2.1.0' s.dependency 'lottie-ios', '~> 4.4.2' diff --git a/Sources/SmileID/Classes/Networking/Models/JobStatus.swift b/Sources/SmileID/Classes/Networking/Models/JobStatus.swift index 3b36b734c..83d63b785 100644 --- a/Sources/SmileID/Classes/Networking/Models/JobStatus.swift +++ b/Sources/SmileID/Classes/Networking/Models/JobStatus.swift @@ -170,7 +170,7 @@ public class BiometricKycJobResult: JobResult { public let address: String? public let country: String? public let documentImageBase64: String? - public let fullData: [String: String]? + public let fullData: FlexibleDictionary? public let fullName: String? public let idNumber: String? public let phoneNumber: String? @@ -192,7 +192,7 @@ public class BiometricKycJobResult: JobResult { documentImageBase64 = try container.decodeIfPresent( String.self, forKey: .documentImageBase64 ) - fullData = try container.decodeIfPresent([String: String].self, forKey: .fullData) + fullData = try container.decodeIfPresent(FlexibleDictionary.self, forKey: .fullData) fullName = try container.decodeIfPresent(String.self, forKey: .fullName) idNumber = try container.decodeIfPresent(String.self, forKey: .idNumber) phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber) @@ -288,7 +288,7 @@ public class EnhancedDocumentVerificationJobResult: JobResult { public let address: String? public let country: String? public let documentImageBase64: String? - public let fullData: [String: String]? + public let fullData: FlexibleDictionary? public let fullName: String? public let idNumber: String? public let phoneNumber: String? @@ -310,7 +310,7 @@ public class EnhancedDocumentVerificationJobResult: JobResult { documentImageBase64 = try container.decodeIfPresent( String.self, forKey: .documentImageBase64 ) - fullData = try container.decodeIfPresent([String: String].self, forKey: .fullData) + fullData = try container.decodeIfPresent(FlexibleDictionary.self, forKey: .fullData) fullName = try container.decodeIfPresent(String.self, forKey: .fullName) idNumber = try container.decodeIfPresent(String.self, forKey: .idNumber) phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber) @@ -555,3 +555,43 @@ public struct ImageLinks: Codable { case error } } + +public struct FlexibleDictionary: Codable { + enum Value: Codable { + case string(String) + case bool(Bool) + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + if let stringValue = try? container.decode(String.self) { + self = .string(stringValue) + } else if let boolValue = try? container.decode(Bool.self) { + self = .bool(boolValue) + } else { + throw DecodingError.dataCorruptedError(in: container, debugDescription: "Cannot decode value") + } + } + + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + switch self { + case .string(let value): + try container.encode(value) + case .bool(let value): + try container.encode(value) + } + } + } + + var dictionary: [String: Value] + + public init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + self.dictionary = try container.decode([String: Value].self) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(dictionary) + } +} diff --git a/Sources/SmileID/Classes/SmileID.swift b/Sources/SmileID/Classes/SmileID.swift index fedecc6e7..f48821211 100644 --- a/Sources/SmileID/Classes/SmileID.swift +++ b/Sources/SmileID/Classes/SmileID.swift @@ -3,7 +3,7 @@ import SwiftUI import UIKit public class SmileID { - public static let version = "10.2.4" + public static let version = "10.2.5" @Injected var injectedApi: SmileIDServiceable public static var configuration: Config { config }