Merge pull request #2901 from element-hq/feature/bma/fixUnregisteringPusherLocalError
Fix unregistering pusher local error
This commit is contained in:
commit
85c8a26f8a
5 changed files with 41 additions and 17 deletions
|
|
@ -23,6 +23,7 @@ import io.element.android.libraries.di.ApplicationContext
|
|||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.pushproviders.api.PusherSubscriber
|
||||
import org.unifiedpush.android.connector.UnifiedPush
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
interface UnregisterUnifiedPushUseCase {
|
||||
|
|
@ -39,7 +40,11 @@ class DefaultUnregisterUnifiedPushUseCase @Inject constructor(
|
|||
val endpoint = unifiedPushStore.getEndpoint(clientSecret)
|
||||
val gateway = unifiedPushStore.getPushGateway(clientSecret)
|
||||
if (endpoint == null || gateway == null) {
|
||||
return Result.failure(IllegalStateException("No endpoint or gateway found for client secret"))
|
||||
Timber.w("No endpoint or gateway found for client secret")
|
||||
// Ensure we don't have any remaining data, but ignore this error
|
||||
unifiedPushStore.storeUpEndpoint(clientSecret, null)
|
||||
unifiedPushStore.storePushGateway(clientSecret, null)
|
||||
return Result.success(Unit)
|
||||
}
|
||||
return pusherSubscriber.unregisterPusher(matrixClient, endpoint, gateway)
|
||||
.onSuccess {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue