Skip to content

Commit

Permalink
feat: partner params key encoding errors (#169)
Browse files Browse the repository at this point in the history
* feat: partner params key encoding errors

* feat: bump version to 10.1.2

* feat: swiftformat

* Update CHANGELOG.md

Co-authored-by: Vansh Gandhi <[email protected]>

* fix: remove test params

---------

Co-authored-by: Vansh Gandhi <[email protected]>
  • Loading branch information
JNdhlovu and vanshg authored May 10, 2024
1 parent a1b487f commit fbb082e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes

## 10.1.2

#### Fixed

* Ignore `user_id`, `job_id`, and `job_type` fields in `extraPartnerParams`

## 10.1.1

#### Added
Expand Down
8 changes: 6 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
PODS:
- lottie-ios (4.4.3)
- netfox (1.21.0)
- Sentry (8.20.0):
- Sentry/Core (= 8.20.0)
- SentryPrivate (= 8.20.0)
- Sentry/Core (8.20.0):
- SentryPrivate (= 8.20.0)
- SentryPrivate (8.20.0)
- SmileID (10.0.10):
- SmileID (10.1.2):
- lottie-ios (~> 4.4.2)
- Zip (~> 2.1.0)
- SwiftLint (0.54.0)
- Zip (2.1.2)
Expand All @@ -19,6 +21,7 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- lottie-ios
- netfox
- Sentry
- SentryPrivate
Expand All @@ -30,10 +33,11 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
lottie-ios: fcb5e73e17ba4c983140b7d21095c834b3087418
netfox: 9d5cc727fe7576c4c7688a2504618a156b7d44b7
Sentry: a8d7b373b9f9868442b02a0c425192f693103cbf
SentryPrivate: 006b24af16828441f70e2ab6adf241bd0a8ad130
SmileID: ffaa1eab202cb9c402ade1cc66ceaf5a2c99c686
SmileID: 21923d7c669ec701c35580ab4e401ad76f83fade
SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211
Zip: b3fef584b147b6e582b2256a9815c897d60ddc67

Expand Down
2 changes: 2 additions & 0 deletions Example/SmileID.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
"${BUILT_PRODUCTS_DIR}/SentryPrivate/SentryPrivate.framework",
"${BUILT_PRODUCTS_DIR}/SmileID/SmileID.framework",
"${BUILT_PRODUCTS_DIR}/Zip/Zip.framework",
"${BUILT_PRODUCTS_DIR}/lottie-ios/Lottie.framework",
"${BUILT_PRODUCTS_DIR}/netfox/netfox.framework",
);
name = "[CP] Embed Pods Frameworks";
Expand All @@ -472,6 +473,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SentryPrivate.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SmileID.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Zip.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lottie.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/netfox.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
7 changes: 4 additions & 3 deletions Example/SmileID/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct HomeView: View {
Text("Test Our Products")
.font(SmileID.theme.header2)
.foregroundColor(.black)

MyVerticalGrid(
maxColumns: 2,
items: [
Expand Down Expand Up @@ -92,7 +92,7 @@ struct HomeView: View {
content: {
EnhancedDocumentVerificationWithSelector(delegate: viewModel)
}
)
),
].map { AnyView($0) }
)

Expand Down Expand Up @@ -170,7 +170,8 @@ private struct DocumentVerificationWithSelector: View {
var body: some View {
if let countryCode,
let documentType,
let captureBothSides {
let captureBothSides
{
SmileID.documentVerificationScreen(
countryCode: countryCode,
documentType: documentType,
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.1.1'
s.version = '10.1.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.1.1" }
s.source = { :git => "https://github.com/smileidentity/ios.git", :tag => "v10.1.2" }
s.ios.deployment_target = '13.0'
s.dependency 'Zip', '~> 2.1.0'
s.dependency 'lottie-ios', '~> 4.4.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ extension PartnerParams {
// Encode extras directly at the root level
if let extras = extras {
for (key, value) in extras {
try container.encode(value, forKey: .init(stringValue: key)!)
if key != "job_id" && key != "user_id" && key != "job_type" {
try container.encode(value, forKey: .init(stringValue: key)!)
}
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions Sources/SmileID/Classes/SmileID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import SwiftUI
import UIKit

public class SmileID {
public static let version = "10.1.1"
public static let version = "10.1.2"
@Injected var injectedApi: SmileIDServiceable
public static var configuration: Config { config }

public static var api: SmileIDServiceable { SmileID.instance.injectedApi }

internal static let instance: SmileID = {
static let instance: SmileID = {
let container = DependencyContainer.shared
container.register(SmileIDServiceable.self) { SmileIDService() }
container.register(RestServiceClient.self) { URLSessionRestServiceClient() }
Expand All @@ -24,9 +24,9 @@ public class SmileID {
public private(set) static var useSandbox = false
public private(set) static var allowOfflineMode = true
public private(set) static var callbackUrl: String = ""
internal static var apiKey: String?
static var apiKey: String?
public private(set) static var theme: SmileIdTheme = DefaultTheme()
internal private(set) static var localizableStrings: SmileIDLocalizableStrings?
private(set) static var localizableStrings: SmileIDLocalizableStrings?

/// This method initializes SmileID. Invoke this method once in your application lifecycle
/// before calling any other SmileID methods.
Expand Down Expand Up @@ -142,16 +142,16 @@ public class SmileID {
let authResponse = try await SmileID.api.authenticate(request: authRequest).async()
let prepUploadRequest = PrepUploadRequest(
partnerParams: authResponse.partnerParams.copy(extras: prepUploadFile.partnerParams.extras),
allowNewEnroll: String(prepUploadFile.allowNewEnroll), // TODO - Fix when Michael changes this to boolean
allowNewEnroll: String(prepUploadFile.allowNewEnroll), // TODO: - Fix when Michael changes this to boolean
timestamp: authResponse.timestamp,
signature: authResponse.signature
)
let prepUploadResponse = try await SmileID.api.prepUpload(request: prepUploadRequest).async()
let allFiles = try LocalStorage.getFilesByType(jobId: jobId, fileType: FileType.liveness)! + [
try LocalStorage.getFileByType(jobId: jobId, fileType: FileType.selfie),
try LocalStorage.getFileByType(jobId: jobId, fileType: FileType.documentFront),
try LocalStorage.getFileByType(jobId: jobId, fileType: FileType.documentBack),
try LocalStorage.getInfoJsonFile(jobId: jobId)
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 zipUrl = try LocalStorage.zipFiles(at: allFiles)
zip = try Data(contentsOf: zipUrl)
Expand Down

0 comments on commit fbb082e

Please sign in to comment.