mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Merge pull request #4061 from vector-im/feature/bca/spaces_invite_notification_dot
Fix notif badge for space invite
This commit is contained in:
commit
5a8e789435
2 changed files with 20 additions and 6 deletions
1
changelog.d/4059.bugfix
Normal file
1
changelog.d/4059.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Space Invites are not lighting up the drawer menu
|
|
@ -38,6 +38,7 @@ import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.api.session.room.RoomSortOrder
|
import org.matrix.android.sdk.api.session.room.RoomSortOrder
|
||||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||||
|
import org.matrix.android.sdk.api.session.room.spaceSummaryQueryParams
|
||||||
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
|
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
|
||||||
import org.matrix.android.sdk.rx.asObservable
|
import org.matrix.android.sdk.rx.asObservable
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
@ -143,6 +144,17 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
|
||||||
roomSummaryQueryParams { this.memberships = listOf(Membership.INVITE) }
|
roomSummaryQueryParams { this.memberships = listOf(Membership.INVITE) }
|
||||||
).size
|
).size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val spaceInviteCount = if (autoAcceptInvites.hideInvites) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
session.getRoomSummaries(
|
||||||
|
spaceSummaryQueryParams {
|
||||||
|
this.memberships = listOf(Membership.INVITE)
|
||||||
|
}
|
||||||
|
).size
|
||||||
|
}
|
||||||
|
|
||||||
val totalCount = session.getNotificationCountForRooms(
|
val totalCount = session.getNotificationCountForRooms(
|
||||||
roomSummaryQueryParams {
|
roomSummaryQueryParams {
|
||||||
this.memberships = listOf(Membership.JOIN)
|
this.memberships = listOf(Membership.JOIN)
|
||||||
|
@ -161,15 +173,16 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
|
||||||
// filter out current selection
|
// filter out current selection
|
||||||
it.roomId != selectedSpace
|
it.roomId != selectedSpace
|
||||||
}
|
}
|
||||||
|
|
||||||
CountInfo(
|
CountInfo(
|
||||||
homeCount = counts,
|
homeCount = counts,
|
||||||
otherCount = RoomAggregateNotificationCount(
|
otherCount = RoomAggregateNotificationCount(
|
||||||
rootCounts.fold(0, { acc, rs ->
|
notificationCount = rootCounts.fold(0, { acc, rs -> acc + rs.notificationCount })
|
||||||
acc + rs.notificationCount
|
+ (counts.notificationCount.takeIf { selectedSpace != null } ?: 0)
|
||||||
}) + (counts.notificationCount.takeIf { selectedSpace != null } ?: 0),
|
+ spaceInviteCount,
|
||||||
rootCounts.fold(0, { acc, rs ->
|
highlightCount = rootCounts.fold(0, { acc, rs -> acc + rs.highlightCount })
|
||||||
acc + rs.highlightCount
|
+ (counts.highlightCount.takeIf { selectedSpace != null } ?: 0)
|
||||||
}) + (counts.highlightCount.takeIf { selectedSpace != null } ?: 0)
|
+ spaceInviteCount
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue