mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-24 10:25:51 +03:00
Support only notif display mode
+ code quality fixes
This commit is contained in:
parent
52f98dc405
commit
41176c3e26
5 changed files with 22 additions and 9 deletions
|
@ -27,6 +27,7 @@ fun roomSummaryQueryParams(init: (RoomSummaryQueryParams.Builder.() -> Unit) = {
|
||||||
enum class RoomCategoryFilter {
|
enum class RoomCategoryFilter {
|
||||||
ONLY_DM,
|
ONLY_DM,
|
||||||
ONLY_ROOMS,
|
ONLY_ROOMS,
|
||||||
|
ONLY_WITH_NOTIFICATIONS,
|
||||||
ALL
|
ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,7 @@ internal class RoomSummaryDataSource @Inject constructor(@SessionDatabase privat
|
||||||
when (it) {
|
when (it) {
|
||||||
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
|
RoomCategoryFilter.ONLY_DM -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, true)
|
||||||
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
|
RoomCategoryFilter.ONLY_ROOMS -> query.equalTo(RoomSummaryEntityFields.IS_DIRECT, false)
|
||||||
|
RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS -> query.greaterThan(RoomSummaryEntityFields.NOTIFICATION_COUNT, 0)
|
||||||
RoomCategoryFilter.ALL -> {
|
RoomCategoryFilter.ALL -> {
|
||||||
// nop
|
// nop
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ Formatter\.formatShortFileSize===1
|
||||||
# android\.text\.TextUtils
|
# android\.text\.TextUtils
|
||||||
|
|
||||||
### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt
|
### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt
|
||||||
enum class===93
|
enum class===94
|
||||||
|
|
||||||
### Do not import temporary legacy classes
|
### Do not import temporary legacy classes
|
||||||
import org.matrix.android.sdk.internal.legacy.riot===3
|
import org.matrix.android.sdk.internal.legacy.riot===3
|
||||||
|
|
|
@ -115,10 +115,11 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeRoomSummaries() {
|
private fun observeRoomSummaries() {
|
||||||
session.getPagedRoomSummariesLive(roomSummaryQueryParams {
|
session.getPagedRoomSummariesLive(
|
||||||
memberships = Membership.activeMemberships()
|
roomSummaryQueryParams {
|
||||||
})
|
memberships = Membership.activeMemberships()
|
||||||
.asObservable()
|
}
|
||||||
|
).asObservable()
|
||||||
.throttleFirst(300, TimeUnit.MILLISECONDS)
|
.throttleFirst(300, TimeUnit.MILLISECONDS)
|
||||||
.subscribe {
|
.subscribe {
|
||||||
val dmInvites = session.getRoomSummaries(roomSummaryQueryParams {
|
val dmInvites = session.getRoomSummaries(roomSummaryQueryParams {
|
||||||
|
|
|
@ -129,7 +129,6 @@ class RoomListViewModel @Inject constructor(initialState: RoomListViewState,
|
||||||
} else if (initialState.displayMode == RoomListDisplayMode.FILTERED) {
|
} else if (initialState.displayMode == RoomListDisplayMode.FILTERED) {
|
||||||
withQueryParams({
|
withQueryParams({
|
||||||
it.memberships = Membership.activeMemberships()
|
it.memberships = Membership.activeMemberships()
|
||||||
// it.displayName = QueryStringValue.Contains("")
|
|
||||||
}) { qpm ->
|
}) { qpm ->
|
||||||
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||||
session.getFilteredPagedRoomSummariesLive(qpm)
|
session.getFilteredPagedRoomSummariesLive(qpm)
|
||||||
|
@ -139,10 +138,21 @@ class RoomListViewModel @Inject constructor(initialState: RoomListViewState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sections
|
else if (initialState.displayMode == RoomListDisplayMode.NOTIFICATIONS) {
|
||||||
}
|
withQueryParams({
|
||||||
|
it.memberships = Membership.activeMemberships()
|
||||||
|
it.roomCategoryFilter = RoomCategoryFilter.ONLY_WITH_NOTIFICATIONS
|
||||||
|
}) { qpm ->
|
||||||
|
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||||
|
session.getFilteredPagedRoomSummariesLive(qpm)
|
||||||
|
.let { livePagedList ->
|
||||||
|
updatableQuery = livePagedList
|
||||||
|
sections.add(RoomsSection(name, livePagedList.livePagedList))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
sections
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handle(action: RoomListAction) {
|
override fun handle(action: RoomListAction) {
|
||||||
|
|
Loading…
Reference in a new issue