Skip to content

Commit

Permalink
Bugfix/pollinghistoryfix (#205)
Browse files Browse the repository at this point in the history
* fix: jobstatus full data parsing

* chore bump version to 10.2.5
  • Loading branch information
JNdhlovu authored Jul 24, 2024
1 parent a53a9f1 commit a075c55
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -32,7 +32,7 @@ SPEC CHECKSUMS:
lottie-ios: fcb5e73e17ba4c983140b7d21095c834b3087418
netfox: 9d5cc727fe7576c4c7688a2504618a156b7d44b7
Sentry: 9c1188876ea1291d1a9db4b38c3f17ebd8e6985e
SmileID: d36a5ed65e9c2ee44b5199bc97bb0f174834c326
SmileID: 09d42fdc65cd4d2b0d33fd33e14e8c85a189a64b
SwiftLint: 3fe909719babe5537c552ee8181c0031392be933
Zip: b3fef584b147b6e582b2256a9815c897d60ddc67

Expand Down
4 changes: 2 additions & 2 deletions SmileID.podspec
Original file line number Diff line number Diff line change
@@ -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' => '[email protected]', 'Juma Allan' => '[email protected]', 'Vansh Gandhi' => '[email protected]'}
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'
Expand Down
48 changes: 44 additions & 4 deletions Sources/SmileID/Classes/Networking/Models/JobStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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)
Expand Down Expand Up @@ -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?
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion Sources/SmileID/Classes/SmileID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down

0 comments on commit a075c55

Please sign in to comment.