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

DROID-2911 All content | Fixes, part 2 (#1660)

This commit is contained in:
Konstantin Ivanov 2024-10-09 00:17:01 +02:00 committed by GitHub
parent 2367b7feb4
commit eb1951e585
Signed by: github
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 9 deletions

View file

@ -109,6 +109,11 @@ class TypeEditFragment : BaseBottomSheetComposeFragment() {
}
}
override fun onStart() {
super.onStart()
vm.onStart(isReadOnly = readOnly)
}
override fun injectDependencies() {
componentManager().typeEditComponent.get(
TypeEditParameters(

View file

@ -76,7 +76,6 @@ import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.launch
import timber.log.Timber
@ -454,7 +453,8 @@ class AllContentViewModel(
mode = uiMode,
container = container,
sorts = uiSorts,
types = uiSortTypes
types = uiSortTypes,
showBin = permission.value?.isOwnerOrEditor() == true
)
}
}
@ -507,7 +507,7 @@ class AllContentViewModel(
}
}
fun AllContentTab.updateInitialState() {
private fun AllContentTab.updateInitialState() {
return when (this) {
AllContentTab.TYPES -> {
sortState.value = AllContentSort.ByName()
@ -575,7 +575,7 @@ class AllContentViewModel(
shouldScrollToTopItems = true
uiItemsState.value = emptyList()
sortState.value = newSort
proceedWithSortSaving(newSort)
proceedWithSortSaving(uiTabsState.value, newSort)
restartSubscription.value++
viewModelScope.launch {
sendAnalyticsAllContentChangeSort(
@ -586,7 +586,12 @@ class AllContentViewModel(
}
}
private fun proceedWithSortSaving(sort: AllContentSort) {
private fun proceedWithSortSaving(activeTab: UiTabsState, sort: AllContentSort) {
if (activeTab.selectedTab == AllContentTab.TYPES
|| activeTab.selectedTab == AllContentTab.RELATIONS
) {
return
}
viewModelScope.launch {
val params = UpdateAllContentState.Params(
spaceId = vmParams.spaceId,

View file

@ -70,6 +70,7 @@ import com.anytypeio.anytype.core_ui.foundation.DismissBackground
import com.anytypeio.anytype.core_ui.foundation.Divider
import com.anytypeio.anytype.core_ui.foundation.components.BottomNavigationMenu
import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
import com.anytypeio.anytype.core_ui.foundation.noRippleThrottledClickable
import com.anytypeio.anytype.core_ui.views.ButtonSize
import com.anytypeio.anytype.core_ui.views.Caption1Regular
import com.anytypeio.anytype.core_ui.views.PreviewTitle1Medium
@ -403,7 +404,7 @@ private fun ContentItems(
.padding(horizontal = 16.dp)
.bottomBorder()
.animateItem()
.noRippleClickable {
.noRippleThrottledClickable {
onTypeClicked(item)
},
item = item
@ -416,7 +417,7 @@ private fun ContentItems(
.padding(horizontal = 16.dp)
.bottomBorder()
.animateItem()
.noRippleClickable {
.noRippleThrottledClickable {
onRelationClicked(item)
},
item = item
@ -531,7 +532,7 @@ fun RowScope.Item(
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
if (description != null) {
if (!description.isNullOrBlank()) {
Text(
text = description,
style = Relations3,

View file

@ -1772,7 +1772,7 @@ Please provide specific details of your needs here.</string>
<string name="all_content_sort_date_used">Date last used</string>
<string name="all_content_sort_name">Name</string>
<string name="all_content">All objects</string>
<string name="all_content">All Objects</string>
<string name="allContent_group_today">Today</string>
<string name="allContent_group_yesterday">Yesterday</string>

View file

@ -33,6 +33,8 @@ class TypeEditViewModel(
private val unicodeIconFlow = MutableStateFlow(icon)
private val originalNameFlow = MutableStateFlow(name)
private var isReadOnly = false
val uiState: StateFlow<TypeEditState> = combine(
unicodeIconFlow,
originalNameFlow
@ -55,7 +57,12 @@ class TypeEditViewModel(
TypeEditState.Idle
)
fun onStart(isReadOnly: Boolean) {
this.isReadOnly = isReadOnly
}
fun openEmojiPicker() {
if (isReadOnly) return
navigate(Navigation.SelectEmoji)
}