1616
1717package io.element.android.libraries.push.impl.notifications
1818
19+ import io.element.android.libraries.core.log.logger.LoggerTag
1920import io.element.android.libraries.matrix.api.core.RoomId
2021import io.element.android.libraries.matrix.api.user.MatrixUser
22+ import io.element.android.libraries.push.impl.log.notificationLoggerTag
2123import io.element.android.libraries.push.impl.notifications.model.FallbackNotifiableEvent
2224import io.element.android.libraries.push.impl.notifications.model.InviteNotifiableEvent
2325import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
@@ -26,6 +28,8 @@ import io.element.android.libraries.push.impl.notifications.model.SimpleNotifiab
2628import timber.log.Timber
2729import javax.inject.Inject
2830
31+ private val loggerTag = LoggerTag (" NotificationRenderer" , notificationLoggerTag)
32+
2933class NotificationRenderer @Inject constructor(
3034 private val notificationIdProvider : NotificationIdProvider ,
3135 private val notificationDisplayer : NotificationDisplayer ,
@@ -54,7 +58,7 @@ class NotificationRenderer @Inject constructor(
5458
5559 // Remove summary first to avoid briefly displaying it after dismissing the last notification
5660 if (summaryNotification == SummaryNotification .Removed ) {
57- Timber .d(" Removing summary notification" )
61+ Timber .tag(loggerTag.value). d(" Removing summary notification" )
5862 notificationDisplayer.cancelNotificationMessage(
5963 tag = null ,
6064 id = notificationIdProvider.getSummaryNotificationId(currentUser.userId)
@@ -64,14 +68,14 @@ class NotificationRenderer @Inject constructor(
6468 roomNotifications.forEach { wrapper ->
6569 when (wrapper) {
6670 is RoomNotification .Removed -> {
67- Timber .d(" Removing room messages notification ${wrapper.roomId} " )
71+ Timber .tag(loggerTag.value). d(" Removing room messages notification ${wrapper.roomId} " )
6872 notificationDisplayer.cancelNotificationMessage(
6973 tag = wrapper.roomId.value,
7074 id = notificationIdProvider.getRoomMessagesNotificationId(currentUser.userId)
7175 )
7276 }
7377 is RoomNotification .Message -> if (useCompleteNotificationFormat) {
74- Timber .d(" Updating room messages notification ${wrapper.meta.roomId} " )
78+ Timber .tag(loggerTag.value). d(" Updating room messages notification ${wrapper.meta.roomId} " )
7579 notificationDisplayer.showNotificationMessage(
7680 tag = wrapper.meta.roomId.value,
7781 id = notificationIdProvider.getRoomMessagesNotificationId(currentUser.userId),
@@ -84,14 +88,14 @@ class NotificationRenderer @Inject constructor(
8488 invitationNotifications.forEach { wrapper ->
8589 when (wrapper) {
8690 is OneShotNotification .Removed -> {
87- Timber .d(" Removing invitation notification ${wrapper.key} " )
91+ Timber .tag(loggerTag.value). d(" Removing invitation notification ${wrapper.key} " )
8892 notificationDisplayer.cancelNotificationMessage(
8993 tag = wrapper.key,
9094 id = notificationIdProvider.getRoomInvitationNotificationId(currentUser.userId)
9195 )
9296 }
9397 is OneShotNotification .Append -> if (useCompleteNotificationFormat) {
94- Timber .d(" Updating invitation notification ${wrapper.meta.key} " )
98+ Timber .tag(loggerTag.value). d(" Updating invitation notification ${wrapper.meta.key} " )
9599 notificationDisplayer.showNotificationMessage(
96100 tag = wrapper.meta.key,
97101 id = notificationIdProvider.getRoomInvitationNotificationId(currentUser.userId),
@@ -104,14 +108,14 @@ class NotificationRenderer @Inject constructor(
104108 simpleNotifications.forEach { wrapper ->
105109 when (wrapper) {
106110 is OneShotNotification .Removed -> {
107- Timber .d(" Removing simple notification ${wrapper.key} " )
111+ Timber .tag(loggerTag.value). d(" Removing simple notification ${wrapper.key} " )
108112 notificationDisplayer.cancelNotificationMessage(
109113 tag = wrapper.key,
110114 id = notificationIdProvider.getRoomEventNotificationId(currentUser.userId)
111115 )
112116 }
113117 is OneShotNotification .Append -> if (useCompleteNotificationFormat) {
114- Timber .d(" Updating simple notification ${wrapper.meta.key} " )
118+ Timber .tag(loggerTag.value). d(" Updating simple notification ${wrapper.meta.key} " )
115119 notificationDisplayer.showNotificationMessage(
116120 tag = wrapper.meta.key,
117121 id = notificationIdProvider.getRoomEventNotificationId(currentUser.userId),
@@ -124,14 +128,14 @@ class NotificationRenderer @Inject constructor(
124128 fallbackNotifications.forEach { wrapper ->
125129 when (wrapper) {
126130 is OneShotNotification .Removed -> {
127- Timber .d(" Removing fallback notification ${wrapper.key} " )
131+ Timber .tag(loggerTag.value). d(" Removing fallback notification ${wrapper.key} " )
128132 notificationDisplayer.cancelNotificationMessage(
129133 tag = wrapper.key,
130134 id = notificationIdProvider.getFallbackNotificationId(currentUser.userId)
131135 )
132136 }
133137 is OneShotNotification .Append -> if (useCompleteNotificationFormat) {
134- Timber .d(" Updating fallback notification ${wrapper.meta.key} " )
138+ Timber .tag(loggerTag.value). d(" Updating fallback notification ${wrapper.meta.key} " )
135139 notificationDisplayer.showNotificationMessage(
136140 tag = wrapper.meta.key,
137141 id = notificationIdProvider.getFallbackNotificationId(currentUser.userId),
@@ -143,7 +147,7 @@ class NotificationRenderer @Inject constructor(
143147
144148 // Update summary last to avoid briefly displaying it before other notifications
145149 if (summaryNotification is SummaryNotification .Update ) {
146- Timber .d(" Updating summary notification" )
150+ Timber .tag(loggerTag.value). d(" Updating summary notification" )
147151 notificationDisplayer.showNotificationMessage(
148152 tag = null ,
149153 id = notificationIdProvider.getSummaryNotificationId(currentUser.userId),
0 commit comments