- Remove counter from thread notifications

- Fix red dot on user mentioning
This commit is contained in:
ariskotsomitopoulos 2022-01-27 14:55:34 +02:00
parent f53b711e0d
commit 554ece724e
3 changed files with 11 additions and 5 deletions

View file

@ -219,6 +219,13 @@ data class Event(
return getDecryptedValue("formatted_body")?.contains("<blockquote>") ?: false
}
/**
* Determines whether or not current event has mentioned the user
*/
fun isUserMentioned(userId: String): Boolean {
return getDecryptedValue("formatted_body")?.contains(userId) ?: false
}
/**
* Decrypt the message, or return the pure payload value if there is no encryption
*/

View file

@ -210,8 +210,7 @@ internal fun findMyReadReceipt(realm: Realm, roomId: String, userId: String): St
* Returns whether or not the user is mentioned in the event
*/
internal fun isUserMentioned(currentUserId: String, timelineEventEntity: TimelineEventEntity?): Boolean {
val decryptedContent = timelineEventEntity?.root?.asDomain()?.getDecryptedTextSummary().orEmpty()
return decryptedContent.contains(currentUserId.replace("@", "").substringBefore(":"))
return timelineEventEntity?.root?.asDomain()?.isUserMentioned(currentUserId) == true
}
/**

View file

@ -26,12 +26,11 @@
<FrameLayout
android:id="@+id/threadNotificationBadgeFrameLayout"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:minWidth="15dp"
android:layout_height="9dp"
android:minWidth="9dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:layout_gravity="top|end"
android:layout_marginTop="1dp"
android:backgroundTint="@color/palette_gray_200"
android:background="@drawable/notification_badge"
android:visibility="visible"
@ -47,6 +46,7 @@
android:layout_gravity="center"
android:textColor="@color/palette_white"
android:maxLength="3"
android:visibility="gone"
android:textStyle="bold"
android:textSize="10sp"
tools:text="99" />