Unify dm and group categories in unread notifications tab
Note: this does not automatically update when the user toggles the unified list on/off, but unread notifications tab is a lab feature either way, and the user impact is probably negligible. Change-Id: I4dcdb0a6800493a7b5a5053ae4f4e8f7fa89f7fb
This commit is contained in:
parent
2c22f1e926
commit
bae5921de7
|
@ -25,6 +25,7 @@ import im.vector.app.core.extensions.exhaustive
|
||||||
import im.vector.app.core.platform.VectorViewModel
|
import im.vector.app.core.platform.VectorViewModel
|
||||||
import im.vector.app.core.utils.DataSource
|
import im.vector.app.core.utils.DataSource
|
||||||
import im.vector.app.features.home.RoomListDisplayMode
|
import im.vector.app.features.home.RoomListDisplayMode
|
||||||
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -46,6 +47,8 @@ class RoomListViewModel @Inject constructor(initialState: RoomListViewState,
|
||||||
private val roomSummariesSource: DataSource<List<RoomSummary>>)
|
private val roomSummariesSource: DataSource<List<RoomSummary>>)
|
||||||
: VectorViewModel<RoomListViewState, RoomListAction, RoomListViewEvents>(initialState) {
|
: VectorViewModel<RoomListViewState, RoomListAction, RoomListViewEvents>(initialState) {
|
||||||
|
|
||||||
|
private var vectorPreferences: VectorPreferences? = null
|
||||||
|
|
||||||
interface Factory {
|
interface Factory {
|
||||||
fun create(initialState: RoomListViewState): RoomListViewModel
|
fun create(initialState: RoomListViewState): RoomListViewModel
|
||||||
}
|
}
|
||||||
|
@ -68,6 +71,7 @@ class RoomListViewModel @Inject constructor(initialState: RoomListViewState,
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initWithContext(context: Context, displayMode: RoomListDisplayMode) {
|
fun initWithContext(context: Context, displayMode: RoomListDisplayMode) {
|
||||||
|
vectorPreferences = VectorPreferences(context)
|
||||||
setState {
|
setState {
|
||||||
// RoomListViewState.initWithContext
|
// RoomListViewState.initWithContext
|
||||||
this.initWithContext(context, displayMode)
|
this.initWithContext(context, displayMode)
|
||||||
|
@ -292,10 +296,11 @@ class RoomListViewModel @Inject constructor(initialState: RoomListViewState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val vectorPreferences = this.vectorPreferences
|
||||||
return RoomSummaries().apply {
|
return RoomSummaries().apply {
|
||||||
put(RoomCategory.INVITE, invites)
|
put(RoomCategory.INVITE, invites)
|
||||||
put(RoomCategory.FAVOURITE, favourites)
|
put(RoomCategory.FAVOURITE, favourites)
|
||||||
if (displayMode == RoomListDisplayMode.ALL) {
|
if (displayMode == RoomListDisplayMode.ALL || vectorPreferences?.combinedOverview() == true) {
|
||||||
put(RoomCategory.COMBINED, normalPriority)
|
put(RoomCategory.COMBINED, normalPriority)
|
||||||
} else {
|
} else {
|
||||||
put(RoomCategory.DIRECT, directChats)
|
put(RoomCategory.DIRECT, directChats)
|
||||||
|
|
Loading…
Reference in New Issue