mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-290 Navigation | Enhancement | Open bookmark object instead of opening system browser (#2495)
This commit is contained in:
parent
89cdb6b848
commit
4d8768771f
5 changed files with 13 additions and 23 deletions
|
@ -1510,8 +1510,7 @@ class DefaultBlockViewRenderer @Inject constructor(
|
|||
color = block.textColor()
|
||||
)
|
||||
}
|
||||
ObjectType.Layout.FILE, ObjectType.Layout.IMAGE -> {
|
||||
|
||||
ObjectType.Layout.FILE, ObjectType.Layout.IMAGE, ObjectType.Layout.BOOKMARK -> {
|
||||
BlockView.Title.Basic(
|
||||
mode = blockMode,
|
||||
id = block.id,
|
||||
|
|
|
@ -11,6 +11,7 @@ object SupportedLayouts {
|
|||
ObjectType.Layout.PROFILE,
|
||||
ObjectType.Layout.SET,
|
||||
ObjectType.Layout.TODO,
|
||||
ObjectType.Layout.NOTE
|
||||
ObjectType.Layout.NOTE,
|
||||
ObjectType.Layout.BOOKMARK
|
||||
)
|
||||
}
|
|
@ -128,7 +128,8 @@ open class ObjectSearchViewModel(
|
|||
ObjectType.Layout.TODO,
|
||||
ObjectType.Layout.NOTE,
|
||||
ObjectType.Layout.FILE,
|
||||
ObjectType.Layout.IMAGE -> {
|
||||
ObjectType.Layout.IMAGE,
|
||||
ObjectType.Layout.BOOKMARK -> {
|
||||
navigate(EventWrapper(AppNavigation.Command.LaunchDocument(id = target)))
|
||||
}
|
||||
ObjectType.Layout.SET -> {
|
||||
|
|
|
@ -588,29 +588,16 @@ class ObjectSetViewModel(
|
|||
val record = records.records.find { rec -> rec[Relations.ID] == target }
|
||||
if (record != null) {
|
||||
val obj = ObjectWrapper.Basic(record)
|
||||
if (obj.layout != ObjectType.Layout.BOOKMARK) {
|
||||
proceedWithNavigation(
|
||||
target = target,
|
||||
layout = obj.layout
|
||||
)
|
||||
} else {
|
||||
proceedWithBrowsingBookmarkObject(obj)
|
||||
}
|
||||
proceedWithNavigation(
|
||||
target = target,
|
||||
layout = obj.layout
|
||||
)
|
||||
} else {
|
||||
toast("Record not found. Please, try again later.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun proceedWithBrowsingBookmarkObject(obj: ObjectWrapper.Basic) {
|
||||
val url = obj.url
|
||||
if (url.isNullOrEmpty()) {
|
||||
toast("Url is empty.")
|
||||
} else {
|
||||
dispatch(ObjectSetCommand.Intent.GoTo(url))
|
||||
}
|
||||
}
|
||||
|
||||
fun onTaskCheckboxClicked(target: Id) {
|
||||
val set = reducer.state.value
|
||||
if (set.isInitialized) {
|
||||
|
@ -1102,7 +1089,8 @@ class ObjectSetViewModel(
|
|||
ObjectType.Layout.TODO,
|
||||
ObjectType.Layout.NOTE,
|
||||
ObjectType.Layout.IMAGE,
|
||||
ObjectType.Layout.FILE -> proceedWithOpeningPage(target)
|
||||
ObjectType.Layout.FILE,
|
||||
ObjectType.Layout.BOOKMARK -> proceedWithOpeningPage(target)
|
||||
ObjectType.Layout.SET -> {
|
||||
viewModelScope.launch {
|
||||
closeBlock(CloseBlock.Params(context)).process(
|
||||
|
|
|
@ -300,7 +300,8 @@ abstract class RelationValueBaseViewModel(
|
|||
ObjectType.Layout.TODO,
|
||||
ObjectType.Layout.FILE,
|
||||
ObjectType.Layout.IMAGE,
|
||||
ObjectType.Layout.NOTE -> {
|
||||
ObjectType.Layout.NOTE,
|
||||
ObjectType.Layout.BOOKMARK -> {
|
||||
viewModelScope.launch {
|
||||
navigation.emit(AppNavigation.Command.OpenObject(id))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue