From 3c72ee6e0c5d2e0364723436ed087d8c88b3fe9b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 8 Jun 2022 17:02:47 +0200 Subject: [PATCH] Unregister UP when signing out --- .../main/java/im/vector/app/core/di/ActiveSessionHolder.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt b/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt index f0c956365f..ef7f0896b8 100644 --- a/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt +++ b/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt @@ -18,6 +18,7 @@ package im.vector.app.core.di import arrow.core.Option import im.vector.app.ActiveSessionDataSource +import im.vector.app.core.pushers.UnifiedPushHelper import im.vector.app.core.services.GuardServiceStarter import im.vector.app.features.call.webrtc.WebRtcCallManager import im.vector.app.features.crypto.keysrequest.KeyRequestHandler @@ -39,6 +40,7 @@ class ActiveSessionHolder @Inject constructor( private val pushRuleTriggerListener: PushRuleTriggerListener, private val sessionListener: SessionListener, private val imageManager: ImageManager, + private val unifiedPushHelper: UnifiedPushHelper, private val guardServiceStarter: GuardServiceStarter ) { @@ -58,7 +60,7 @@ class ActiveSessionHolder @Inject constructor( guardServiceStarter.start() } - fun clearActiveSession() { + suspend fun clearActiveSession() { // Do some cleanup first getSafeActiveSession()?.let { Timber.w("clearActiveSession of ${it.myUserId}") @@ -72,6 +74,8 @@ class ActiveSessionHolder @Inject constructor( keyRequestHandler.stop() incomingVerificationRequestHandler.stop() pushRuleTriggerListener.stop() + // No need to unregister the pusher, the sign out will (should?) do it server side. + unifiedPushHelper.unregister(pushersManager = null) guardServiceStarter.stop() }