Fix compile after merge

Change-Id: I499115f40f75f07cdd0e42dafa2b17695d27e9b5
This commit is contained in:
SpiritCroc 2021-05-12 16:16:20 +02:00
parent 5c68ccf67d
commit 077e1b6896
5 changed files with 47 additions and 27 deletions

View File

@ -150,7 +150,9 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
val counts = RoomAggregateNotificationCount(
totalCount.notificationCount + inviteCount,
totalCount.highlightCount + inviteCount
totalCount.highlightCount + inviteCount,
totalCount.unreadCount,
totalCount.markedUnreadCount
)
val rootCounts = session.spaceService().getRootSpaceSummaries()
.filter {

View File

@ -142,10 +142,12 @@ class SpaceRoomListSectionBuilder(
private fun buildUnifiedSections(sections: MutableList<RoomsSection>, activeSpaceAwareQueries: MutableList<RoomListViewModel.ActiveSpaceQueryUpdater>) {
addSection(
sections, activeSpaceAwareQueries,
R.string.invitations_header,
true,
RoomListViewModel.SpaceFilterStrategy.NONE
sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.invitations_header,
notifyOfLocalEcho = true,
spaceFilterStrategy = RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL,
countRoomAsNotif = true
) {
it.memberships = listOf(Membership.INVITE)
}
@ -155,40 +157,52 @@ class SpaceRoomListSectionBuilder(
activeSpaceAwareQueries,
R.string.bottom_action_favourites,
false,
RoomListViewModel.SpaceFilterStrategy.NOT_IF_ALL
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL
) {
it.memberships = listOf(Membership.JOIN)
it.roomTagQueryFilter = RoomTagQueryFilter(true, null, null)
}
addSection(
sections,
activeSpaceAwareQueries,
R.string.normal_priority_header,
false,
RoomListViewModel.SpaceFilterStrategy.NORMAL
sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.bottom_action_rooms,
notifyOfLocalEcho = false,
spaceFilterStrategy = if (onlyOrphansInHome) {
RoomListViewModel.SpaceFilterStrategy.ORPHANS_IF_SPACE_NULL
} else {
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL
}
) {
it.memberships = listOf(Membership.JOIN)
it.roomTagQueryFilter = RoomTagQueryFilter(false, false, false)
}
addSection(
sections,
activeSpaceAwareQueries,
R.string.low_priority_header,
false,
RoomListViewModel.SpaceFilterStrategy.NORMAL
sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.low_priority_header,
notifyOfLocalEcho = false,
spaceFilterStrategy = if (onlyOrphansInHome) {
RoomListViewModel.SpaceFilterStrategy.ORPHANS_IF_SPACE_NULL
} else {
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL
}
) {
it.memberships = listOf(Membership.JOIN)
it.roomTagQueryFilter = RoomTagQueryFilter(null, true, null)
}
addSection(
sections,
activeSpaceAwareQueries,
R.string.system_alerts_header,
false,
RoomListViewModel.SpaceFilterStrategy.NORMAL
sections = sections,
activeSpaceUpdaters = activeSpaceAwareQueries,
nameRes = R.string.system_alerts_header,
notifyOfLocalEcho = false,
spaceFilterStrategy = if (onlyOrphansInHome) {
RoomListViewModel.SpaceFilterStrategy.ORPHANS_IF_SPACE_NULL
} else {
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL
}
) {
it.memberships = listOf(Membership.JOIN)
it.roomTagQueryFilter = RoomTagQueryFilter(null, null, true)
@ -205,7 +219,7 @@ class SpaceRoomListSectionBuilder(
} else {
liveData(context = viewModelScope.coroutineContext + Dispatchers.IO) {
val spaceSum = tryOrNull { session.spaceService().querySpaceChildren(selectedSpace.roomId, suggestedOnly = true) }
val value = spaceSum?.second ?: emptyList()
val value = spaceSum?.second.orEmpty().distinctBy { it.childRoomId }
// i need to check if it's already joined.
val filtered = value.filter {
session.getRoomSummary(it.childRoomId)?.membership?.isActive() != true
@ -393,7 +407,7 @@ class SpaceRoomListSectionBuilder(
activeSpaceAwareQueries,
R.string.low_priority_header,
false,
RoomListViewModel.SpaceFilterStrategy.NOT_IF_ALL
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL
) {
it.memberships = listOf(Membership.JOIN)
it.roomCategoryFilter = RoomCategoryFilter.ONLY_DM
@ -464,7 +478,7 @@ class SpaceRoomListSectionBuilder(
?.notificationCount
?.postValue(
if (countRoomAsNotif) {
RoomAggregateNotificationCount(it.size, it.size)
RoomAggregateNotificationCount(it.size, it.size, 0, 0)
} else {
session.getNotificationCountForRooms(
roomQueryParams.process(spaceFilterStrategy, appStateHandler.safeActiveSpaceId()),

View File

@ -209,7 +209,9 @@ class SpaceSummaryController @Inject constructor(
countState(
UnreadCounterBadgeView.State(
childSummary.notificationCount,
childSummary.highlightCount > 0
childSummary.highlightCount > 0,
childSummary.unreadCount ?: 0,
childSummary.markedUnread
)
)
}

View File

@ -136,7 +136,9 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
)
val counts = RoomAggregateNotificationCount(
totalCount.notificationCount + inviteCount,
totalCount.highlightCount + inviteCount
totalCount.highlightCount + inviteCount,
totalCount.unreadCount,
if (totalCount.markedUnread) 1 else 0
)
setState {
copy(

View File

@ -45,7 +45,7 @@ abstract class SubSpaceSummaryItem : VectorEpoxyModel<SubSpaceSummaryItem.Holder
@EpoxyAttribute var expanded: Boolean = false
@EpoxyAttribute var hasChildren: Boolean = false
@EpoxyAttribute var indent: Int = 0
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false)
@EpoxyAttribute var countState: UnreadCounterBadgeView.State = UnreadCounterBadgeView.State(0, false, 0, false)
override fun bind(holder: Holder) {
super.bind(holder)