Retake Flow UI Guide
The Retake View Controller delivers Entrupy’s guided retake capture workflow inside your iOS app. It launches the Entrupy retake interface, focused only on the images needed to complete the authentication.
Overview
- Initiates directly from an existing authentication using the item’s
entrupy_id. - Reports completion, cancellation, timeout, and failure events through delegate callbacks, allowing your app to respond in real time.
- Returns a payload compatible with
EntrupyCaptureResult, matching the structure used in the primary capture flow.
Prerequisites
Before launching a retake workflow:
- Ensure the Entrupy SDK is properly initialized.
- Verify that the user is authorized (
isAuthorizationValid()returnstrue). - Confirm that you have received a valid
entrupy_idfrom either a prior authentication or thesearchRetakes()call.
Presenting the Retake View
import EntrupySDK
class RetakeViewController: UIViewController, EntrupyRetakeCaptureDelegate {
func showEntrupyRetakeView(for entrupyId: String) {
guard EntrupyApp.sharedInstance().isAuthorizationValid() else {
print("User not authorized. Please log in first.")
return
}
// Assign delegate before launching the workflow
EntrupyApp.sharedInstance().retakeCaptureDelegate = self
// Launch the Entrupy retake workflow
EntrupyApp.sharedInstance().startRetakeCaptureForItem(withEntrupyID: entrupyId)
}
// MARK: - EntrupyRetakeCaptureDelegate
/// Successful retake completion
func didRetakeCaptureCompleteSuccessfully(
_ result: [AnyHashable: Any],
forItemWithEntrupyID entrupyID: String
) {
// Decode using EntrupyCaptureResult (provided by the SDK)
do {
let data = try JSONSerialization.data(withJSONObject: result)
let captureResult = try JSONDecoder().decode(EntrupyCaptureResult.self, from: data)
refreshItemState(with: captureResult)
} catch {
print("Failed to decode retake capture result: \(error)")
}
}
/// User cancelled manually
func didUserCancelRetakeCaptureForItem(withEntrupyID entrupyID: String) {
print("Retake capture cancelled for: \(entrupyID)")
}
/// SDK reported a failure
func didRetakeCaptureFailWithError(
_ errorCode: EntrupyErrorCode,
description: String,
localizedDescription: String,
forItemWithEntrupyID entrupyID: String
) {
print("Retake capture failed for \(entrupyID): \(localizedDescription) [\(errorCode)]")
}
/// Retake session timed out
func didRetakeCaptureTimeoutForItem(withEntrupyID entrupyID: String) {
print("Retake capture timed out for: \(entrupyID)")
}
// MARK: - Helpers
private func refreshItemState(with result: EntrupyCaptureResult) {
//Implement any app specific integration behavior here.
}
}
Delegate Callback Summary
| Delegate Method | Trigger |
|---|---|
didRetakeCaptureCompleteSuccessfully | Retake completed successfully |
didUserCancelRetakeCaptureForItem | User canceled before submission |
didRetakeCaptureFailWithError | Capture failed due to an error |
didRetakeCaptureTimeoutForItem | Retake session expired (2-hour timeout limit) |
Threading Notes
All delegate callbacks are invoked on the main thread.
If your app performs heavy data processing or API calls upon completion, dispatch those operations to a background queue to keep the UI responsive.
Result Payload and Data Handling
- Successful retakes provide a dictionary aligned with
EntrupyCaptureResult, mirroring the structure used for the initial capture flow. - The payload includes the metadata required to correlate the retake submission with the originating authentication record.
Related Topics
- Pair this controller with the Detail View Controller Guide to give users a full picture of each authentication.
- For managing result-specific flags after a retake, see Handling Result Flags.