EventRunningScope

data class EventRunningScope(val screenId: String, val triggerOwner: EventSchema, val incomingData: Any? = null, koinScope: Scope, eventManager: EventManager, val tilesEditor: TilesEditor, val tilesEventDispatcher: TilesEventDispatcher, val tilesOverlaysEditor: TilesOverlaysEditor, val tilesValueProducer: TilesValueProducer, val screenDataHolder: ScreenDataHolder, val screenBehaviorsHolder: ScreenBehaviorsHolder)

Receiver passed to every dev.catbit.mosaic.client.ui.sdui.foundation.events.EventRunner.runEvent call — one fresh instance per event execution, built by EventManager.runEvent right before dispatching to the matching EventRunner.

It carries this event's own identity (triggerOwner) and the payload it received from whatever fired it (incomingData), and exposes every collaborator a runner needs: continuing the chain by firing one of this event's own outgoing triggers (onTrigger), running an arbitrary EventSchema outside trigger matching (runEventInline/runEventsInline), publishing on the screen's broadcast channel (broadcastData), editing/reading the live tile tree (tilesEditor, tilesEventDispatcher, tilesOverlaysEditor, tilesValueProducer), reading/writing screen-scoped in-memory data (screenDataHolder), reaching further screen-level behaviors (screenBehaviorsHolder), and resolving arbitrary dependencies from the app's Koin scope (get/getOrNull/getAll).

Constructors

Link copied to clipboard
constructor(screenId: String, triggerOwner: EventSchema, incomingData: Any? = null, koinScope: Scope, eventManager: EventManager, tilesEditor: TilesEditor, tilesEventDispatcher: TilesEventDispatcher, tilesOverlaysEditor: TilesOverlaysEditor, tilesValueProducer: TilesValueProducer, screenDataHolder: ScreenDataHolder, screenBehaviorsHolder: ScreenBehaviorsHolder)

Properties

Link copied to clipboard

the payload this event received from whatever triggered it — the previous event's outgoing data via onTrigger, or null when nothing was passed (e.g. this event's own trigger fired directly off a tile interaction with no payload).

Link copied to clipboard

further screen-level behaviors this event may need, beyond the tile tree and data holders exposed directly above.

Link copied to clipboard

screen-scoped in-memory data storage (plain, segmented, navigation) — backs screenPlainData()/screenSegmentedData()/screenNavigationData() reads and writes.

Link copied to clipboard

id of the screen this event is running on.

Link copied to clipboard

surface for mutating the live tile tree by id (add/remove/replace/update tiles) — backs events like AddTiles, RemoveTiles, UpdateTiles.

Link copied to clipboard

surface for routing local TileEvent/TileGroupEvent instances and for looking up/patching EventSchemas already registered on the tree by id — backs TriggerEvent, UpdateEvents.

Link copied to clipboard

surface for adding/dismissing id-addressed overlays (bottom sheet, modal bottom sheet, dialog) — backs DisplayBottomSheet, DismissDialog, and their siblings.

Link copied to clipboard

surface for reading a value a specific tile currently produces, by tile id and key — backs the Tile data source used by GetData/EvaluateData.

Link copied to clipboard

the EventSchema currently executing — its own events list is what onTrigger filters against.

Functions

Link copied to clipboard

Casts this value to Map<String, AnySerializable?>, or returns null if it isn't a map — the common shape incomingData takes when an upstream event produced a JSON object (e.g. a parsed network response body, or a GetData result assembled from several readings).

Link copied to clipboard

Narrows the result of asMapAny to only the entries whose value is a String, dropping every other entry — used by events that stage incomingData as HTTP headers or query parameters (SetIncomingDataToNetworkParamsHolderHeaders/...QueryParameters), where non-string values can't be forwarded as-is.

Link copied to clipboard

Publishes data on this screen's own broadcast channel, via screenBehaviorsHolder — the mechanism behind ScrollColumnTile/ScrollRowTile/ScrollPagerTile and the overlay open/close/dismiss commands (DisplayNavigationDrawer, DisplaySnackbar, and their dismiss/close counterparts), all of which are fire-and-forget commands addressed to a tile id or to "whatever is listening on this screen" rather than a direct tile-tree mutation.

Link copied to clipboard
inline fun <T : Any> get(qualifier: Qualifier? = null, noinline parameters: ParametersDefinition? = null): T

Resolves an instance of T from the app's Koin scope — the way a runner reaches any framework-provided singleton (NetworkParametersHolder, DataMailer, CancellableEventsHolder, use cases, etc.) or any dependency registered through MosaicDependencyInjectionConfig.additionalKoinModule.

fun <T : Any> get(clazz: KClass<T>, qualifier: Qualifier? = null, parameters: ParametersDefinition? = null): T

Non-reified overload of get, for call sites that only have a runtime KClass to resolve from (rather than a compile-time reified type).

Link copied to clipboard
inline fun <T : Any> getAll(): List<T>

Resolves every binding registered for T in the app's Koin scope, rather than a single one — useful when several implementations of the same interface are meant to all run (e.g. every DataProcessor).

fun <T : Any> getAll(clazz: KClass<T>): List<T>

Non-reified overload of getAll.

Link copied to clipboard
inline fun <T : Any> getOrNull(qualifier: Qualifier? = null, noinline parameters: ParametersDefinition? = null): T?

Same as get, but returns null instead of throwing when no binding is registered for T — useful for an optional collaborator a custom event may or may not have wired up.

fun <T : Any> getOrNull(clazz: KClass<T>, qualifier: Qualifier? = null, parameters: ParametersDefinition? = null): T?

Non-reified overload of getOrNull.

Link copied to clipboard
fun log(level: Level, msg: String)

Logs msg at level via the app's MosaicLogger.

Link copied to clipboard
fun logError(throwable: Throwable, tag: String)

Logs throwable at error level via the app's MosaicLogger, prefixed with tag — the standard way every built-in EventRunner records a failure before firing its own onFailure trigger.

Link copied to clipboard
suspend fun onTrigger(eventTrigger: EventTrigger, data: Any? = null)

Runs whichever of triggerOwner's own events declare a trigger structurally equal to eventTrigger — the whole mechanism behind event chaining. Filtering is a plain equality check (data class equality, no listener registry); when no child matches, this call is a no-op beyond the debug log it always emits first.

Link copied to clipboard
open suspend override fun EventRunningScope.process(data: Any): Result<Unit>

Processes dataEventRunningScope.incomingData, already validated non-null by ProcessDataEventRunner before this is called.

Link copied to clipboard
open suspend override fun EventRunningScope.runEvent(event: EvaluateDataEventSchema)
open suspend override fun EventRunningScope.runEvent(event: GetDataEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ProcessDataEventSchema)
open suspend override fun EventRunningScope.runEvent(event: RemoveDataEventSchema)
open suspend override fun EventRunningScope.runEvent(event: SendDataEventSchema)
open suspend override fun EventRunningScope.runEvent(event: TransformDataEventSchema)
open suspend override fun EventRunningScope.runEvent(event: UpdateDataEventSchema)
open suspend override fun EventRunningScope.runEvent(event: CancelEventsEventSchema)
open suspend override fun EventRunningScope.runEvent(event: RunEventsEventSchema)
open suspend override fun EventRunningScope.runEvent(event: TriggerEventEventSchema)
open suspend override fun EventRunningScope.runEvent(event: UpdateEventsEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DeleteFileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: GetFileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: OpenFilePickerEventSchema)
open suspend override fun EventRunningScope.runEvent(event: SaveFileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: TakePictureEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ToggleMenuEventSchema)
open suspend override fun EventRunningScope.runEvent(event: NavigateEventSchema)
open suspend override fun EventRunningScope.runEvent(event: NavigateUpEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DownloadFileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DownloadFileToDiskEventSchema)
open suspend override fun EventRunningScope.runEvent(event: SendNetworkRequestEventSchema)
open suspend override fun EventRunningScope.runEvent(event: UploadFileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DismissBottomSheetEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DisplayBottomSheetEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DismissDialogEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DisplayDialogEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DismissSnackbarEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DisplaySnackbarEventSchema)
open suspend override fun EventRunningScope.runEvent(event: TogglePopupEventSchema)
open suspend override fun EventRunningScope.runEvent(event: StopRefreshingEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ChangeScreenStateEventSchema)
open suspend override fun EventRunningScope.runEvent(event: GetScreenEventSchema)
open suspend override fun EventRunningScope.runEvent(event: RefreshScreenEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ScrollColumnTileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ScrollPagerTileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ScrollRowTileEventSchema)
open suspend override fun EventRunningScope.runEvent(event: RequestPermissionEventSchema)
open suspend override fun EventRunningScope.runEvent(event: BroadcastToSystemEventSchema)
open suspend override fun EventRunningScope.runEvent(event: DropCachesEventSchema)
open suspend override fun EventRunningScope.runEvent(event: OpenExternalLinkEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ResetThemeEventSchema)
open suspend override fun EventRunningScope.runEvent(event: SetThemeEventSchema)
open suspend override fun EventRunningScope.runEvent(event: AddTilesEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ReloadLazyTilesEventSchema)
open suspend override fun EventRunningScope.runEvent(event: RemoveTilesEventSchema)
open suspend override fun EventRunningScope.runEvent(event: ReplaceTilesEventSchema)
open suspend override fun EventRunningScope.runEvent(event: UpdateTilesEventSchema)
open suspend override fun EventRunningScope.runEvent(event: WipeTilesEventSchema)
open suspend override fun EventRunningScope.runEvent(event: StartTimeLoopEventSchema)

Executes event's logic, ending by calling EventRunningScope.onTrigger (directly or, for a runner whose real work can fail in several distinct ways, from inside a runSafely/try-catch onError branch) with whichever outcome trigger applies — onSuccess()/onFailure() at minimum, plus whatever narrower triggers (onStart(), status-specific ones, cancellation, etc.) this event's own catalog entry declares.

Link copied to clipboard
suspend fun runEventInline(eventSchema: EventSchema, data: Any? = null)

Runs eventSchema immediately, bypassing trigger matching entirely — eventSchema does not need its own trigger to match anything declared on triggerOwner.

Link copied to clipboard
suspend fun runEventsInline(eventsSchema: List<EventSchema>, data: Any? = null)

Runs every entry in eventsSchema in order, each via the same unconditional path as runEventInline — no trigger filtering, every entry runs regardless of the others' outcome.