mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Quality checks/fixes
This commit is contained in:
+12
-10
@@ -296,11 +296,7 @@ class TimelinePresenter(
|
|||||||
markerIdx = i
|
markerIdx = i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (item is TimelineItem.Event &&
|
if (item is TimelineItem.Event && item.isCountableNewMessage()) {
|
||||||
!item.isMine &&
|
|
||||||
item.origin != TimelineItemEventOrigin.PAGINATION &&
|
|
||||||
item.content.isMessageContent()
|
|
||||||
) {
|
|
||||||
unread++
|
unread++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -464,11 +460,7 @@ class TimelinePresenter(
|
|||||||
var delta = 0
|
var delta = 0
|
||||||
for (item in timelineItems) {
|
for (item in timelineItems) {
|
||||||
if (item.identifier() == prevMostRecentItemIdValue) break
|
if (item.identifier() == prevMostRecentItemIdValue) break
|
||||||
if (item is TimelineItem.Event &&
|
if (item is TimelineItem.Event && item.isCountableNewMessage()) {
|
||||||
item.origin != TimelineItemEventOrigin.PAGINATION &&
|
|
||||||
!item.isMine &&
|
|
||||||
item.content.isMessageContent()
|
|
||||||
) {
|
|
||||||
delta++
|
delta++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,6 +511,16 @@ private fun FocusRequestState.onFocusEventRender(): FocusRequestState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this event should be counted toward the unread / new-message badges: a user-facing
|
||||||
|
* message from someone other than the local user, that wasn't pulled in via back-pagination.
|
||||||
|
*/
|
||||||
|
private fun TimelineItem.Event.isCountableNewMessage(): Boolean {
|
||||||
|
return !isMine &&
|
||||||
|
origin != TimelineItemEventOrigin.PAGINATION &&
|
||||||
|
content.isMessageContent()
|
||||||
|
}
|
||||||
|
|
||||||
// Workaround for not having the server names available, get possible server names from the user ids of the room members
|
// Workaround for not having the server names available, get possible server names from the user ids of the room members
|
||||||
private fun calculateServerNamesForRoom(room: JoinedRoom): List<String> {
|
private fun calculateServerNamesForRoom(room: JoinedRoom): List<String> {
|
||||||
// If we have no room members, return right ahead
|
// If we have no room members, return right ahead
|
||||||
|
|||||||
+1
-1
@@ -598,7 +598,7 @@ internal fun TimelineViewWithReadMarkerPreview() = ElementPreview {
|
|||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun TimelineViewWithReadMarkerDotBadgesPreview() = ElementPreview {
|
internal fun TimelineViewWithReadMarkerDotBadgesPreview() = ElementPreview {
|
||||||
TimelineViewWithReadMarker(unreadMessagesCount = 47, newMessagesCount = 99)
|
TimelineViewWithReadMarker(unreadMessagesCount = 47, newMessagesCount = 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
|
|||||||
+2
-1
@@ -139,7 +139,8 @@ enum class FeatureFlags(
|
|||||||
JumpToUnread(
|
JumpToUnread(
|
||||||
key = "feature.jump_to_unread",
|
key = "feature.jump_to_unread",
|
||||||
title = "Jump to unread messages",
|
title = "Jump to unread messages",
|
||||||
description = "Show a button to jump to the read marker, plus a count badge on the scroll-to-bottom button when new messages arrive while scrolled away.",
|
description = "Show a button to jump to the read marker, plus a count badge on the scroll-to-bottom button " +
|
||||||
|
"when new messages arrive while scrolled away.",
|
||||||
defaultValue = { false },
|
defaultValue = { false },
|
||||||
isFinished = false,
|
isFinished = false,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user