Flag View UI Guide
The Entrupy Flag View UI provides a built-in SDK bottom sheet for flagging a specific authentication result, handling reason selection, validation, and submission so apps can enable flagging quickly with a consistent, standardized UX.
Overview
- Opens a modal workflow that is fully hosted by the Entrupy SDK.
- Automatically handles loading, validation, and
setFlagsubmission. - Reports user actions (display, cancel, submit, error) through
EntrupyFlagViewDelegate.
Important
Before presenting the Flag View fetch the flag details using getFlagDetailsForResult for the result using its Entrupy ID. Since not all result types support flagging, always verify is_flaggable before proceeding to avoid invalid flows or errors.
Before presenting the flag view, the app should:
- Initialize the SDK and confirm
EntrupyApp.sharedInstance().isAuthorizationValid()returnstrue. - Have the target result’s
entrupy_idavailable. - Implement
EntrupyFlagViewDelegateon the presenting view controller to respond to lifecycle events.
Presenting the Flag View
import EntrupySDK
final class YourViewController: UIViewController, EntrupyFlagViewDelegate {
/// Presents the Entrupy-provided Flag View UI for a given authentication result.
func presentFlagView(for entrupyID: String) {
guard EntrupyApp.sharedInstance().isAuthorizationValid() else {
print("User not authorized. Cannot display flag view.")
return
}
EntrupyApp.sharedInstance().flagViewDelegate = self
EntrupyApp.sharedInstance().displayFlagViewForItem(withEntrupyID: entrupyID)
}
// MARK: - EntrupyFlagViewDelegate
/// Called when the user dismisses the flag view without submitting.
func didUserCancelFlagViewForItem(withEntrupyID entrupyID: String) {
print("User canceled flag operation for Entrupy ID: \(entrupyID)")
}
/// Called when the flag view is successfully displayed on screen.
func didDisplayFlagViewForItem(withEntrupyID entrupyID: String) {
print("Flag view displayed successfully for Entrupy ID: \(entrupyID)")
}
/// Called when the SDK fails to display the flag view.
func didDisplayFlagViewFailWithError(
_ errorCode: EntrupyErrorCode,
description: String,
localizedDescription: String,
forEntrupyID entrupyID: String
) {
let message = """
Failed to display flag view for Entrupy ID: \(entrupyID)
- Error Code: \(errorCode.rawValue)
- Description: \(description)
- Details: \(localizedDescription)
"""
print(message)
}
/// Called when the user successfully submits a flag from the SDK-provided flag UI.
func didUserSubmitFlag(forEntrupyID entrupyID: String) {
print("User submitted flag for Entrupy ID: \(entrupyID)")
}
}
The SDK already shows an activity indicator while the sheet loads and submits, so avoid stacking an additional spinner around this presentation.
Delegate Callback Summary
| Callback | When it fires |
|---|---|
didDisplayFlagViewForItem | The sheet became visible. |
didUserSubmitFlag | User submitted the flag successfully. |
didUserCancelFlagViewForItem | User dismissed the sheet without submitting. |
didDisplayFlagViewFailWithError | The sheet failed to appear due to an SDK error. |
Related Topics
- Review the Handling Result Flags guide for manual flag workflows, custom reason pickers, and additional code samples.
- Understand the Result Screen UI to give users an immediate way to dispute an authentication after capture.
- Explore the Detail View Controller for ongoing status review and follow-up actions after submission.