mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-28 22:18:46 +03:00
Add logs for invalid push data
This commit is contained in:
parent
3e12907b26
commit
a17a4fe4b1
2 changed files with 9 additions and 2 deletions
|
@ -27,9 +27,12 @@ import im.vector.app.core.pushers.PushersManager
|
||||||
import im.vector.app.core.pushers.UnifiedPushHelper
|
import im.vector.app.core.pushers.UnifiedPushHelper
|
||||||
import im.vector.app.core.pushers.VectorPushHandler
|
import im.vector.app.core.pushers.VectorPushHandler
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
|
import org.matrix.android.sdk.api.logger.LoggerTag
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
private val loggerTag = LoggerTag("Push", LoggerTag.SYNC)
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class VectorFirebaseMessagingService : FirebaseMessagingService() {
|
class VectorFirebaseMessagingService : FirebaseMessagingService() {
|
||||||
@Inject lateinit var fcmHelper: FcmHelper
|
@Inject lateinit var fcmHelper: FcmHelper
|
||||||
|
@ -41,7 +44,7 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
|
||||||
@Inject lateinit var unifiedPushHelper: UnifiedPushHelper
|
@Inject lateinit var unifiedPushHelper: UnifiedPushHelper
|
||||||
|
|
||||||
override fun onNewToken(token: String) {
|
override fun onNewToken(token: String) {
|
||||||
Timber.d("New Firebase token")
|
Timber.tag(loggerTag.value).d("New Firebase token")
|
||||||
fcmHelper.storeFcmToken(token)
|
fcmHelper.storeFcmToken(token)
|
||||||
if (
|
if (
|
||||||
vectorPreferences.areNotificationEnabledForDevice() &&
|
vectorPreferences.areNotificationEnabledForDevice() &&
|
||||||
|
@ -53,9 +56,11 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMessageReceived(message: RemoteMessage) {
|
override fun onMessageReceived(message: RemoteMessage) {
|
||||||
Timber.d("New Firebase message")
|
Timber.tag(loggerTag.value).d("New Firebase message")
|
||||||
pushParser.parsePushDataFcm(message.data)?.let {
|
pushParser.parsePushDataFcm(message.data)?.let {
|
||||||
vectorPushHandler.handle(it)
|
vectorPushHandler.handle(it)
|
||||||
|
} ?: run {
|
||||||
|
Timber.tag(loggerTag.value).w("Invalid received data Json format")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ class VectorUnifiedPushMessagingReceiver : MessagingReceiver() {
|
||||||
Timber.tag(loggerTag.value).d("New message")
|
Timber.tag(loggerTag.value).d("New message")
|
||||||
pushParser.parsePushDataUnifiedPush(message)?.let {
|
pushParser.parsePushDataUnifiedPush(message)?.let {
|
||||||
vectorPushHandler.handle(it)
|
vectorPushHandler.handle(it)
|
||||||
|
} ?: run {
|
||||||
|
Timber.tag(loggerTag.value).w("Invalid received data Json format")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue