mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-27 18:46:19 +00:00
Reload accounts when applying remote provisioning
This commit is contained in:
parent
9daa433c44
commit
fb7c3a3cdc
2 changed files with 28 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ import org.linphone.core.Account
|
||||||
import org.linphone.core.Call
|
import org.linphone.core.Call
|
||||||
import org.linphone.core.ChatMessage
|
import org.linphone.core.ChatMessage
|
||||||
import org.linphone.core.ChatRoom
|
import org.linphone.core.ChatRoom
|
||||||
|
import org.linphone.core.ConfiguringState
|
||||||
import org.linphone.core.Core
|
import org.linphone.core.Core
|
||||||
import org.linphone.core.CoreListenerStub
|
import org.linphone.core.CoreListenerStub
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
|
@ -122,6 +123,22 @@ open class AbstractMainViewModel @UiThread constructor() : ViewModel() {
|
||||||
updateUnreadMessagesCount()
|
updateUnreadMessagesCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WorkerThread
|
||||||
|
override fun onConfiguringStatus(core: Core, status: ConfiguringState?, message: String?) {
|
||||||
|
if (status != ConfiguringState.Skipped) {
|
||||||
|
account.value?.destroy()
|
||||||
|
|
||||||
|
val defaultAccount = core.defaultAccount
|
||||||
|
if (defaultAccount != null) {
|
||||||
|
Log.i("$TAG Configuring status is [$status], reload default account")
|
||||||
|
account.postValue(AccountModel(defaultAccount))
|
||||||
|
defaultAccountChangedEvent.postValue(Event(true))
|
||||||
|
} else {
|
||||||
|
Log.w("$TAG Configuring status is [$status] but no default account was found!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun onDefaultAccountChanged(core: Core, defaultAccount: Account?) {
|
override fun onDefaultAccountChanged(core: Core, defaultAccount: Account?) {
|
||||||
account.value?.destroy()
|
account.value?.destroy()
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import androidx.lifecycle.ViewModel
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||||
import org.linphone.core.Account
|
import org.linphone.core.Account
|
||||||
|
import org.linphone.core.ConfiguringState
|
||||||
import org.linphone.core.Core
|
import org.linphone.core.Core
|
||||||
import org.linphone.core.CoreListenerStub
|
import org.linphone.core.CoreListenerStub
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
|
@ -97,6 +98,16 @@ class DrawerMenuViewModel @UiThread constructor() : ViewModel() {
|
||||||
)
|
)
|
||||||
computeAccountsList()
|
computeAccountsList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WorkerThread
|
||||||
|
override fun onConfiguringStatus(core: Core, status: ConfiguringState?, message: String?) {
|
||||||
|
if (status != ConfiguringState.Skipped) {
|
||||||
|
accounts.value.orEmpty().forEach(AccountModel::destroy)
|
||||||
|
|
||||||
|
Log.i("$TAG Configuring status is [$status], reload accounts")
|
||||||
|
computeAccountsList()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue