diff --git a/app/src/main/java/com/anytypeio/anytype/ui/types/edit/TypeEditFragment.kt b/app/src/main/java/com/anytypeio/anytype/ui/types/edit/TypeEditFragment.kt index 1d71e1b9ee..b17288fd5b 100644 --- a/app/src/main/java/com/anytypeio/anytype/ui/types/edit/TypeEditFragment.kt +++ b/app/src/main/java/com/anytypeio/anytype/ui/types/edit/TypeEditFragment.kt @@ -109,6 +109,11 @@ class TypeEditFragment : BaseBottomSheetComposeFragment() { } } + override fun onStart() { + super.onStart() + vm.onStart(isReadOnly = readOnly) + } + override fun injectDependencies() { componentManager().typeEditComponent.get( TypeEditParameters( diff --git a/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt b/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt index 8579bd4a1f..24fdb91cea 100644 --- a/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt +++ b/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt @@ -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, diff --git a/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/ui/AllContentScreen.kt b/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/ui/AllContentScreen.kt index c99d82e3ee..0a4002a7cb 100644 --- a/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/ui/AllContentScreen.kt +++ b/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/ui/AllContentScreen.kt @@ -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, diff --git a/localization/src/main/res/values/strings.xml b/localization/src/main/res/values/strings.xml index 53b9158540..803bf1a4ac 100644 --- a/localization/src/main/res/values/strings.xml +++ b/localization/src/main/res/values/strings.xml @@ -1772,7 +1772,7 @@ Please provide specific details of your needs here. Date last used Name - All objects + All Objects Today Yesterday diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/types/TypeEditViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/types/TypeEditViewModel.kt index 510db3606d..09f8eb9efa 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/types/TypeEditViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/types/TypeEditViewModel.kt @@ -33,6 +33,8 @@ class TypeEditViewModel( private val unicodeIconFlow = MutableStateFlow(icon) private val originalNameFlow = MutableStateFlow(name) + private var isReadOnly = false + val uiState: StateFlow = 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) }