Skip to content

Commit

Permalink
clean up:
Browse files Browse the repository at this point in the history
  • Loading branch information
DevSrSouza committed Oct 21, 2023
1 parent 6fcb5eb commit f9029ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public object ScreenModelStore : ScreenDisposable {
internal inline fun <reified T : ScreenModel> getKey(screen: Screen, tag: String?): ScreenModelKey =
getKey<T>(screen.key, tag)

/**
* Public: used in Navigator Scoped ScreenModels
*/
// Public: used in Navigator Scoped ScreenModels
@InternalVoyagerApi
public inline fun <reified T : ScreenModel> getKey(holderKey: String, tag: String?): ScreenModelKey =
"${holderKey}:${T::class.multiplatformName}:${tag ?: "default"}"
Expand All @@ -58,9 +56,7 @@ public object ScreenModelStore : ScreenDisposable {
factory: @DisallowComposableCalls () -> T
): T = getOrPut(screen.key, tag, factory)

/**
* Public: used in Navigator Scoped ScreenModels
*/
// Public: used in Navigator Scoped ScreenModels
@InternalVoyagerApi
public inline fun <reified T : ScreenModel> getOrPut(
holderKey: String,
Expand Down Expand Up @@ -89,9 +85,7 @@ public object ScreenModelStore : ScreenDisposable {
disposeHolder(screen.key)
}

/**
* Public: used in Navigator Scoped ScreenModels
*/
// Public: used in Navigator Scoped ScreenModels
@InternalVoyagerApi
public fun onDisposeNavigator(navigatorKey: String) {
disposeHolder(navigatorKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ package cafe.adriel.voyager.navigator.screenModel
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisallowComposableCalls
import androidx.compose.runtime.remember
import cafe.adriel.voyager.core.annotation.ExperimentalVoyagerApi
import cafe.adriel.voyager.core.annotation.InternalVoyagerApi
import cafe.adriel.voyager.core.model.ScreenModel
import cafe.adriel.voyager.core.model.ScreenModelStore
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.Navigator
import cafe.adriel.voyager.navigator.currentOrThrow
import cafe.adriel.voyager.navigator.lifecycle.NavigatorDisposable
import cafe.adriel.voyager.navigator.lifecycle.NavigatorLifecycleStore

@Composable
@ExperimentalVoyagerApi
public inline fun <reified T : ScreenModel> Navigator.rememberNavigatorScreenModel(
tag: String? = null,
crossinline factory: @DisallowComposableCalls () -> T
Expand Down

0 comments on commit f9029ea

Please sign in to comment.