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

DROID-3441 Widgets | Fix | Resolve widget type for widgets where source is an object type (#2215)

This commit is contained in:
Evgenii Kozlov 2025-03-31 21:45:16 +02:00 committed by GitHub
parent 67f8686d58
commit 37c4327fa0
Signed by: github
GPG key ID: B5690EEEBB952194

View file

@ -29,11 +29,8 @@ class SelectWidgetTypeViewModel(
private val analytics: Analytics
) : BaseViewModel() {
val views = MutableStateFlow(
listOf(
WidgetTypeView.Tree(isSelected = false),
WidgetTypeView.Link(isSelected = false)
)
val views = MutableStateFlow<List<WidgetTypeView>>(
listOf(WidgetTypeView.Link(isSelected = false))
)
val isDismissed = MutableStateFlow(false)
@ -94,6 +91,14 @@ class SelectWidgetTypeViewModel(
WidgetTypeView.Link()
)
objectLayout == ObjectType.Layout.OBJECT_TYPE -> {
listOf(
WidgetTypeView.CompactList(),
WidgetTypeView.List(),
WidgetTypeView.Link()
)
}
// For other layouts, update existing views with the selected state
else -> views.value
}.map { it.setIsSelected(currentType) }
@ -148,6 +153,14 @@ class SelectWidgetTypeViewModel(
WidgetTypeView.Link(isSelected = true)
)
objectLayout == ObjectType.Layout.OBJECT_TYPE -> {
listOf(
WidgetTypeView.CompactList(),
WidgetTypeView.List(),
WidgetTypeView.Link()
)
}
// For other layouts, provide Tree and Link widgets (not selected)
else -> listOf(
WidgetTypeView.Tree(isSelected = false),