Clear alerts if user sign out

This commit is contained in:
Benoit Marty 2020-10-15 14:23:45 +02:00 committed by Benoit Marty
parent f68eb449bd
commit 95142274fa
3 changed files with 21 additions and 0 deletions

View file

@ -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)

View file

@ -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 {

View file

@ -78,6 +78,21 @@ class PopupAlertManager @Inject constructor(private val avatarRenderer: Lazy<Ava
}
}
/**
* Cancel all alerts, after a sign out for instance
*/
fun cancelAll() {
synchronized(alertFiFo) {
alertFiFo.clear()
}
// Cancel any displayed alert
weakCurrentActivity?.get()?.runOnUiThread {
Alerter.hide()
currentIsDismissed()
}
}
fun onNewActivityDisplayed(activity: Activity) {
// we want to remove existing popup on previous activity and display it on new one
if (currentAlerter != null) {