Skip to content

Commit

Permalink
Bugfix/retrycrash (#195)
Browse files Browse the repository at this point in the history
* fix: remove force unwrapping when getting files

* feat: bump version to 10.2.2

* feat: remove force unwrapping when submitting offline jobs

* feat: remove trailing commas
  • Loading branch information
JNdhlovu authored Jul 11, 2024
1 parent 1ac3b0a commit 6c4fcf3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 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.2

#### Fixed
* Remove force unwrapping for getting files from storage

## 10.2.1

#### Added
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.26.0):
- Sentry/Core (= 8.26.0)
- Sentry/Core (8.26.0)
- SmileID (10.2.1):
- SmileID (10.2.2):
- 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: 74a073c71c998117edb08f56f443c83570a31bed
SmileID: a69509562442d9a9f00abf8bf1f47fff2d26dee4
SmileID: 9d95463475f933422b2ce136474813b528dbedb7
SwiftLint: 3fe909719babe5537c552ee8181c0031392be933
Zip: b3fef584b147b6e582b2256a9815c897d60ddc67

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
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.1'
s.version = '10.2.2'
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.1" }
s.source = { :git => "https://github.com/smileidentity/ios.git", :tag => "v10.2.2" }
s.ios.deployment_target = '13.0'
s.dependency 'Zip', '~> 2.1.0'
s.dependency 'lottie-ios', '~> 4.4.2'
Expand Down
2 changes: 1 addition & 1 deletion Sources/SmileID/Classes/Helpers/LocalStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class LocalStorage {
submitted: Bool = false
) throws -> URL? {
let contents = try getDirectoryContents(jobId: jobId, submitted: submitted)
return contents.first(where: { $0.lastPathComponent.contains(fileType.name) })!
return contents.first(where: { $0.lastPathComponent.contains(fileType.name) })
}

static func getFilesByType(
Expand Down
21 changes: 14 additions & 7 deletions 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.1"
public static let version = "10.2.2"
@Injected var injectedApi: SmileIDServiceable
public static var configuration: Config { config }

Expand Down Expand Up @@ -148,12 +148,19 @@ public class SmileID {
signature: authResponse.signature
)
let prepUploadResponse = try await SmileID.api.prepUpload(request: prepUploadRequest)
let allFiles = try LocalStorage.getFilesByType(jobId: jobId, fileType: FileType.liveness)! + [
LocalStorage.getFileByType(jobId: jobId, fileType: FileType.selfie),
LocalStorage.getFileByType(jobId: jobId, fileType: FileType.documentFront),
LocalStorage.getFileByType(jobId: jobId, fileType: FileType.documentBack),
LocalStorage.getInfoJsonFile(jobId: jobId)
].compactMap { $0 }
let allFiles: [URL]
do {
let livenessFiles = try LocalStorage.getFilesByType(jobId: jobId, fileType: .liveness) ?? []
let additionalFiles = try [
LocalStorage.getFileByType(jobId: jobId, fileType: .selfie),
LocalStorage.getFileByType(jobId: jobId, fileType: .documentFront),
LocalStorage.getFileByType(jobId: jobId, fileType: .documentBack),
LocalStorage.getInfoJsonFile(jobId: jobId)
].compactMap { $0 }
allFiles = livenessFiles + additionalFiles
} catch {
throw error
}
let zipUrl = try LocalStorage.zipFiles(at: allFiles)
zip = try Data(contentsOf: zipUrl)
_ = try await SmileID.api.upload(
Expand Down

0 comments on commit 6c4fcf3

Please sign in to comment.