Skip to main content

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 setFlag submission.
  • 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() returns true.
  • Have the target result’s entrupy_id available.
  • Implement EntrupyFlagViewDelegate on 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

CallbackWhen it fires
didDisplayFlagViewForItemThe sheet became visible.
didUserSubmitFlagUser submitted the flag successfully.
didUserCancelFlagViewForItemUser dismissed the sheet without submitting.
didDisplayFlagViewFailWithErrorThe sheet failed to appear due to an SDK error.
  • 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.