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

Objects and sets | Close objects and sets after archiving (#2038)

This commit is contained in:
Evgenii Kozlov 2022-01-12 21:03:22 +03:00 committed by GitHub
parent 9bc31a8c6b
commit bbd56b0846
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View file

@ -8,6 +8,7 @@
### Fixes & tech 🚒
* Objects and sets | Close objects and sets after moving to bin (#2038)
* Editor | Failing to render objects containing at least one file block with embedded pdf (#2037)
* Editor | When trying to set a link to an object or to a web page for a text selection, the dedicated screen should not block the editor when the bottom sheet is hidden by swiping down (#2036)

View file

@ -209,6 +209,15 @@ class ObjectMenuFragment : ObjectMenuBaseFragment() {
lateinit var factory: ObjectMenuViewModel.Factory
override val vm by viewModels<ObjectMenuViewModel> { factory }
override fun onStart() {
super.onStart()
with(lifecycleScope) {
subscribe(vm.isObjectArchived) { isArchived ->
if (isArchived) parentFragment?.findNavController()?.popBackStack()
}
}
}
override fun injectDependencies() {
componentManager().objectMenuComponent.get(ctx).inject(this)
}

View file

@ -1,6 +1,10 @@
package com.anytypeio.anytype.ui.sets
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import com.anytypeio.anytype.R
import com.anytypeio.anytype.core_utils.ext.subscribe
import com.anytypeio.anytype.di.common.componentManager
import com.anytypeio.anytype.presentation.objects.ObjectSetMenuViewModel
import com.anytypeio.anytype.ui.editor.sheets.ObjectMenuBaseFragment
@ -12,6 +16,17 @@ class ObjectSetMenuFragment : ObjectMenuBaseFragment() {
lateinit var factory: ObjectSetMenuViewModel.Factory
override val vm by viewModels<ObjectSetMenuViewModel> { factory }
override fun onStart() {
super.onStart()
with(lifecycleScope) {
subscribe(vm.isObjectArchived) { isArchived ->
if (isArchived) {
findNavController().popBackStack(R.id.objectSetScreen, true)
}
}
}
}
override fun injectDependencies() {
componentManager().objectSetMenuComponent.get(ctx).inject(this)
}

View file

@ -30,6 +30,7 @@ abstract class ObjectMenuViewModelBase(
) : BaseViewModel() {
val isDismissed = MutableStateFlow(false)
val isObjectArchived = MutableStateFlow(false)
val commands = MutableSharedFlow<Command>(replay = 0)
val actions = MutableStateFlow(emptyList<ObjectAction>())
@ -123,7 +124,7 @@ abstract class ObjectMenuViewModelBase(
} else {
_toasts.emit(RESTORE_OBJECT_SUCCESS_MSG)
}
isDismissed.value = true
isObjectArchived.value = true
}
)
}