Update side menu & dialer conference menu visibility when account registration state changes

This commit is contained in:
Sylvain Berfini 2022-08-30 16:06:02 +02:00
parent 1b07cd358f
commit 57acb1b7b7
3 changed files with 16 additions and 3 deletions

View file

@ -128,6 +128,15 @@ class DialerViewModel : LogsUploadViewModel() {
}
}
}
override fun onAccountRegistrationStateChanged(
core: Core,
account: Account,
state: RegistrationState?,
message: String
) {
scheduleConferenceAvailable.value = LinphoneUtils.isRemoteConferencingAvailable()
}
}
init {

View file

@ -33,8 +33,7 @@ class SideMenuViewModel : ViewModel() {
val showAssistant: Boolean = corePreferences.showAssistantInSideMenu
val showSettings: Boolean = corePreferences.showSettingsInSideMenu
val showRecordings: Boolean = corePreferences.showRecordingsInSideMenu
val showScheduledConferences: Boolean = corePreferences.showScheduledConferencesInSideMenu &&
LinphoneUtils.isRemoteConferencingAvailable()
val showScheduledConferences = MutableLiveData<Boolean>()
val showAbout: Boolean = corePreferences.showAboutInSideMenu
val showQuit: Boolean = corePreferences.showQuitInSideMenu
@ -66,6 +65,8 @@ class SideMenuViewModel : ViewModel() {
init {
defaultAccountFound.value = false
defaultAccountAvatar.value = corePreferences.defaultAccountAvatarPath
showScheduledConferences.value = corePreferences.showScheduledConferencesInSideMenu &&
LinphoneUtils.isRemoteConferencingAvailable()
coreContext.core.addListener(listener)
updateAccountsList()
}
@ -107,6 +108,9 @@ class SideMenuViewModel : ViewModel() {
}
}
accounts.value = list
showScheduledConferences.value = corePreferences.showScheduledConferencesInSideMenu &&
LinphoneUtils.isRemoteConferencingAvailable()
}
fun setPictureFromPath(picturePath: String) {

View file

@ -118,7 +118,7 @@ class LinphoneUtils {
fun isRemoteConferencingAvailable(): Boolean {
val core = coreContext.core
return core.defaultAccount?.params?.audioVideoConferenceFactoryAddress != null || core.defaultAccount?.params?.conferenceFactoryUri != null
return core.defaultAccount?.params?.audioVideoConferenceFactoryAddress != null
}
fun createOneToOneChatRoom(participant: Address, isSecured: Boolean = false): ChatRoom? {