ActivityNavigator

Implementation of Navigator. Takes a mapper function to map all NavigationAction to a NavigationSpec Whenever navigate is called, this class maps it to a NavigationSpec and performs navigation according to that Requires to be subscribed to an activity via subscribe to work

Parameters

Action

The type of NavigationAction handled by this navigator.

navigationMapper

A function mapping the Action to NavigationSpec

Constructors

Link copied to clipboard
constructor(navigationMapper: (Action) -> NavigationSpec)

Properties

Link copied to clipboard

The current LifecycleManager subscribed to this LifecycleSubscribable

Functions

Link copied to clipboard
open override fun navigate(action: Action)

Triggers a given NavigationAction

Link copied to clipboard
fun <Action : NavigationAction<*>> Navigator<Action>.navigateOrElse(action: Action, onFailure: () -> Unit)

Triggers a given NavigationAction or executes a closure if the navigation failed to complete.

Link copied to clipboard

Triggers a given NavigationAction and returns true if it succeeded.

Link copied to clipboard

Subscribes a LifecycleManager to this LifecycleSubscribable. Called on Lifecycle.Event.ON_CREATE

Link copied to clipboard

Convenience method to subscribe an AppCompatActivity to this ActivityLifecycleSubscribable using its default LifecycleOwner and FragmentManager.

Convenience method to subscribe a Fragment to this ActivityLifecycleSubscribable using its default LifecycleOwner and FragmentManagers.

fun ActivityLifecycleSubscribable.subscribe(activity: Activity?, owner: LifecycleOwner, parentFragmentManager: FragmentManager, childFragmentManager: FragmentManager)
Link copied to clipboard
open override fun unsubscribe()

Unsubscribes the current LifecycleManager from this LifecycleSubscribable. Called on Lifecycle.Event.ON_DESTROY