mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3075 Spaces | Fix | Active space is no longer available (#1808)
This commit is contained in:
parent
ab7284290e
commit
f39ed57407
3 changed files with 22 additions and 7 deletions
|
@ -48,11 +48,7 @@ class LaunchAccount @Inject constructor(
|
|||
configStorage.set(config = setup.config)
|
||||
val lastSessionSpace = settings.getCurrentSpace()
|
||||
if (lastSessionSpace != null) {
|
||||
val result = spaceManager.set(lastSessionSpace.id)
|
||||
if (result.isFailure) {
|
||||
// Falling back to the default space
|
||||
spaceManager.set(setup.config.space)
|
||||
}
|
||||
spaceManager.set(lastSessionSpace.id)
|
||||
}
|
||||
awaitAccountStartManager.setState(AwaitAccountStartManager.State.Started)
|
||||
setup.config.analytics
|
||||
|
|
|
@ -26,6 +26,7 @@ interface SpaceManager {
|
|||
fun observe() : Flow<Config>
|
||||
fun observe(space: SpaceId): Flow<Config>
|
||||
fun state(): Flow<State>
|
||||
fun getState(): State
|
||||
|
||||
fun clear()
|
||||
|
||||
|
@ -102,6 +103,20 @@ interface SpaceManager {
|
|||
}
|
||||
}
|
||||
|
||||
override fun getState(): State {
|
||||
val space = currentSpace.value
|
||||
return if (space == NO_SPACE) {
|
||||
State.NoSpace
|
||||
} else {
|
||||
val config = info[space]
|
||||
if (config != null) {
|
||||
State.Space.Active(config)
|
||||
} else {
|
||||
State.Space.Idle(SpaceId(space))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
info.clear()
|
||||
currentSpace.value = NO_SPACE
|
||||
|
|
|
@ -271,9 +271,13 @@ class SplashViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Before navigating to widgets, make sure space was opened successfully during launchAccount
|
||||
* @see [LaunchAccount] use-case
|
||||
*/
|
||||
private suspend fun proceedWithVaultNavigation(deeplink: String? = null) {
|
||||
val space = getLastOpenedSpace.async(Unit).getOrNull()
|
||||
if (space != null) {
|
||||
if (space != null && spaceManager.getState() != SpaceManager.State.NoSpace) {
|
||||
commands.emit(Command.NavigateToWidgets(
|
||||
space = space.id,
|
||||
deeplink = deeplink
|
||||
|
@ -288,7 +292,7 @@ class SplashViewModel(
|
|||
analytics = analytics,
|
||||
userProperty = UserProperty.AccountId(id)
|
||||
)
|
||||
localeProvider.language()?.let { lang ->
|
||||
localeProvider.language().let { lang ->
|
||||
viewModelScope.updateUserProperties(
|
||||
analytics = analytics,
|
||||
userProperty = UserProperty.InterfaceLanguage(lang)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue