forked from GitHub-Mirror/riotX-android
Notification: dismiss all on sign out
This commit is contained in:
parent
785f33177d
commit
f6c500d120
@ -166,7 +166,8 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.sliding_menu_sign_out -> {
|
R.id.sliding_menu_sign_out -> {
|
||||||
SignOutUiWorker(this).perform(Matrix.getInstance().currentSession!!)
|
SignOutUiWorker(this, notificationDrawerManager)
|
||||||
|
.perform(Matrix.getInstance().currentSession!!)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,10 @@ import im.vector.matrix.android.api.session.Session
|
|||||||
import im.vector.riotredesign.R
|
import im.vector.riotredesign.R
|
||||||
import im.vector.riotredesign.core.platform.VectorBaseActivity
|
import im.vector.riotredesign.core.platform.VectorBaseActivity
|
||||||
import im.vector.riotredesign.features.MainActivity
|
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) {
|
fun perform(session: Session) {
|
||||||
if (SignOutViewModel.doYouNeedToBeDisplayed(session)) {
|
if (SignOutViewModel.doYouNeedToBeDisplayed(session)) {
|
||||||
@ -45,6 +47,9 @@ class SignOutUiWorker(val activity: VectorBaseActivity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun doSignOut() {
|
private fun doSignOut() {
|
||||||
|
// Dismiss all notifications
|
||||||
|
notificationDrawerManager.clearAllEvents()
|
||||||
|
|
||||||
MainActivity.restartApp(activity, clearCache = true, clearCredentials = true)
|
MainActivity.restartApp(activity, clearCache = true, clearCredentials = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user