From a17a4fe4b1f43e86d234190185ea458f00e08770 Mon Sep 17 00:00:00 2001 From: sim Date: Thu, 8 Sep 2022 17:16:55 +0200 Subject: [PATCH] Add logs for invalid push data --- .../app/push/fcm/VectorFirebaseMessagingService.kt | 9 +++++++-- .../core/pushers/VectorUnifiedPushMessagingReceiver.kt | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/vector/src/gplay/java/im/vector/app/push/fcm/VectorFirebaseMessagingService.kt b/vector/src/gplay/java/im/vector/app/push/fcm/VectorFirebaseMessagingService.kt index 9182b855f3..ddbe8b1292 100644 --- a/vector/src/gplay/java/im/vector/app/push/fcm/VectorFirebaseMessagingService.kt +++ b/vector/src/gplay/java/im/vector/app/push/fcm/VectorFirebaseMessagingService.kt @@ -27,9 +27,12 @@ import im.vector.app.core.pushers.PushersManager import im.vector.app.core.pushers.UnifiedPushHelper import im.vector.app.core.pushers.VectorPushHandler import im.vector.app.features.settings.VectorPreferences +import org.matrix.android.sdk.api.logger.LoggerTag import timber.log.Timber import javax.inject.Inject +private val loggerTag = LoggerTag("Push", LoggerTag.SYNC) + @AndroidEntryPoint class VectorFirebaseMessagingService : FirebaseMessagingService() { @Inject lateinit var fcmHelper: FcmHelper @@ -41,7 +44,7 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() { @Inject lateinit var unifiedPushHelper: UnifiedPushHelper override fun onNewToken(token: String) { - Timber.d("New Firebase token") + Timber.tag(loggerTag.value).d("New Firebase token") fcmHelper.storeFcmToken(token) if ( vectorPreferences.areNotificationEnabledForDevice() && @@ -53,9 +56,11 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() { } override fun onMessageReceived(message: RemoteMessage) { - Timber.d("New Firebase message") + Timber.tag(loggerTag.value).d("New Firebase message") pushParser.parsePushDataFcm(message.data)?.let { vectorPushHandler.handle(it) + } ?: run { + Timber.tag(loggerTag.value).w("Invalid received data Json format") } } } diff --git a/vector/src/main/java/im/vector/app/core/pushers/VectorUnifiedPushMessagingReceiver.kt b/vector/src/main/java/im/vector/app/core/pushers/VectorUnifiedPushMessagingReceiver.kt index 01d85caa83..838cbd5935 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/VectorUnifiedPushMessagingReceiver.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/VectorUnifiedPushMessagingReceiver.kt @@ -61,6 +61,8 @@ class VectorUnifiedPushMessagingReceiver : MessagingReceiver() { Timber.tag(loggerTag.value).d("New message") pushParser.parsePushDataUnifiedPush(message)?.let { vectorPushHandler.handle(it) + } ?: run { + Timber.tag(loggerTag.value).w("Invalid received data Json format") } }