Clear auth info password requested dialog when account is removed

This commit is contained in:
Sylvain Berfini 2025-02-26 11:27:57 +01:00
parent 354f39d76d
commit 30364c48b0
2 changed files with 20 additions and 0 deletions

View file

@ -93,6 +93,10 @@ class CoreContext
MutableLiveData<Event<String>>()
}
val clearAuthenticationRequestDialogEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val refreshMicrophoneMuteStateEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
@ -391,6 +395,7 @@ class CoreContext
}
}
@WorkerThread
override fun onAccountAdded(core: Core, account: Account) {
// Prevent this trigger when core is stopped/start in remote prov
if (core.globalState == GlobalState.Off) return
@ -412,6 +417,15 @@ class CoreContext
}
}
}
@WorkerThread
override fun onAccountRemoved(core: Core, account: Account) {
Log.i("$TAG Account [${account.params.identityAddress?.asStringUriOnly()}] removed, clearing auth request dialog if needed")
if (account.findAuthInfo() == digestAuthInfoPendingPasswordUpdate) {
Log.i("$TAG Removed account matches auth info pending password update, removing dialog")
clearAuthenticationRequestDialogEvent.postValue(Event(true))
}
}
}
private var logcatEnabled: Boolean = corePreferences.printLogsInLogcat

View file

@ -284,6 +284,12 @@ class MainActivity : GenericActivity() {
}
}
coreContext.clearAuthenticationRequestDialogEvent.observe(this) {
it.consume {
currentlyDisplayedAuthDialog?.dismiss()
}
}
coreContext.showGreenToastEvent.observe(this) {
it.consume { pair ->
val message = getString(pair.first)