Skip to content

Commit

Permalink
Updated setting of isInitialized property
Browse files Browse the repository at this point in the history
  • Loading branch information
chRyNaN committed Jan 1, 2022
1 parent 3a0faab commit 0e7551f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ComposeNavigatorByContentViewModel<Scope, Key> internal constructor(
get() = mutableKeyFlow.value

override var isInitialized: Boolean = false
private set
internal set

override val currentScope: Scope
get() = mutableScopeFlow.value
Expand Down Expand Up @@ -123,8 +123,6 @@ class ComposeNavigatorByContentViewModel<Scope, Key> internal constructor(
@Composable
override fun ComposeNavigationContentScope<Key>.content(key: Key) {
contents[key]?.invoke(this)

isInitialized = true
}

override fun changeScope(to: Scope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ abstract class BaseComposeNavigatorByKeyViewModel<Scope, Key, NavigationScope :
override val currentKey: Key
get() = mutableKeyFlow.value

override val isInitialized: Boolean = true
override var isInitialized: Boolean = false
internal set

override val currentScope: Scope
get() = mutableScopeFlow.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ internal expect fun <Scope, Key, NavigationScope : ComposeNavigationKeyScope<Key
@ExperimentalNavigationApi
fun <Scope, Key> NavContainer(navigator: ComposeNavigatorByContentViewModel<Scope, Key>) {
InternalNavContainer(navigator = navigator)

navigator.isInitialized = true
}

/**
Expand Down Expand Up @@ -76,6 +78,8 @@ fun <Scope, Key> NavContainer(navigator: ComposeNavigatorByKeyViewModel<Scope, K
}

InternalNavContainer(navigator = navigator, scope = scope)

navigator.isInitialized = true
}

/**
Expand Down Expand Up @@ -112,4 +116,6 @@ fun <Scope, Intent : NavigationIntent> NavContainer(navigator: ComposeNavigation
}

InternalNavContainer(navigator = navigator, scope = scope)

navigator.isInitialized = true
}

0 comments on commit 0e7551f

Please sign in to comment.