Push distributor: ensure the current UnifiedPush distributor is stored
This commit is contained in:
parent
56ca04affa
commit
d2fbff09b8
8 changed files with 68 additions and 8 deletions
|
|
@ -43,7 +43,7 @@ class FirebasePushProvider @Inject constructor(
|
|||
}
|
||||
|
||||
override fun getDistributors(): List<Distributor> {
|
||||
return listOf(Distributor("Firebase", "Firebase"))
|
||||
return listOf(firebaseDistributor)
|
||||
}
|
||||
|
||||
override suspend fun registerWith(matrixClient: MatrixClient, distributor: Distributor) {
|
||||
|
|
@ -53,6 +53,8 @@ class FirebasePushProvider @Inject constructor(
|
|||
pusherSubscriber.registerPusher(matrixClient, pushKey, FirebaseConfig.PUSHER_HTTP_URL)
|
||||
}
|
||||
|
||||
override suspend fun getCurrentDistributor(matrixClient: MatrixClient) = firebaseDistributor
|
||||
|
||||
override suspend fun unregister(matrixClient: MatrixClient) {
|
||||
val pushKey = firebaseStore.getFcmToken() ?: return Unit.also {
|
||||
Timber.tag(loggerTag.value).w("Unable to unregister pusher, Firebase token is not known.")
|
||||
|
|
@ -68,4 +70,8 @@ class FirebasePushProvider @Inject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val firebaseDistributor = Distributor("Firebase", "Firebase")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue