Skip to content

Commit 3673e72

Browse files
committed
Code improvements
1 parent 35be56a commit 3673e72

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomSummary.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ data class RoomSummary(
9898
*/
9999
val highlightCount: Int = 0,
100100
/**
101-
* Number of threads with unread messages in this room
101+
* Number of threads with unread messages in this room.
102102
*/
103103
val threadNotificationCount: Int = 0,
104104
/**
105-
* Number of threads with highlighted messages in this room
105+
* Number of threads with highlighted messages in this room.
106106
*/
107107
val threadHighlightCount: Int = 0,
108108
/**

matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/sync/model/RoomSync.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ data class RoomSync(
4848
@Json(name = "unread_notifications") val unreadNotifications: RoomSyncUnreadNotifications? = null,
4949

5050
/**
51-
* The count of threads with unread notifications (not the total # of notifications in all threads)
51+
* The count of threads with unread notifications (not the total # of notifications in all threads).
5252
*/
5353
@Json(name = "unread_thread_notifications") val unreadThreadNotifications: Map<String, RoomSyncUnreadThreadNotifications>? = null,
5454

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/RoomEventFilter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ internal data class RoomEventFilter(
7575
*/
7676
@Json(name = "contains_url") val containsUrl: Boolean? = null,
7777
/**
78-
* If true, enables lazy-loading of membership events. See Lazy-loading room members for more information. Defaults to false.
78+
* If true, enables lazy-loading of membership events.
79+
* See Lazy-loading room members for more information.
80+
* Defaults to false.
7981
*/
8082
@Json(name = "lazy_load_members") val lazyLoadMembers: Boolean? = null,
8183
/**

vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,12 @@ class TimelineViewModel @AssistedInject constructor(
408408
* Observe local unread threads.
409409
*/
410410
private fun observeLocalThreadNotifications() {
411+
if (room == null) return
411412
val threadNotificationsSupported = session.homeServerCapabilitiesService().getHomeServerCapabilities().canUseThreadReadReceiptsAndNotifications
412413
if (threadNotificationsSupported) {
413-
room?.getRoomSummaryLive()
414-
?.asFlow()
415-
?.onEach {
414+
room.getRoomSummaryLive()
415+
.asFlow()
416+
.onEach {
416417
it.getOrNull()?.let {
417418
setState {
418419
copy(
@@ -424,15 +425,15 @@ class TimelineViewModel @AssistedInject constructor(
424425
}
425426
}
426427
}
427-
?.launchIn(viewModelScope)
428+
.launchIn(viewModelScope)
428429
} else {
429-
room?.flow()
430-
?.liveLocalUnreadThreadList()
431-
?.execute {
430+
room.flow()
431+
.liveLocalUnreadThreadList()
432+
.execute {
432433
val threadList = it.invoke()
433434
val isUserMentioned = threadList?.firstOrNull { threadRootEvent ->
434435
threadRootEvent.root.threadDetails?.threadNotificationState == ThreadNotificationState.NEW_HIGHLIGHTED_MESSAGE
435-
}?.let { true } ?: false
436+
} != null
436437
val numberOfLocalUnreadThreads = threadList?.size ?: 0
437438
copy(
438439
threadNotificationBadgeState = ThreadNotificationBadgeState(

0 commit comments

Comments
 (0)