-
public final class ScreenManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classScreenManager.Companion
-
Field Summary
Fields Modifier and Type Field Description private volatile SuspendFunction2<String, Map<String, Object>, Boolean>asyncOnScreenAction
-
Method Summary
Modifier and Type Method Description final SuspendFunction2<String, Map<String, Object>, Boolean>getAsyncOnScreenAction()SPEC-070-C D10 — OPTIONAL async onScreenActionwrapper-veto.final UnitsetAsyncOnScreenAction(SuspendFunction2<String, Map<String, Object>, Boolean> asyncOnScreenAction)SPEC-070-C D10 — OPTIONAL async onScreenActionwrapper-veto.final UnitsetDelegate(AppDNAScreenDelegate delegate)SPEC-070-A B.6 — register the host's screen delegate. final ScreenConfigpreviewScreen(String json)SPEC-070-A I.11 — preview a screen from a raw JSON payload (host-side, not from remote config). final UnitshowScreen(String screenId, Function1<ScreenResult, Unit> callback)final UnitshowFlow(String flowId, Function1<FlowResult, Unit> callback)final UnitdismissScreen()SPEC-070-A finalization B6 P1 — best-effort dismissal of the currently presented SDUI screen. final BooleanhandleScreenAction(String screenId, Map<String, Object> action)SPEC-070-A B.6 + G. final UnitdispatchScreenAction(String screenId, Map<String, Object> action, Function0<Unit> perform)SPEC-070-C D10 — full veto gate for a screen action. final UnittrackScreenResponseSubmitted(String screenId, Integer fieldCount)SPEC-070-A G. final Pair<String, ScreenConfig>screenForSlot(String slotName)final UnitevaluateTriggers(String event, Map<String, Object> properties)final UnitenableNavigationInterception(List<String> forScreens)final UnitdisableNavigationInterception()final UnitevaluateInterceptions(String screenName, String timing)final Unitreset()-
-
Method Detail
-
getAsyncOnScreenAction
final SuspendFunction2<String, Map<String, Object>, Boolean> getAsyncOnScreenAction()
SPEC-070-C D10 — OPTIONAL async
onScreenActionwrapper-veto. Set by a cross-platform wrapper (the Flutter plugin) that can only answer a veto asynchronously. Consulted by dispatchScreenAction in ADDITION to the synchronous handleScreenAction veto; either can block the action. Null for native hosts → the action is performed synchronously and inline exactly as before.
-
setAsyncOnScreenAction
final Unit setAsyncOnScreenAction(SuspendFunction2<String, Map<String, Object>, Boolean> asyncOnScreenAction)
SPEC-070-C D10 — OPTIONAL async
onScreenActionwrapper-veto. Set by a cross-platform wrapper (the Flutter plugin) that can only answer a veto asynchronously. Consulted by dispatchScreenAction in ADDITION to the synchronous handleScreenAction veto; either can block the action. Null for native hosts → the action is performed synchronously and inline exactly as before.
-
setDelegate
final Unit setDelegate(AppDNAScreenDelegate delegate)
SPEC-070-A B.6 — register the host's screen delegate.
-
previewScreen
final ScreenConfig previewScreen(String json)
SPEC-070-A I.11 — preview a screen from a raw JSON payload (host-side, not from remote config). Mirrors iOS
ScreenManager.previewScreen(json:). Parses → cache under the parsedid→ present via showScreen. Used by the console preview flow + integration tests.Returns the parsed ScreenConfig on success, null on parse failure.
-
showScreen
final Unit showScreen(String screenId, Function1<ScreenResult, Unit> callback)
-
showFlow
final Unit showFlow(String flowId, Function1<FlowResult, Unit> callback)
-
dismissScreen
final Unit dismissScreen()
SPEC-070-A finalization B6 P1 — best-effort dismissal of the currently presented SDUI screen. Mirrors iOS
ScreenManager.dismissScreenwhich dismisses the top UIViewController.Today screens render via AppDNAScreenSlot in the host's own Composable tree (NOT via a dedicated SDUI ScreenActivity yet — that's tracked separately as the larger B6 P0-2 follow-up). For activity-hosted presentations (PaywallActivity / OnboardingActivity / SurveyActivity) the host already calls module-specific dismissers; this method additionally signals PresentationCoordinator that the modal closed so the next queued presentation can fire, and best-effort finishes any tracked SDUI ScreenActivity once that lands.
-
handleScreenAction
final Boolean handleScreenAction(String screenId, Map<String, Object> action)
SPEC-070-A B.6 + G.8 — public hook for SectionRegistry / Activity-based action dispatch to fire the screen delegate's
onScreenActionveto hook AND emit thescreen_actionanalytics event. Returnsfalsewhen the host vetoed the action — the caller MUST NOT execute the default action handling in that case.action mirrors iOS
SectionActionpayload shape (typeplus type-specific fields).
-
dispatchScreenAction
final Unit dispatchScreenAction(String screenId, Map<String, Object> action, Function0<Unit> perform)
SPEC-070-C D10 — full veto gate for a screen action. Runs the synchronous handleScreenAction veto (which also emits the
screen_actionanalytics) exactly as before; if it allows AND an async wrapper-veto (asyncOnScreenAction) is registered, awaits it too. perform runs only when BOTH vetoes allow.When no async veto is set (every native host), perform runs synchronously inline so the host's action dispatch ordering is byte-identical to before this seam existed. When an async veto is set, perform runs on the main thread once the awaited decision resolves.
-
trackScreenResponseSubmitted
final Unit trackScreenResponseSubmitted(String screenId, Integer fieldCount)
SPEC-070-A G.8 — emit
screen_response_submittedfor form/submit actions. Hosts call this when a screen submits a form payload to the SDK. Mirrors iOS ScreenManager.swift:311.
-
screenForSlot
final Pair<String, ScreenConfig> screenForSlot(String slotName)
-
enableNavigationInterception
final Unit enableNavigationInterception(List<String> forScreens)
-
disableNavigationInterception
final Unit disableNavigationInterception()
-
evaluateInterceptions
final Unit evaluateInterceptions(String screenName, String timing)
-
-
-
-