mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Cleanup the ViewModels
This commit is contained in:
parent
e10af6476f
commit
aee34ad552
@ -25,7 +25,6 @@ import im.vector.app.core.di.hiltMavericksViewModelFactory
|
|||||||
import im.vector.app.core.platform.EmptyViewEvents
|
import im.vector.app.core.platform.EmptyViewEvents
|
||||||
import im.vector.app.core.platform.VectorViewModel
|
import im.vector.app.core.platform.VectorViewModel
|
||||||
import im.vector.app.features.settings.VectorDataStore
|
import im.vector.app.features.settings.VectorDataStore
|
||||||
import kotlinx.coroutines.flow.onEach
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class DebugPrivateSettingsViewModel @AssistedInject constructor(
|
class DebugPrivateSettingsViewModel @AssistedInject constructor(
|
||||||
@ -45,12 +44,10 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun observeVectorDataStore() {
|
private fun observeVectorDataStore() {
|
||||||
vectorDataStore.forceDialPadDisplayFlow.onEach {
|
vectorDataStore.forceDialPadDisplayFlow.setOnEach {
|
||||||
setState {
|
copy(
|
||||||
copy(
|
dialPadVisible = it
|
||||||
dialPadVisible = it
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ import im.vector.app.features.invite.showInvites
|
|||||||
import im.vector.app.features.settings.VectorDataStore
|
import im.vector.app.features.settings.VectorDataStore
|
||||||
import im.vector.app.features.ui.UiStateRepository
|
import im.vector.app.features.ui.UiStateRepository
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.collect
|
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
import kotlinx.coroutines.flow.flatMapLatest
|
import kotlinx.coroutines.flow.flatMapLatest
|
||||||
@ -104,19 +103,16 @@ class HomeDetailViewModel @AssistedInject constructor(
|
|||||||
private var forceDialPad = false
|
private var forceDialPad = false
|
||||||
|
|
||||||
private fun observeDataStore() {
|
private fun observeDataStore() {
|
||||||
viewModelScope.launch {
|
vectorDataStore.pushCounterFlow.setOnEach { nbOfPush ->
|
||||||
vectorDataStore.pushCounterFlow.collect { nbOfPush ->
|
copy(
|
||||||
setState {
|
pushCounter = nbOfPush
|
||||||
copy(
|
)
|
||||||
pushCounter = nbOfPush
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vectorDataStore.forceDialPadDisplayFlow.collect { force ->
|
|
||||||
forceDialPad = force
|
|
||||||
updateShowDialPadTab()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vectorDataStore.forceDialPadDisplayFlow.onEach { force ->
|
||||||
|
forceDialPad = force
|
||||||
|
updateShowDialPadTab()
|
||||||
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handle(action: HomeDetailAction) {
|
override fun handle(action: HomeDetailAction) {
|
||||||
|
@ -195,14 +195,10 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun observeDataStore() {
|
private fun observeDataStore() {
|
||||||
viewModelScope.launch {
|
vectorDataStore.pushCounterFlow.setOnEach { nbOfPush ->
|
||||||
vectorDataStore.pushCounterFlow.collect { nbOfPush ->
|
copy(
|
||||||
setState {
|
pushCounter = nbOfPush
|
||||||
copy(
|
)
|
||||||
pushCounter = nbOfPush
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user