Always register the pusher when application starts
This commit is contained in:
1
changelog.d/1481.bugfix
Normal file
1
changelog.d/1481.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
Always register the pusher when application starts
|
||||
@@ -63,20 +63,19 @@ class PushersManager @Inject constructor(
|
||||
override suspend fun registerPusher(matrixClient: MatrixClient, pushKey: String, gateway: String) {
|
||||
val userDataStore = userPushStoreFactory.create(matrixClient.sessionId)
|
||||
if (userDataStore.getCurrentRegisteredPushKey() == pushKey) {
|
||||
Timber.tag(loggerTag.value).d("Unnecessary to register again the same pusher")
|
||||
} else {
|
||||
// Register the pusher to the server
|
||||
matrixClient.pushersService().setHttpPusher(
|
||||
createHttpPusher(pushKey, gateway, matrixClient.sessionId)
|
||||
).fold(
|
||||
{
|
||||
userDataStore.setCurrentRegisteredPushKey(pushKey)
|
||||
},
|
||||
{ throwable ->
|
||||
Timber.tag(loggerTag.value).e(throwable, "Unable to register the pusher")
|
||||
}
|
||||
)
|
||||
Timber.tag(loggerTag.value)
|
||||
.d("Unnecessary to register again the same pusher, but do it in case the pusher has been removed from the server")
|
||||
}
|
||||
matrixClient.pushersService().setHttpPusher(
|
||||
createHttpPusher(pushKey, gateway, matrixClient.sessionId)
|
||||
).fold(
|
||||
{
|
||||
userDataStore.setCurrentRegisteredPushKey(pushKey)
|
||||
},
|
||||
{ throwable ->
|
||||
Timber.tag(loggerTag.value).e(throwable, "Unable to register the pusher")
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun createHttpPusher(
|
||||
|
||||
Reference in New Issue
Block a user