Skip to content

Commit

Permalink
feat: skip api submission (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
JNdhlovu authored Nov 6, 2024
1 parent 1a523f4 commit ca29804
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/src/main/java/com/smileidentity/compose/SmileIDExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ fun SmileID.SmartSelfieEnrollment(
showInstructions: Boolean = true,
useStrictMode: Boolean = false,
extraPartnerParams: ImmutableMap<String, String> = persistentMapOf(),
skipApiSubmission: Boolean = false,
colorScheme: ColorScheme = SmileID.colorScheme,
typography: Typography = SmileID.typography,
onResult: SmileIDCallback<SmartSelfieResult> = {},
Expand All @@ -89,6 +90,7 @@ fun SmileID.SmartSelfieEnrollment(
showInstructions,
extraPartnerParams,
true,
skipApiSubmission,
)
val orchestratedDestination = Routes.Orchestrated.SelfieRoute(
params = OrchestratedSelfieCaptureParams(commonParams),
Expand Down Expand Up @@ -140,6 +142,7 @@ fun SmileID.SmartSelfieAuthentication(
showInstructions: Boolean = true,
useStrictMode: Boolean = false,
extraPartnerParams: ImmutableMap<String, String> = persistentMapOf(),
skipApiSubmission: Boolean = false,
colorScheme: ColorScheme = SmileID.colorScheme,
typography: Typography = SmileID.typography,
onResult: SmileIDCallback<SmartSelfieResult> = {},
Expand All @@ -154,6 +157,7 @@ fun SmileID.SmartSelfieAuthentication(
showInstructions,
extraPartnerParams,
isEnroll = false,
skipApiSubmission,
)
val orchestratedDestination = Routes.Orchestrated.SelfieRoute(
params = OrchestratedSelfieCaptureParams(commonParams),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class SmartSelfieAuthenticationFragment : Fragment() {
showAttribution: Boolean = true,
showInstructions: Boolean = true,
extraPartnerParams: HashMap<String, String>? = null,
skipApiSubmission: Boolean = false,
) = SmartSelfieAuthenticationFragment().apply {
arguments = Bundle().apply {
this.userId = userId
Expand All @@ -103,6 +104,7 @@ class SmartSelfieAuthenticationFragment : Fragment() {
this.showAttribution = showAttribution
this.showInstructions = showInstructions
this.extraPartnerParams = extraPartnerParams
this.skipApiSubmission = skipApiSubmission
}
}

Expand All @@ -124,6 +126,7 @@ class SmartSelfieAuthenticationFragment : Fragment() {
showAttribution = args.showAttribution,
showInstructions = args.showInstructions,
extraPartnerParams = (args.extraPartnerParams ?: mapOf()).toImmutableMap(),
skipApiSubmission = args.skipApiSubmission,
onResult = {
setFragmentResult(KEY_REQUEST, Bundle().apply { smileIdResult = it })
},
Expand Down Expand Up @@ -163,6 +166,11 @@ private var Bundle.showInstructions: Boolean
get() = getBoolean(KEY_SHOW_INSTRUCTIONS)
set(value) = putBoolean(KEY_SHOW_INSTRUCTIONS, value)

private const val KEY_SKIP_API_SUBMISSION = "skipApiSubmission"
private var Bundle.skipApiSubmission: Boolean
get() = getBoolean(KEY_SKIP_API_SUBMISSION)
set(value) = putBoolean(KEY_SKIP_API_SUBMISSION, value)

private const val KEY_EXTRA_PARTNER_PARAMS = "extraPartnerParams"
private val type = Types.newParameterizedType(
Map::class.java,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class SmartSelfieEnrollmentFragment : Fragment() {
showAttribution: Boolean = true,
showInstructions: Boolean = true,
extraPartnerParams: HashMap<String, String>? = null,
skipApiSubmission: Boolean = false,
) = SmartSelfieEnrollmentFragment().apply {
arguments = Bundle().apply {
this.userId = userId
Expand All @@ -100,6 +101,7 @@ class SmartSelfieEnrollmentFragment : Fragment() {
this.showAttribution = showAttribution
this.showInstructions = showInstructions
this.extraPartnerParams = extraPartnerParams
this.skipApiSubmission = skipApiSubmission
}
}

Expand All @@ -121,6 +123,7 @@ class SmartSelfieEnrollmentFragment : Fragment() {
showAttribution = args.showAttribution,
showInstructions = args.showInstructions,
extraPartnerParams = (args.extraPartnerParams ?: mapOf()).toImmutableMap(),
skipApiSubmission = args.skipApiSubmission,
onResult = {
setFragmentResult(KEY_REQUEST, Bundle().apply { smileIdResult = it })
},
Expand Down Expand Up @@ -160,6 +163,11 @@ private var Bundle.showInstructions: Boolean
get() = getBoolean(KEY_SHOW_INSTRUCTIONS)
set(value) = putBoolean(KEY_SHOW_INSTRUCTIONS, value)

private const val KEY_SKIP_API_SUBMISSION = "skipApiSubmission"
private var Bundle.skipApiSubmission: Boolean
get() = getBoolean(KEY_SKIP_API_SUBMISSION)
set(value) = putBoolean(KEY_SKIP_API_SUBMISSION, value)

private const val KEY_EXTRA_PARTNER_PARAMS = "extraPartnerParams"
private val type =
Types.newParameterizedType(Map::class.java, String::class.java, String::class.java)
Expand Down

0 comments on commit ca29804

Please sign in to comment.