From 95142274fad45a4fef19a33f79e6da51c0d9ecba Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 15 Oct 2020 14:23:45 +0200 Subject: [PATCH] Clear alerts if user sign out --- CHANGES.md | 1 + .../java/im/vector/app/features/MainActivity.kt | 5 +++++ .../app/features/popup/PopupAlertManager.kt | 15 +++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 320df0b6e7..8f3dfd8489 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -32,6 +32,7 @@ Bugfix 🐛: - Properly detect cross signing keys reset - Don't set presence when handling a push notification or polling (#2156) - Be robust against `StrandHogg` task injection + - Clear alerts if user sign out Translations 🗣: - Move store data to `/fastlane/metadata/android` (#812) diff --git a/vector/src/main/java/im/vector/app/features/MainActivity.kt b/vector/src/main/java/im/vector/app/features/MainActivity.kt index 7977d969e8..b5552e4d62 100644 --- a/vector/src/main/java/im/vector/app/features/MainActivity.kt +++ b/vector/src/main/java/im/vector/app/features/MainActivity.kt @@ -36,6 +36,7 @@ import im.vector.app.features.notifications.NotificationDrawerManager import im.vector.app.features.pin.PinCodeStore import im.vector.app.features.pin.PinLocker import im.vector.app.features.pin.UnlockedActivity +import im.vector.app.features.popup.PopupAlertManager import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.signout.hard.SignedOutActivity import im.vector.app.features.signout.soft.SoftLogoutActivity @@ -89,6 +90,7 @@ class MainActivity : VectorBaseActivity(), UnlockedActivity { @Inject lateinit var shortcutsHandler: ShortcutsHandler @Inject lateinit var pinCodeStore: PinCodeStore @Inject lateinit var pinLocker: PinLocker + @Inject lateinit var popupAlertManager: PopupAlertManager override fun injectWith(injector: ScreenComponent) { injector.inject(this) @@ -115,6 +117,9 @@ class MainActivity : VectorBaseActivity(), UnlockedActivity { // Also clear the dynamic shortcuts shortcutsHandler.clearShortcuts() + + // Also clear the alerts + popupAlertManager.cancelAll() } private fun parseArgs(): MainActivityArgs { diff --git a/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt b/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt index 59386ffff0..665eb93428 100644 --- a/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt +++ b/vector/src/main/java/im/vector/app/features/popup/PopupAlertManager.kt @@ -78,6 +78,21 @@ class PopupAlertManager @Inject constructor(private val avatarRenderer: Lazy