From 51f7dee95232a905ca62a21abf91673ecd53a26e Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 7 Oct 2021 11:09:30 +0100 Subject: [PATCH] removing non common properties form the base event --- .../notifications/InviteNotifiableEvent.kt | 14 +++++++------- .../app/features/notifications/NotifiableEvent.kt | 7 ------- .../notifications/NotifiableMessageEvent.kt | 14 ++++++-------- .../notifications/NotificationDrawerManager.kt | 4 ++-- .../notifications/SimpleNotifiableEvent.kt | 12 ++++++------ 5 files changed, 21 insertions(+), 30 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/notifications/InviteNotifiableEvent.kt b/vector/src/main/java/im/vector/app/features/notifications/InviteNotifiableEvent.kt index 61fd5c677a..488da60129 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/InviteNotifiableEvent.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/InviteNotifiableEvent.kt @@ -18,19 +18,19 @@ package im.vector.app.features.notifications import androidx.core.app.NotificationCompat data class InviteNotifiableEvent( - override var matrixID: String?, + var matrixID: String?, override val eventId: String, override val editedEventId: String?, var roomId: String, override var noisy: Boolean, - override val title: String, - override val description: String, - override val type: String?, - override val timestamp: Long, - override var soundName: String?, + val title: String, + val description: String, + val type: String?, + val timestamp: Long, + var soundName: String?, override var isPushGatewayEvent: Boolean = false) : NotifiableEvent { - override var hasBeenDisplayed: Boolean = false override var isRedacted: Boolean = false override var lockScreenVisibility = NotificationCompat.VISIBILITY_PUBLIC + override var hasBeenDisplayed = false } diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotifiableEvent.kt b/vector/src/main/java/im/vector/app/features/notifications/NotifiableEvent.kt index a4f099b905..07833697b4 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotifiableEvent.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotifiableEvent.kt @@ -21,20 +21,13 @@ import java.io.Serializable * Parent interface for all events which can be displayed as a Notification */ interface NotifiableEvent : Serializable { - var matrixID: String? val eventId: String val editedEventId: String? var noisy: Boolean - val title: String - val description: String? - val type: String? - val timestamp: Long // NotificationCompat.VISIBILITY_PUBLIC , VISIBILITY_PRIVATE , VISIBILITY_SECRET var lockScreenVisibility: Int - // Compat: Only for android <7, for newer version the sound is defined in the channel - var soundName: String? var hasBeenDisplayed: Boolean var isRedacted: Boolean diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotifiableMessageEvent.kt b/vector/src/main/java/im/vector/app/features/notifications/NotifiableMessageEvent.kt index fb9ca8d23c..721325e436 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotifiableMessageEvent.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotifiableMessageEvent.kt @@ -22,7 +22,7 @@ data class NotifiableMessageEvent( override val eventId: String, override val editedEventId: String?, override var noisy: Boolean, - override val timestamp: Long, + val timestamp: Long, var senderName: String?, var senderId: String?, var body: String?, @@ -31,8 +31,8 @@ data class NotifiableMessageEvent( var roomIsDirect: Boolean = false ) : NotifiableEvent { - override var matrixID: String? = null - override var soundName: String? = null + var matrixID: String? = null + var soundName: String? = null override var lockScreenVisibility = NotificationCompat.VISIBILITY_PUBLIC override var hasBeenDisplayed: Boolean = false override var isRedacted: Boolean = false @@ -42,14 +42,12 @@ data class NotifiableMessageEvent( override var isPushGatewayEvent: Boolean = false - override val type: String - get() = EventType.MESSAGE + val type: String = EventType.MESSAGE - override val description: String? + val description: String get() = body ?: "" - override val title: String - get() = senderName ?: "" + val title: String = senderName ?: "" // This is used for >N notification, as the result of a smart reply var outGoingMessage = false diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt index 45c21bb028..8648490c6a 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt @@ -395,7 +395,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context textStyle = "bold" +String.format("%s: ", event.senderName) } - +(event.description ?: "") + +(event.description) } summaryInboxStyle.addLine(line) } else { @@ -404,7 +404,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context textStyle = "bold" +String.format("%s: %s ", roomName, event.senderName) } - +(event.description ?: "") + +(event.description) } summaryInboxStyle.addLine(line) } diff --git a/vector/src/main/java/im/vector/app/features/notifications/SimpleNotifiableEvent.kt b/vector/src/main/java/im/vector/app/features/notifications/SimpleNotifiableEvent.kt index 2f74737ba2..dbc04c6f65 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/SimpleNotifiableEvent.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/SimpleNotifiableEvent.kt @@ -18,15 +18,15 @@ package im.vector.app.features.notifications import androidx.core.app.NotificationCompat data class SimpleNotifiableEvent( - override var matrixID: String?, + var matrixID: String?, override val eventId: String, override val editedEventId: String?, override var noisy: Boolean, - override val title: String, - override val description: String, - override val type: String?, - override val timestamp: Long, - override var soundName: String?, + val title: String, + val description: String, + val type: String?, + val timestamp: Long, + var soundName: String?, override var isPushGatewayEvent: Boolean = false) : NotifiableEvent { override var hasBeenDisplayed: Boolean = false