Notification: dismiss all on sign out

This commit is contained in:
Benoit Marty 2019-06-25 16:14:25 +02:00
parent 785f33177d
commit f6c500d120
2 changed files with 8 additions and 2 deletions

View File

@ -166,7 +166,8 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.sliding_menu_sign_out -> {
SignOutUiWorker(this).perform(Matrix.getInstance().currentSession!!)
SignOutUiWorker(this, notificationDrawerManager)
.perform(Matrix.getInstance().currentSession!!)
return true
}
}

View File

@ -21,8 +21,10 @@ import im.vector.matrix.android.api.session.Session
import im.vector.riotredesign.R
import im.vector.riotredesign.core.platform.VectorBaseActivity
import im.vector.riotredesign.features.MainActivity
import im.vector.riotredesign.features.notifications.NotificationDrawerManager
class SignOutUiWorker(val activity: VectorBaseActivity) {
class SignOutUiWorker(private val activity: VectorBaseActivity,
private val notificationDrawerManager: NotificationDrawerManager) {
fun perform(session: Session) {
if (SignOutViewModel.doYouNeedToBeDisplayed(session)) {
@ -45,6 +47,9 @@ class SignOutUiWorker(val activity: VectorBaseActivity) {
}
private fun doSignOut() {
// Dismiss all notifications
notificationDrawerManager.clearAllEvents()
MainActivity.restartApp(activity, clearCache = true, clearCredentials = true)
}
}