mirror of
https://github.com/bitwarden/android.git
synced 2024-11-22 01:16:02 +03:00
Remove legacy GCM notification support (#1464)
This commit is contained in:
parent
f4bdf5178a
commit
5e52b5a53d
5 changed files with 107 additions and 806 deletions
|
@ -65,14 +65,7 @@ interface PushManager {
|
|||
val syncSendUpsertFlow: Flow<SyncSendUpsertData>
|
||||
|
||||
/**
|
||||
* Handles the necessary steps to take when a push notification with a legacy FCM [data]
|
||||
* payload is received.
|
||||
*/
|
||||
fun onMessageReceived(data: String)
|
||||
|
||||
/**
|
||||
* Handles the necessary steps to take when a push notification with FCM v1 payload is
|
||||
* received.
|
||||
* Handles the necessary steps to take when a push notification payload is received.
|
||||
*/
|
||||
fun onMessageReceived(data: Map<String, String>)
|
||||
|
||||
|
|
|
@ -107,11 +107,6 @@ class PushManagerImpl @Inject constructor(
|
|||
.launchIn(unconfinedScope)
|
||||
}
|
||||
|
||||
override fun onMessageReceived(data: String) {
|
||||
val notification = json.decodeFromStringOrNull<BitwardenNotification>(data) ?: return
|
||||
onMessageReceived(notification)
|
||||
}
|
||||
|
||||
override fun onMessageReceived(data: Map<String, String>) {
|
||||
val notificationType = data["type"]
|
||||
?.let { json.decodeFromStringOrNull<NotificationType>(string = it) }
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package com.x8bit.bitwarden.data.platform.manager.model
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* Represents a Bitwarden push notification.
|
||||
*
|
||||
|
@ -11,9 +8,8 @@ import kotlinx.serialization.Serializable
|
|||
* @property notificationType The type of notification.
|
||||
* @property payload Data associated with the push notification.
|
||||
*/
|
||||
@Serializable
|
||||
data class BitwardenNotification(
|
||||
@SerialName("contextId") val contextId: String?,
|
||||
@SerialName("type") val notificationType: NotificationType,
|
||||
@SerialName("payload") val payload: String,
|
||||
val contextId: String?,
|
||||
val notificationType: NotificationType,
|
||||
val payload: String,
|
||||
)
|
||||
|
|
|
@ -17,10 +17,7 @@ class BitwardenFirebaseMessagingService : FirebaseMessagingService() {
|
|||
lateinit var pushManager: PushManager
|
||||
|
||||
override fun onMessageReceived(message: RemoteMessage) {
|
||||
message
|
||||
.data["data"]
|
||||
?.let { pushManager.onMessageReceived(it) }
|
||||
?: pushManager.onMessageReceived(message.data)
|
||||
pushManager.onMessageReceived(message.data)
|
||||
}
|
||||
|
||||
override fun onNewToken(token: String) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue