1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 13:57:10 +09:00

DROID-2237 Widgets | Fix | Add try-catch for safer navigation (#973)

This commit is contained in:
Evgenii Kozlov 2024-03-04 21:37:51 +01:00 committed by uburoiubu
parent 066d5e8a95
commit d7511bb2b3
No known key found for this signature in database
GPG key ID: C8FB80E0A595FBB6

View file

@ -182,50 +182,66 @@ class HomeScreenFragment : BaseComposeFragment() {
private fun proceed(command: Command) {
when (command) {
is Command.ChangeWidgetSource -> {
findNavController().navigate(
R.id.selectWidgetSourceScreen,
args = SelectWidgetSourceFragment.args(
ctx = command.ctx,
widget = command.widget,
source = command.source,
type = command.type,
isInEditMode = command.isInEditMode
runCatching {
findNavController().navigate(
R.id.selectWidgetSourceScreen,
args = SelectWidgetSourceFragment.args(
ctx = command.ctx,
widget = command.widget,
source = command.source,
type = command.type,
isInEditMode = command.isInEditMode
)
)
)
}.onFailure {
Timber.e(it, "Error while navigation")
}
}
is Command.SelectWidgetSource -> {
findNavController().navigate(
R.id.selectWidgetSourceScreen,
args = SelectWidgetSourceFragment.args(
target = command.target,
isInEditMode = command.isInEditMode
runCatching {
findNavController().navigate(
R.id.selectWidgetSourceScreen,
args = SelectWidgetSourceFragment.args(
target = command.target,
isInEditMode = command.isInEditMode
)
)
)
}.onFailure {
Timber.e(it, "Error while navigation")
}
}
is Command.ChangeWidgetType -> {
findNavController().navigate(
R.id.selectWidgetTypeScreen,
args = SelectWidgetTypeFragment.args(
ctx = command.ctx,
widget = command.widget,
source = command.source,
type = command.type,
layout = command.layout,
isInEditMode = command.isInEditMode
runCatching {
findNavController().navigate(
R.id.selectWidgetTypeScreen,
args = SelectWidgetTypeFragment.args(
ctx = command.ctx,
widget = command.widget,
source = command.source,
type = command.type,
layout = command.layout,
isInEditMode = command.isInEditMode
)
)
)
}.onFailure {
Timber.e(it, "Error while navigation")
}
}
is Command.SelectWidgetType -> {
findNavController().navigate(
R.id.selectWidgetTypeScreen,
args = SelectWidgetTypeFragment.args(
ctx = command.ctx,
source = command.source,
layout = command.layout,
target = command.target,
isInEditMode = command.isInEditMode
runCatching {
findNavController().navigate(
R.id.selectWidgetTypeScreen,
args = SelectWidgetTypeFragment.args(
ctx = command.ctx,
source = command.source,
layout = command.layout,
target = command.target,
isInEditMode = command.isInEditMode
)
)
)
}.onFailure {
Timber.e(it, "Error while navigation")
}
}
is Command.Deeplink.CannotImportExperience -> {
arguments?.putString(DEEP_LINK_KEY, null)