feat: Implement FCM token handling and dialog cache management; enhance user experience and performance
This commit is contained in:
@@ -51,32 +51,8 @@ class RosettaFirebaseMessagingService : FirebaseMessagingService() {
|
||||
// Сохраняем токен локально
|
||||
saveFcmToken(token)
|
||||
|
||||
// TODO: Отправляем токен на сервер если аккаунт уже залогинен
|
||||
/*
|
||||
serviceScope.launch {
|
||||
try {
|
||||
val accountManager = AccountManager(applicationContext)
|
||||
val currentAccount = accountManager.getCurrentAccount()
|
||||
|
||||
if (currentAccount != null) {
|
||||
Log.d(TAG, "📤 Sending FCM token to server for account: ${currentAccount.publicKey.take(10)}...")
|
||||
|
||||
// Отправляем через протокол
|
||||
val packet = PacketPushToken().apply {
|
||||
this.privateKey = CryptoManager.generatePrivateKeyHash(currentAccount.privateKey)
|
||||
this.publicKey = currentAccount.publicKey
|
||||
this.pushToken = token
|
||||
this.platform = "android"
|
||||
}
|
||||
|
||||
ProtocolManager.send(packet)
|
||||
Log.d(TAG, "✅ FCM token sent to server")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Error sending FCM token to server", e)
|
||||
}
|
||||
}
|
||||
*/
|
||||
// 📤 Токен будет отправлен на сервер после успешного логина в MainActivity
|
||||
Log.d(TAG, "💾 FCM token saved. Will be sent to server after login.")
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user