Make sure newly added account is marked as default in side menu

This commit is contained in:
Sylvain Berfini 2024-12-02 11:25:30 +01:00
parent 5a1487a691
commit 6b11e37b14
2 changed files with 2 additions and 3 deletions

View file

@ -120,6 +120,7 @@ class AccountModel @WorkerThread constructor(
account.addListener(accountListener)
coreContext.core.addListener(coreListener)
isDefault.postValue(false)
presenceStatus.postValue(ConsolidatedPresence.Offline)
showMwi.postValue(false)
voicemailCount.postValue("")

View file

@ -82,9 +82,7 @@ class DrawerMenuViewModel @UiThread constructor() : GenericViewModel() {
"$TAG Account [${account.params.identityAddress?.asStringUriOnly()}] has been set as default"
)
for (model in accounts.value.orEmpty()) {
if (model.account != account) {
model.isDefault.postValue(false)
}
model.isDefault.postValue(model.account == account)
}
defaultAccountChangedEvent.postValue(
Event(account.params.identityAddress?.asStringUriOnly() ?: "")