mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3601 Widgets | Fix | Fix missing args issue (#2365)
This commit is contained in:
parent
bcbb8368e7
commit
2649a50cfa
12 changed files with 52 additions and 28 deletions
|
@ -1256,8 +1256,8 @@ class EditorViewModel(
|
|||
|
||||
private fun exitBack() {
|
||||
when (session.value) {
|
||||
Session.ERROR -> navigate(EventWrapper(AppNavigation.Command.Exit))
|
||||
Session.IDLE -> navigate(EventWrapper(AppNavigation.Command.Exit))
|
||||
Session.ERROR -> navigate(EventWrapper(AppNavigation.Command.Exit(vmParams.space.id)))
|
||||
Session.IDLE -> navigate(EventWrapper(AppNavigation.Command.Exit(vmParams.space.id)))
|
||||
Session.OPEN -> {
|
||||
viewModelScope.launch {
|
||||
closePage.async(
|
||||
|
@ -1266,10 +1266,10 @@ class EditorViewModel(
|
|||
vmParams.space
|
||||
)
|
||||
).fold(
|
||||
onSuccess = { navigate(EventWrapper(AppNavigation.Command.Exit)) },
|
||||
onSuccess = { navigate(EventWrapper(AppNavigation.Command.Exit(vmParams.space.id))) },
|
||||
onFailure = {
|
||||
Timber.e(it, "Error while closing document: $context")
|
||||
navigate(EventWrapper(AppNavigation.Command.Exit))
|
||||
navigate(EventWrapper(AppNavigation.Command.Exit(vmParams.space.id)))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ interface AppNavigation {
|
|||
fun launchCollections(subscription: Subscription, space: Id)
|
||||
fun launchObjectSet(target: Id, space: Id)
|
||||
|
||||
fun exit()
|
||||
fun exitToDesktop()
|
||||
fun exit(space: Id)
|
||||
fun exitToDesktop(space: Id)
|
||||
fun exitToVault()
|
||||
fun exitToSpaceHome()
|
||||
fun openGlobalSearch(space: Id)
|
||||
|
@ -76,8 +76,9 @@ interface AppNavigation {
|
|||
|
||||
sealed class Command {
|
||||
|
||||
data object Exit : Command()
|
||||
data object ExitToDesktop : Command()
|
||||
@Deprecated("To be deleted. Too generic and confusing.")
|
||||
data class Exit(val space: Id) : Command()
|
||||
data class ExitToDesktop(val space: Id) : Command()
|
||||
data object ExitToVault : Command()
|
||||
data object ExitToSpaceHome : Command()
|
||||
data class OpenObject(val target: Id, val space: Id) : Command()
|
||||
|
|
|
@ -290,7 +290,7 @@ open class ObjectSearchViewModel(
|
|||
)
|
||||
|
||||
override fun onDialogCancelled() {
|
||||
navigation.postValue(EventWrapper(AppNavigation.Command.Exit))
|
||||
navigation.postValue(EventWrapper(AppNavigation.Command.Exit(vmParams.space.id)))
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -574,7 +574,7 @@ class ObjectSetViewModel(
|
|||
}
|
||||
Error.NotFoundObject -> {
|
||||
toast(TOAST_SET_NOT_EXIST).also {
|
||||
dispatch(AppNavigation.Command.Exit)
|
||||
dispatch(AppNavigation.Command.Exit(vmParams.space.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -929,10 +929,10 @@ class ObjectSetViewModel(
|
|||
space = vmParams.space
|
||||
)
|
||||
).fold(
|
||||
onSuccess = { dispatch(AppNavigation.Command.Exit) },
|
||||
onSuccess = { dispatch(AppNavigation.Command.Exit(vmParams.space.id)) },
|
||||
onFailure = {
|
||||
Timber.e(it, "Error while closing object set: ${vmParams.ctx}").also {
|
||||
dispatch(AppNavigation.Command.Exit)
|
||||
dispatch(AppNavigation.Command.Exit(vmParams.space.id))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -612,7 +612,7 @@ open class EditorViewModelTest {
|
|||
|
||||
testObserver
|
||||
.assertHasValue()
|
||||
.assertValue { value -> value.peekContent() == AppNavigation.Command.Exit }
|
||||
.assertValue { value -> value.peekContent() == AppNavigation.Command.Exit(spaceId.id) }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue