Skip to content

Commit

Permalink
Updated NavigationHandler onNavigate parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
chRyNaN committed Feb 28, 2022
1 parent 0ed1a60 commit f317aef
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface ComposeNavigationIntentStackNavigatorByKey<Context, Intent : Navigatio
override fun ComposeNavigationIntentScope<Context, Intent>.onGoTo(intent: Intent) = goTo(key = intent)

override fun navigate(event: NavigationEvent<Intent>) {
scope.onNavigate(event = event)
scope.onNavigate(value = event)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal class AndroidNavigator<Intent : NavigationIntent>(

override fun navigate(event: NavigationEvent<Intent>) {
handler.apply {
scope.onNavigate(event = event)
scope.onNavigate(value = event)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ interface NavigationEventHandler<Intent : NavigationIntent, Scope : NavigationSc

fun Scope.onGoTo(intent: Intent)

override fun Scope.onNavigate(event: NavigationEvent<Intent>) =
when (event) {
override fun Scope.onNavigate(value: NavigationEvent<Intent>) =
when (value) {
is NavigationEvent.Back -> onGoBack()
is NavigationEvent.Up -> onGoUp()
is NavigationEvent.To -> onGoTo(intent = event.intent)
is NavigationEvent.To -> onGoTo(intent = value.intent)
}

override fun Scope.canGoBack(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ package com.chrynan.navigation
/**
* Handles the navigation from a [Navigator].
*/
fun interface NavigationHandler<Event : Any, Scope : NavigationScope> {
fun interface NavigationHandler<NavigationValue : Any, Scope : NavigationScope> {

/**
* Handles the actual navigation to a different part of the app defined by the provided [event]
* Handles the actual navigation to a different part of the app defined by the provided [value]
* using the [Scope] scope.
*/
fun Scope.onNavigate(event: Event)
fun Scope.onNavigate(value: NavigationValue)

companion object
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package com.chrynan.navigation
/**
* An extension on the [NavigationHandler] that provides functions to determine back navigation capability.
*/
interface StackNavigationHandler<Event : Any, Scope : NavigationScope> : NavigationHandler<Event, Scope> {
interface StackNavigationHandler<NavigationValue : Any, Scope : NavigationScope> :
NavigationHandler<NavigationValue, Scope> {

/**
* Determines whether a back navigation can be handled.
Expand Down

0 comments on commit f317aef

Please sign in to comment.