Rename OneShotNotification.key to OneShotNotification.tag for clarity.
This commit is contained in:
committed by
Benoit Marty
parent
b0e5e6cc61
commit
529c708d7e
@@ -114,7 +114,7 @@ class DefaultNotificationDataFactory(
|
||||
): List<OneShotNotification> {
|
||||
return map { event ->
|
||||
OneShotNotification(
|
||||
key = event.roomId.value,
|
||||
tag = event.roomId.value,
|
||||
notification = notificationCreator.createRoomInvitationNotification(notificationAccountParams, event),
|
||||
summaryLine = event.description,
|
||||
isNoisy = event.noisy,
|
||||
@@ -130,7 +130,7 @@ class DefaultNotificationDataFactory(
|
||||
): List<OneShotNotification> {
|
||||
return map { event ->
|
||||
OneShotNotification(
|
||||
key = event.eventId.value,
|
||||
tag = event.eventId.value,
|
||||
notification = notificationCreator.createSimpleEventNotification(notificationAccountParams, event),
|
||||
summaryLine = event.description,
|
||||
isNoisy = event.noisy,
|
||||
@@ -146,7 +146,7 @@ class DefaultNotificationDataFactory(
|
||||
): List<OneShotNotification> {
|
||||
return map { event ->
|
||||
OneShotNotification(
|
||||
key = event.eventId.value,
|
||||
tag = event.eventId.value,
|
||||
notification = notificationCreator.createFallbackNotification(notificationAccountParams, event),
|
||||
summaryLine = event.description.orEmpty(),
|
||||
isNoisy = false,
|
||||
@@ -239,7 +239,7 @@ data class RoomNotification(
|
||||
|
||||
data class OneShotNotification(
|
||||
val notification: Notification,
|
||||
val key: String,
|
||||
val tag: String,
|
||||
val summaryLine: CharSequence,
|
||||
val isNoisy: Boolean,
|
||||
val timestamp: Long,
|
||||
|
||||
@@ -94,9 +94,9 @@ class NotificationRenderer(
|
||||
|
||||
invitationNotifications.forEach { notificationData ->
|
||||
if (useCompleteNotificationFormat) {
|
||||
Timber.tag(loggerTag.value).d("Updating invitation notification ${notificationData.key}")
|
||||
Timber.tag(loggerTag.value).d("Updating invitation notification ${notificationData.tag}")
|
||||
notificationDisplayer.showNotificationMessage(
|
||||
tag = notificationData.key,
|
||||
tag = notificationData.tag,
|
||||
id = NotificationIdProvider.getRoomInvitationNotificationId(currentUser.userId),
|
||||
notification = notificationData.notification
|
||||
)
|
||||
@@ -105,9 +105,9 @@ class NotificationRenderer(
|
||||
|
||||
simpleNotifications.forEach { notificationData ->
|
||||
if (useCompleteNotificationFormat) {
|
||||
Timber.tag(loggerTag.value).d("Updating simple notification ${notificationData.key}")
|
||||
Timber.tag(loggerTag.value).d("Updating simple notification ${notificationData.tag}")
|
||||
notificationDisplayer.showNotificationMessage(
|
||||
tag = notificationData.key,
|
||||
tag = notificationData.tag,
|
||||
id = NotificationIdProvider.getRoomEventNotificationId(currentUser.userId),
|
||||
notification = notificationData.notification
|
||||
)
|
||||
|
||||
@@ -60,7 +60,7 @@ class NotificationDataFactoryTest {
|
||||
listOf(
|
||||
OneShotNotification(
|
||||
notification = expectedNotification,
|
||||
key = A_ROOM_ID.value,
|
||||
tag = A_ROOM_ID.value,
|
||||
summaryLine = AN_INVITATION_EVENT.description,
|
||||
isNoisy = AN_INVITATION_EVENT.noisy,
|
||||
timestamp = AN_INVITATION_EVENT.timestamp
|
||||
@@ -79,7 +79,7 @@ class NotificationDataFactoryTest {
|
||||
assertThat(result).containsExactly(
|
||||
OneShotNotification(
|
||||
notification = expectedNotification,
|
||||
key = AN_EVENT_ID.value,
|
||||
tag = AN_EVENT_ID.value,
|
||||
summaryLine = A_SIMPLE_EVENT.description,
|
||||
isNoisy = A_SIMPLE_EVENT.noisy,
|
||||
timestamp = AN_INVITATION_EVENT.timestamp
|
||||
|
||||
@@ -42,7 +42,7 @@ private const val USE_COMPLETE_NOTIFICATION_FORMAT = true
|
||||
|
||||
private val A_SUMMARY_NOTIFICATION = SummaryNotification.Update(A_NOTIFICATION)
|
||||
private val ONE_SHOT_NOTIFICATION =
|
||||
OneShotNotification(notification = A_NOTIFICATION, key = "ignored", summaryLine = "ignored", isNoisy = false, timestamp = -1)
|
||||
OneShotNotification(notification = A_NOTIFICATION, tag = "ignored", summaryLine = "ignored", isNoisy = false, timestamp = -1)
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class NotificationRendererTest {
|
||||
@@ -86,7 +86,7 @@ class NotificationRendererTest {
|
||||
|
||||
@Test
|
||||
fun `given a simple notification is added when rendering then show the simple notification and update summary`() = runTest {
|
||||
notificationCreator.createSimpleNotificationResult = lambdaRecorder { _, _ -> ONE_SHOT_NOTIFICATION.copy(key = AN_EVENT_ID.value).notification }
|
||||
notificationCreator.createSimpleNotificationResult = lambdaRecorder { _, _ -> ONE_SHOT_NOTIFICATION.copy(tag = AN_EVENT_ID.value).notification }
|
||||
|
||||
renderEventsAsNotifications(listOf(aSimpleNotifiableEvent(eventId = AN_EVENT_ID)))
|
||||
|
||||
@@ -98,7 +98,7 @@ class NotificationRendererTest {
|
||||
|
||||
@Test
|
||||
fun `given an invitation notification is added when rendering then show the invitation notification and update summary`() = runTest {
|
||||
notificationCreator.createRoomInvitationNotificationResult = lambdaRecorder { _, _ -> ONE_SHOT_NOTIFICATION.copy(key = AN_EVENT_ID.value).notification }
|
||||
notificationCreator.createRoomInvitationNotificationResult = lambdaRecorder { _, _ -> ONE_SHOT_NOTIFICATION.copy(tag = AN_EVENT_ID.value).notification }
|
||||
|
||||
renderEventsAsNotifications(listOf(anInviteNotifiableEvent()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user