Skip to content

Commit

Permalink
Created ComposeScopedNavigator
Browse files Browse the repository at this point in the history
  • Loading branch information
chRyNaN committed Dec 30, 2021
1 parent a3a529b commit 3c5d79d
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("unused")

package com.chrynan.navigation.compose

import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -28,6 +30,8 @@ interface ComposeNavigatorByContent<T> : ComposeNavigator<T> {
strategy: NavStackDuplicateContentStrategy,
content: @Composable ComposeNavigationContentScope<T>.() -> Unit
)

companion object
}

// Note: This is needed because defaults aren't working for @Composable functions for interfaces.
Expand All @@ -44,6 +48,8 @@ interface ComposeNavigatorByKey<T> : ComposeNavigator<T> {
key: T,
strategy: NavStackDuplicateContentStrategy
)

companion object
}

// Note: This is needed because defaults aren't working for @Composable functions for interfaces.
Expand All @@ -56,6 +62,8 @@ fun <T> ComposeNavigatorByKey<T>.goTo(key: T) =
interface ComposeStackNavigator<T> : ComposeNavigator<T> {

fun canGoBack(): Boolean

companion object
}

@ExperimentalNavigationApi
Expand All @@ -64,11 +72,29 @@ interface ComposeStackNavigatorByContent<T> : ComposeStackNavigator<T>,

@Composable
fun goBack(): Boolean

companion object
}

@ExperimentalNavigationApi
interface ComposeStackNavigatorByKey<T> : ComposeStackNavigator<T>,
ComposeNavigatorByKey<T> {

fun goBack(): Boolean

companion object
}

@ExperimentalNavigationApi
interface ComposeScopedNavigator<Scope, Key> : ComposeNavigator<Key> {

val initialScope: Scope

val currentScope: Scope

val scopeChanges: Flow<Scope>

fun changeScope(to: Scope)

companion object
}

0 comments on commit 3c5d79d

Please sign in to comment.