Исправлены push-уведомления: восстановлена подписка токена и fallback обработки

This commit is contained in:
2026-03-11 22:59:48 +07:00
parent 85a68c6cc5
commit 00e9370910
7 changed files with 47 additions and 68 deletions

View File

@@ -132,6 +132,19 @@ class RosettaFirebaseMessagingService : FirebaseMessagingService() {
handledMessageData = true
}
}
val looksLikeMessagePayload =
type.contains("message") ||
data.keys.any { key ->
val lower = key.lowercase(Locale.ROOT)
lower.contains("message") ||
lower.contains("text") ||
lower.contains("body")
}
if (!handledMessageData && !isReadEvent && looksLikeMessagePayload) {
showSimpleNotification(senderName, messagePreview)
handledMessageData = true
}
}
// Обрабатываем notification payload (если есть).
@@ -164,11 +177,6 @@ class RosettaFirebaseMessagingService : FirebaseMessagingService() {
}
lastNotifTimestamps[dedupKey] = now
Log.d(TAG, "\u2705 Showing notification for key=$dedupKey")
// Desktop parity: suppress notifications during sync (useDialogFiber.ts checks
// protocolState != ProtocolState.SYNCHRONIZATION before calling notify()).
if (ProtocolManager.syncInProgress.value) {
return
}
val senderKey = senderPublicKey?.trim().orEmpty()
if (senderKey.isNotEmpty() && isDialogMuted(senderKey)) {
return