NavigationEventDispatcher



Dispatcher that can be used to register NavigationEventCallback instances for handling the in-app callbacks via composition.

Summary

Public constructors

NavigationEventDispatcher(fallbackOnBackPressed: (() -> Unit)?)

Dispatcher that can be used to register NavigationEventCallback instances for handling the in-app callbacks via composition.

Cmn
NavigationEventDispatcher(
    fallbackOnBackPressed: (() -> Unit)?,
    onHasEnabledCallbacksChanged: ((Boolean) -> Unit)?
)
Cmn

Public functions

Unit

Add a new NavigationEventCallback.

Cmn
Unit

Dispatch an NavigationEventCallback.onEventCancelled event with the given event to the proper callbacks

Cmn
Unit

Dispatch an NavigationEventCallback.onEventCompleted event with the given event to the proper callbacks

Cmn
Unit

Dispatch an NavigationEventCallback.onEventProgressed event with the given event to the proper callbacks

Cmn
Unit

Dispatch an NavigationEventCallback.onEventStarted event with the given event to the proper callbacks

Cmn
Boolean

Returns true if there is at least one NavigationEventDispatcher.isEnabled callback registered with this dispatcher.

Cmn

Public constructors

NavigationEventDispatcher(fallbackOnBackPressed: (() -> Unit)?)

Dispatcher that can be used to register NavigationEventCallback instances for handling the in-app callbacks via composition.

NavigationEventDispatcher(
    fallbackOnBackPressed: (() -> Unit)?,
    onHasEnabledCallbacksChanged: ((Boolean) -> Unit)?
)

Public functions

addCallback

@MainThread
fun addCallback(
    callback: NavigationEventCallback,
    priority: NavigationEventPriority = NavigationEventPriority.Default
): Unit

Add a new NavigationEventCallback. Callbacks are invoked in the reverse order in which they are added, so this newly added NavigationEventCallback will be the first callback to be called.

To remove a callback, use NavigationEventCallback.remove.

The callbacks provided will be invoked on the main thread.

dispatchOnCancelled

@MainThread
fun dispatchOnCancelled(): Unit

Dispatch an NavigationEventCallback.onEventCancelled event with the given event to the proper callbacks

dispatchOnCompleted

@MainThread
fun dispatchOnCompleted(): Unit

Dispatch an NavigationEventCallback.onEventCompleted event with the given event to the proper callbacks

dispatchOnProgressed

@MainThread
fun dispatchOnProgressed(event: NavigationEvent): Unit

Dispatch an NavigationEventCallback.onEventProgressed event with the given event to the proper callbacks

Parameters
event: NavigationEvent

NavigationEvent to dispatch to the callbacks.

dispatchOnStarted

@MainThread
fun dispatchOnStarted(event: NavigationEvent): Unit

Dispatch an NavigationEventCallback.onEventStarted event with the given event to the proper callbacks

Parameters
event: NavigationEvent

NavigationEvent to dispatch to the callbacks.

hasEnabledCallbacks

fun hasEnabledCallbacks(): Boolean

Returns true if there is at least one NavigationEventDispatcher.isEnabled callback registered with this dispatcher.

Returns
Boolean

True if there is at least one enabled callback.