UnifiedPush: also invoke UnifiedPush.unregisterApp when endpoint == null || gateway == null
This commit is contained in:
parent
1f3a0eb698
commit
f406433652
1 changed files with 8 additions and 5 deletions
|
|
@ -33,15 +33,18 @@ class DefaultUnregisterUnifiedPushUseCase @Inject constructor(
|
||||||
if (endpoint == null || gateway == null) {
|
if (endpoint == null || gateway == null) {
|
||||||
Timber.w("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
|
// Ensure we don't have any remaining data, but ignore this error
|
||||||
unifiedPushStore.storeUpEndpoint(clientSecret, null)
|
cleanup(clientSecret)
|
||||||
unifiedPushStore.storePushGateway(clientSecret, null)
|
|
||||||
return Result.success(Unit)
|
return Result.success(Unit)
|
||||||
}
|
}
|
||||||
return pusherSubscriber.unregisterPusher(matrixClient, endpoint, gateway)
|
return pusherSubscriber.unregisterPusher(matrixClient, endpoint, gateway)
|
||||||
.onSuccess {
|
.onSuccess {
|
||||||
unifiedPushStore.storeUpEndpoint(clientSecret, null)
|
cleanup(clientSecret)
|
||||||
unifiedPushStore.storePushGateway(clientSecret, null)
|
|
||||||
UnifiedPush.unregisterApp(context, clientSecret)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun cleanup(clientSecret: String) {
|
||||||
|
unifiedPushStore.storeUpEndpoint(clientSecret, null)
|
||||||
|
unifiedPushStore.storePushGateway(clientSecret, null)
|
||||||
|
UnifiedPush.unregisterApp(context, clientSecret)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue