Presentation Options (UI Layer)#

The UI Layer exposes a focused set of knobs for tuning how the flow is presented — modal vs stack, polling cadence, authenticator-selector style, auto-handled error feedback, and which browser to use for external redirects. They live on the configuration builder; this page documents what each one does and when to change it from the defaults.

For the foundational builder construction, see Configuration .

Overview#

Six knobs, all with defaults that work for most apps. Change only the ones that conflict with your product’s idioms.

KnobWhat it controlsiOS defaultAndroid default
Presentation ModeHow the flow controller / activity animates in and out.modalPresentationMode.MODAL
Authenticator SelectorHow multiple authenticators are rendered when the user has a choice.listAuthenticatorSelectionPresentation.LIST
Polling CadenceInterval between server polls during BankID / MFA flows3 s10 s
Auto-Handle Error FeedbackWhether the framework shows a generic error AlertDialog before forwardingtruetrue
Confirm InterruptionWhether back / close shows a confirmation AlertDialogtruetrue
External BrowserIn-app session (ASWebAuthenticationSession / Custom Tabs) vs system browserfalse (in-app)false (in-app)

The iOS / Android defaults for Polling Cadence differ — iOS polls every 3 seconds for responsiveness, Android every 10 seconds to conserve battery on long-lived flows. The server’s PollingProperties.interval (when present) overrides both.

Configuration#

All six knobs are fluent calls on the configuration builder. Pick your platform’s tab; each section lists the call, the values, and when to change the default.

Presentation Mode#

HaapiUIKitConfigurationBuilder(...)
    .setPresentationMode(.modal) // or .stack
    .build()

.modal (default) — flow enters from the bottom, dismisses to the bottom. Matches iOS sheet semantics; works well when authentication is a discrete task.

.stack — flow enters from the right, dismisses to the left. Matches navigation-controller semantics; works well when authentication is part of a sequence (onboarding, settings change). On iOS below 16.0 or when used from SwiftUI helpers, a back button is rendered with localized label hui_back.

Authenticator Selector Presentation#

HaapiUIKitConfigurationBuilder(...)
    .setAuthenticationSelectionPresentation(.list) // or .tabs
    .build()

.list (default) — vertical scrollable list. Works well for any count of authenticators.

.tabs — tabbed pager with authenticator content under each tab. Works well when there are 2–4 authenticators and each requires distinct rendering.

Polling Cadence#

HaapiUIKitConfigurationBuilder(...)
    .setAutoPollingDuration(3) // seconds
    .build()

Default is 3 seconds. Set to 0 (or a negative value) to disable automatic polling — the framework instead renders a manual “retry” button. Server-provided PollingProperties.interval (in milliseconds) takes precedence. BankID flows fall back to BankID’s recommended 1-second cadence per the BankID QR-code guidelines when no server interval is provided.

Auto-Handle Flow Error Feedback#

HaapiUIKitConfigurationBuilder(...)
    .setShouldAutoHandleFlowErrorFeedback(true) // default
    .build()

true (default) — the framework displays a generic error alert, waits for dismissal, then forwards the error to your HaapiFlowResult / Activity Result handler.

false — the framework interrupts the flow immediately and forwards the error. The host app is responsible for showing user-facing feedback. Choose false when your design system has its own error UI you want to use uniformly.

Confirm Interruption#

HaapiUIKitConfigurationBuilder(...)
    .setShouldConfirmFlowInterruption(true) // default
    .build()

true (default) — when the user presses back or close mid-flow, an AlertDialog asks for confirmation. When the user confirms, the flow tears down silently with no callback to HaapiFlowResult. When the user cancels the prompt, the flow continues.

false — back / close dismisses the flow immediately, no prompt. Use when your design treats authentication as cancellable-at-any-time and a confirmation step adds friction.

External Browser#

HaapiUIKitConfigurationBuilder(...)
    .setUseDefaultExternalBrowser(false) // default → ASWebAuthenticationSession
    .build()

false (default) — launches ASWebAuthenticationSession, which shares cookies with Safari and keeps the user in the app context. Recommended in most cases.

true — launches Safari (or whichever browser the user has set as default). Use when you need cookies to survive across the external leg of the flow and ASWebAuthenticationSession’s cookie sandboxing is in the way.

Was this helpful?