From 705ea54c010fd8cc0dc5bc259481c12a2b273e1b Mon Sep 17 00:00:00 2001 From: Juma Allan Date: Thu, 16 Nov 2023 21:43:33 +0300 Subject: [PATCH] Rename partnerParams to extraPartnerParams (#99) --- .../OrchestratedBiometricKycScreen.swift | 6 ++-- .../OrchestratedBiometricKycViewModel.swift | 8 ++--- ...stratedDocumentVerificationViewModel.swift | 8 ++--- ...chestratedDocumentVerificationScreen.swift | 18 +++++------ .../Networking/Models/PartnerParams.swift | 4 +-- .../ViewModel/SelfieCaptureViewModel.swift | 8 ++--- Sources/SmileID/Classes/SmileID.swift | 30 +++++++++---------- .../Classes/Views/JobSubmittable.swift | 6 ++-- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycScreen.swift b/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycScreen.swift index 8c71abf52..0d1d2ee8b 100644 --- a/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycScreen.swift +++ b/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycScreen.swift @@ -11,7 +11,7 @@ struct OrchestratedBiometricKycScreen: View { let showInstructions: Bool let showAttribution: Bool let allowAgentMode: Bool - let partnerParams: [String: String] = [:] + let extraPartnerParams: [String: String] = [:] let delegate: BiometricKycResultDelegate @ObservedObject private var viewModel: OrchestratedBiometricKycViewModel @@ -28,7 +28,7 @@ struct OrchestratedBiometricKycScreen: View { showInstructions: Bool, showAttribution: Bool, allowAgentMode: Bool, - partnerParams: [String: String] = [:], + extraPartnerParams: [String: String] = [:], delegate: BiometricKycResultDelegate ) { self.userId = userId @@ -42,7 +42,7 @@ struct OrchestratedBiometricKycScreen: View { self.allowAgentMode = allowAgentMode self.delegate = delegate viewModel = OrchestratedBiometricKycViewModel( - userId: userId, jobId: jobId, idInfo: idInfo, partnerParams: partnerParams + userId: userId, jobId: jobId, idInfo: idInfo, extraPartnerParams: extraPartnerParams ) } diff --git a/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycViewModel.swift b/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycViewModel.swift index 8d27bdda7..d13665286 100644 --- a/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycViewModel.swift +++ b/Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycViewModel.swift @@ -14,7 +14,7 @@ internal class OrchestratedBiometricKycViewModel: ObservableObject, SelfieImageC // MARK: - Input Properties private let userId: String private let jobId: String - private var partnerParams: [String: String] + private var extraPartnerParams: [String: String] private var idInfo: IdInfo? // MARK: - Other Properties @@ -27,11 +27,11 @@ internal class OrchestratedBiometricKycViewModel: ObservableObject, SelfieImageC messageKey: "BiometricKYC.Loading.IdTypes" ) - init(userId: String, jobId: String, idInfo: IdInfo?, partnerParams: [String: String] = [:]) { + init(userId: String, jobId: String, idInfo: IdInfo?, extraPartnerParams: [String: String] = [:]) { self.userId = userId self.jobId = jobId self.idInfo = idInfo - self.partnerParams = partnerParams + self.extraPartnerParams = extraPartnerParams if let idInfo = idInfo { guard let idType = idInfo.idType else { fatalError("You are expected to pass in the idType if you pass in idInfo") @@ -214,7 +214,7 @@ internal class OrchestratedBiometricKycViewModel: ObservableObject, SelfieImageC ) let authResponse = try await SmileID.api.authenticate(request: authRequest).async() let prepUploadRequest = PrepUploadRequest( - partnerParams: authResponse.partnerParams.copy(partnerParams: partnerParams), + partnerParams: authResponse.partnerParams.copy(extras: extraPartnerParams), timestamp: authResponse.timestamp, signature: authResponse.signature ) diff --git a/Sources/SmileID/Classes/DocumentVerification/Model/OrchestratedDocumentVerificationViewModel.swift b/Sources/SmileID/Classes/DocumentVerification/Model/OrchestratedDocumentVerificationViewModel.swift index 388434e5e..e2dd2907f 100644 --- a/Sources/SmileID/Classes/DocumentVerification/Model/OrchestratedDocumentVerificationViewModel.swift +++ b/Sources/SmileID/Classes/DocumentVerification/Model/OrchestratedDocumentVerificationViewModel.swift @@ -18,7 +18,7 @@ internal class IOrchestratedDocumentVerificationViewModel: Obse internal let captureBothSides: Bool internal var selfieFile: Data? internal let jobType: JobType - internal let partnerParams: [String: String] + internal let extraPartnerParams: [String: String] // Other properties internal var documentFrontFile: Data? @@ -41,7 +41,7 @@ internal class IOrchestratedDocumentVerificationViewModel: Obse captureBothSides: Bool, selfieFile: URL?, jobType: JobType, - partnerParams: [String: String] = [:] + extraPartnerParams: [String: String] = [:] ) { self.userId = userId self.jobId = jobId @@ -50,7 +50,7 @@ internal class IOrchestratedDocumentVerificationViewModel: Obse self.captureBothSides = captureBothSides self.selfieFile = selfieFile.flatMap { try? Data(contentsOf: $0) } self.jobType = jobType - self.partnerParams = partnerParams + self.extraPartnerParams = extraPartnerParams } func onFrontDocumentImageConfirmed(data: Data) { @@ -142,7 +142,7 @@ internal class IOrchestratedDocumentVerificationViewModel: Obse let auth = SmileID.api.authenticate(request: authRequest) networkingSubscriber = auth.flatMap { authResponse in let prepUploadRequest = PrepUploadRequest( - partnerParams: authResponse.partnerParams.copy(partnerParams: self.partnerParams), + partnerParams: authResponse.partnerParams.copy(extras: self.extraPartnerParams), timestamp: authResponse.timestamp, signature: authResponse.signature ) diff --git a/Sources/SmileID/Classes/DocumentVerification/View/OrchestratedDocumentVerificationScreen.swift b/Sources/SmileID/Classes/DocumentVerification/View/OrchestratedDocumentVerificationScreen.swift index 34cb67426..7ac7fab9b 100644 --- a/Sources/SmileID/Classes/DocumentVerification/View/OrchestratedDocumentVerificationScreen.swift +++ b/Sources/SmileID/Classes/DocumentVerification/View/OrchestratedDocumentVerificationScreen.swift @@ -12,7 +12,7 @@ struct OrchestratedDocumentVerificationScreen: View { let allowGalleryUpload: Bool let allowAgentMode: Bool let showInstructions: Bool - let partnerParams: [String: String] + let extraPartnerParams: [String: String] let onResult: DocumentVerificationResultDelegate var body: some View { @@ -28,7 +28,7 @@ struct OrchestratedDocumentVerificationScreen: View { allowGalleryUpload: allowGalleryUpload, allowAgentMode: allowAgentMode, showInstructions: showInstructions, - partnerParams: partnerParams, + extraPartnerParams: extraPartnerParams, onResult: onResult, viewModel: OrchestratedDocumentVerificationViewModel( userId: userId, @@ -38,7 +38,7 @@ struct OrchestratedDocumentVerificationScreen: View { captureBothSides: captureBothSides, selfieFile: bypassSelfieCaptureWithFile, jobType: .documentVerification, - partnerParams: partnerParams + extraPartnerParams: extraPartnerParams ) ) } @@ -56,7 +56,7 @@ struct OrchestratedEnhancedDocumentVerificationScreen: View { let allowGalleryUpload: Bool let allowAgentMode: Bool let showInstructions: Bool - let partnerParams: [String: String] + let extraPartnerParams: [String: String] let onResult: EnhancedDocumentVerificationResultDelegate var body: some View { @@ -72,7 +72,7 @@ struct OrchestratedEnhancedDocumentVerificationScreen: View { allowGalleryUpload: allowGalleryUpload, allowAgentMode: allowAgentMode, showInstructions: showInstructions, - partnerParams: partnerParams, + extraPartnerParams: extraPartnerParams, onResult: onResult, viewModel: OrchestratedEnhancedDocumentVerificationViewModel( userId: userId, @@ -82,7 +82,7 @@ struct OrchestratedEnhancedDocumentVerificationScreen: View { captureBothSides: captureBothSides, selfieFile: bypassSelfieCaptureWithFile, jobType: .enhancedDocumentVerification, - partnerParams: partnerParams + extraPartnerParams: extraPartnerParams ) ) } @@ -100,7 +100,7 @@ private struct IOrchestratedDocumentVerificationScreen: View { let allowGalleryUpload: Bool let allowAgentMode: Bool let showInstructions: Bool - var partnerParams: [String: String] + var extraPartnerParams: [String: String] let onResult: T @ObservedObject var viewModel: IOrchestratedDocumentVerificationViewModel @@ -116,7 +116,7 @@ private struct IOrchestratedDocumentVerificationScreen: View { allowGalleryUpload: Bool, allowAgentMode: Bool, showInstructions: Bool, - partnerParams: [String: String], + extraPartnerParams: [String: String], onResult: T, viewModel: IOrchestratedDocumentVerificationViewModel ) { @@ -131,7 +131,7 @@ private struct IOrchestratedDocumentVerificationScreen: View { self.allowGalleryUpload = allowGalleryUpload self.allowAgentMode = allowAgentMode self.showInstructions = showInstructions - self.partnerParams = partnerParams + self.extraPartnerParams = extraPartnerParams self.onResult = onResult self.viewModel = viewModel } diff --git a/Sources/SmileID/Classes/Networking/Models/PartnerParams.swift b/Sources/SmileID/Classes/Networking/Models/PartnerParams.swift index 00dcebfe7..56d0149c7 100644 --- a/Sources/SmileID/Classes/Networking/Models/PartnerParams.swift +++ b/Sources/SmileID/Classes/Networking/Models/PartnerParams.swift @@ -26,9 +26,9 @@ public struct PartnerParams: Codable { } // Method for copying with modified properties - func copy(partnerParams: [String: String]?) -> PartnerParams { + func copy(extras: [String: String]?) -> PartnerParams { return PartnerParams( - jobId: self.jobId, userId: self.userId, jobType: self.jobType, extras: partnerParams + jobId: self.jobId, userId: self.userId, jobType: self.jobType, extras: extras ) } } diff --git a/Sources/SmileID/Classes/SelfieCapture/ViewModel/SelfieCaptureViewModel.swift b/Sources/SmileID/Classes/SelfieCapture/ViewModel/SelfieCaptureViewModel.swift index 23c358e27..b0b1807fd 100644 --- a/Sources/SmileID/Classes/SelfieCapture/ViewModel/SelfieCaptureViewModel.swift +++ b/Sources/SmileID/Classes/SelfieCapture/ViewModel/SelfieCaptureViewModel.swift @@ -81,7 +81,7 @@ final class SelfieCaptureViewModel: ObservableObject, JobSubmittable, Confirmati private var userId: String private var jobId: String private var isEnroll: Bool - private var partnerParams: [String: String] + private var extraPartnerParams: [String: String] private var shouldSubmitJob: Bool private (set) var showAttribution: Bool internal var selfieImage: Data? @@ -136,7 +136,7 @@ final class SelfieCaptureViewModel: ObservableObject, JobSubmittable, Confirmati userId: String, jobId: String, isEnroll: Bool, - partnerParams: [String: String] = [:], + extraPartnerParams: [String: String] = [:], allowsAgentMode: Bool = false, showAttribution: Bool = true, cameraManager: CameraManageable? = nil, @@ -146,7 +146,7 @@ final class SelfieCaptureViewModel: ObservableObject, JobSubmittable, Confirmati self.userId = userId self.isEnroll = isEnroll self.jobId = jobId - self.partnerParams = partnerParams + self.extraPartnerParams = extraPartnerParams self.shouldSubmitJob = shouldSubmitJob self.showAttribution = showAttribution self.allowsAgentMode = allowsAgentMode @@ -431,7 +431,7 @@ final class SelfieCaptureViewModel: ObservableObject, JobSubmittable, Confirmati SmileID.api.authenticate(request: authRequest) .flatMap { authResponse in - self.prepUpload(authResponse: authResponse, partnerParams: self.partnerParams) + self.prepUpload(authResponse: authResponse, extraPartnerParams: self.extraPartnerParams) .flatMap { prepUploadResponse in self.upload(prepUploadResponse, zip: zip) .filter { result in diff --git a/Sources/SmileID/Classes/SmileID.swift b/Sources/SmileID/Classes/SmileID.swift index 0e147a9b1..923a6f368 100644 --- a/Sources/SmileID/Classes/SmileID.swift +++ b/Sources/SmileID/Classes/SmileID.swift @@ -114,7 +114,7 @@ public class SmileID { /// - showAttribution: Whether to show the Smile ID attribution or not on the Instructions /// screen /// - showInstructions: Whether to deactivate capture screen's instructions for SmartSelfie. - /// - partnerParams: Custom values specific to partners + /// - extraPartnerParams: Custom values specific to partners /// - delegate: Callback to be invoked when the SmartSelfieā„¢ Enrollment is complete. public class func smartSelfieEnrollmentScreen( userId: String = generateUserId(), @@ -122,14 +122,14 @@ public class SmileID { allowAgentMode: Bool = false, showAttribution: Bool = true, showInstructions: Bool = true, - partnerParams: [String: String] = [:], + extraPartnerParams: [String: String] = [:], delegate: SmartSelfieResultDelegate ) -> some View { let viewModel = SelfieCaptureViewModel( userId: userId, jobId: jobId, isEnroll: true, - partnerParams: partnerParams, + extraPartnerParams: extraPartnerParams, allowsAgentMode: allowAgentMode, showAttribution: showAttribution ) @@ -156,7 +156,7 @@ public class SmileID { /// - showAttribution: Whether to show the Smile ID attribution or not on the Instructions /// screen /// - showInstructions: Whether to deactivate capture screen's instructions for SmartSelfie. - /// - partnerParams: Custom values specific to partners + /// - extraPartnerParams: Custom values specific to partners /// - delegate: Callback to be invoked when the SmartSelfieā„¢ Authentication is complete. public class func smartSelfieAuthenticationScreen( userId: String, @@ -164,14 +164,14 @@ public class SmileID { allowAgentMode: Bool = false, showAttribution: Bool = true, showInstructions: Bool = true, - partnerParams: [String: String] = [:], + extraPartnerParams: [String: String] = [:], delegate: SmartSelfieResultDelegate ) -> some View { let viewModel = SelfieCaptureViewModel( userId: userId, jobId: jobId, isEnroll: false, - partnerParams: partnerParams, + extraPartnerParams: extraPartnerParams, allowsAgentMode: allowAgentMode, showAttribution: showAttribution ) @@ -202,7 +202,7 @@ public class SmileID { /// - showInstructions: Whether to deactivate capture screen's instructions for Document /// Verification (NB! If instructions are disabled, gallery upload won't be possible) /// - showAttribution: Whether to show the Smile ID attribution on the Instructions screen - /// - partnerParams: Custom values specific to partners + /// - extraPartnerParams: Custom values specific to partners /// - delegate: The delegate object that receives the result of the Document Verification public class func documentVerificationScreen( userId: String = generateUserId(), @@ -216,7 +216,7 @@ public class SmileID { allowGalleryUpload: Bool = false, showInstructions: Bool = true, showAttribution: Bool = true, - partnerParams: [String: String] = [:], + extraPartnerParams: [String: String] = [:], delegate: DocumentVerificationResultDelegate ) -> some View { OrchestratedDocumentVerificationScreen( @@ -231,7 +231,7 @@ public class SmileID { allowGalleryUpload: allowGalleryUpload, allowAgentMode: allowAgentMode, showInstructions: showInstructions, - partnerParams: partnerParams, + extraPartnerParams: extraPartnerParams, onResult: delegate ).environmentObject(router) } @@ -260,7 +260,7 @@ public class SmileID { /// - showInstructions: Whether to deactivate capture screen's instructions for Document /// Verification (NB! If instructions are disabled, gallery upload won't be possible) /// - showAttribution: Whether to show the Smile ID attribution on the Instructions screen - /// - partnerParams: Custom values specific to partners + /// - extraPartnerParams: Custom values specific to partners /// - delegate: The delegate object that receives the result of the Document Verification public class func enhancedDocumentVerificationScreen( userId: String = generateUserId(), @@ -274,7 +274,7 @@ public class SmileID { allowGalleryUpload: Bool = false, showInstructions: Bool = true, showAttribution: Bool = true, - partnerParams: [String: String] = [:], + extraPartnerParams: [String: String] = [:], delegate: EnhancedDocumentVerificationResultDelegate ) -> some View { OrchestratedEnhancedDocumentVerificationScreen( @@ -289,7 +289,7 @@ public class SmileID { allowGalleryUpload: allowGalleryUpload, allowAgentMode: allowAgentMode, showInstructions: showInstructions, - partnerParams: partnerParams, + extraPartnerParams: extraPartnerParams, onResult: delegate ).environmentObject(router) } @@ -314,7 +314,7 @@ public class SmileID { /// the front camera will be used. /// - showAttribution: Whether to show the Smile ID attribution on the Instructions screen /// - showInstructions: Whether to deactivate capture screen's instructions for SmartSelfie. - /// - partnerParams: Custom values specific to partners + /// - extraPartnerParams: Custom values specific to partners /// - delegate: Callback to be invoked when the Biometric KYC is complete. public class func biometricKycScreen( partnerIcon: UIImage, @@ -327,7 +327,7 @@ public class SmileID { allowAgentMode: Bool = false, showAttribution: Bool = true, showInstructions: Bool = true, - partnerParams: [String: String] = [:], + extraPartnerParams: [String: String] = [:], delegate: BiometricKycResultDelegate ) -> some View { OrchestratedBiometricKycScreen( @@ -341,7 +341,7 @@ public class SmileID { showInstructions: showInstructions, showAttribution: showAttribution, allowAgentMode: allowAgentMode, - partnerParams: partnerParams, + extraPartnerParams: extraPartnerParams, delegate: delegate ) } diff --git a/Sources/SmileID/Classes/Views/JobSubmittable.swift b/Sources/SmileID/Classes/Views/JobSubmittable.swift index 4c260e582..f3b576e59 100644 --- a/Sources/SmileID/Classes/Views/JobSubmittable.swift +++ b/Sources/SmileID/Classes/Views/JobSubmittable.swift @@ -10,7 +10,7 @@ protocol JobSubmittable { ) -> AnyPublisher func prepUpload( authResponse: AuthenticationResponse, - partnerParams: [String: String] + extraPartnerParams: [String: String] ) -> AnyPublisher func handleRetry() func handleClose() @@ -19,10 +19,10 @@ protocol JobSubmittable { extension JobSubmittable { func prepUpload( authResponse: AuthenticationResponse, - partnerParams: [String: String] + extraPartnerParams: [String: String] ) -> AnyPublisher { let prepUploadRequest = PrepUploadRequest( - partnerParams: authResponse.partnerParams.copy(partnerParams: partnerParams), + partnerParams: authResponse.partnerParams.copy(extras: extraPartnerParams), timestamp: authResponse.timestamp, signature: authResponse.signature )