mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Updated navigation & other views when switching default account
This commit is contained in:
parent
78dd449baf
commit
528855c5d5
5 changed files with 41 additions and 12 deletions
|
|
@ -100,5 +100,10 @@ class BottomNavBarFragment : Fragment() {
|
|||
viewModel.resetMissedCallsCount()
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.defaultAccountChangedEvent.observe(viewLifecycleOwner) {
|
||||
// Do not consume it!
|
||||
viewModel.updateAvailableMenus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,6 +180,11 @@ class StartCallFragment : GenericFragment() {
|
|||
viewModel.isNumpadVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.defaultAccountChangedEvent.observe(viewLifecycleOwner) {
|
||||
// Do not consume it!
|
||||
viewModel.updateGroupCallButtonVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ class StartCallViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val isNumpadVisible = MutableLiveData<Boolean>()
|
||||
|
||||
val isGroupCallAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val appendDigitToSearchBarEvent: MutableLiveData<Event<String>> by lazy {
|
||||
MutableLiveData<Event<String>>()
|
||||
}
|
||||
|
|
@ -127,15 +129,12 @@ class StartCallViewModel @UiThread constructor() : ViewModel() {
|
|||
}
|
||||
)
|
||||
|
||||
updateGroupCallButtonVisibility()
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val defaultAccount = core.defaultAccount
|
||||
limitSearchToLinphoneAccounts = defaultAccount?.isInSecureMode() ?: false
|
||||
|
||||
val hideGroupCall = corePreferences.disableMeetings || !LinphoneUtils.isRemoteConferencingAvailable(
|
||||
core
|
||||
)
|
||||
hideGroupCallButton.postValue(hideGroupCall)
|
||||
|
||||
coreContext.contactsManager.addListener(contactsListener)
|
||||
magicSearch = core.createMagicSearch()
|
||||
magicSearch.limitedSearch = false
|
||||
|
|
@ -159,6 +158,16 @@ class StartCallViewModel @UiThread constructor() : ViewModel() {
|
|||
searchFilter.value = ""
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateGroupCallButtonVisibility() {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val hideGroupCall = corePreferences.disableMeetings || !LinphoneUtils.isRemoteConferencingAvailable(
|
||||
core
|
||||
)
|
||||
hideGroupCallButton.postValue(hideGroupCall)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun switchBetweenKeyboardAndNumpad() {
|
||||
val showKeyboard = isNumpadVisible.value == true
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
|
|||
if (core.accountList.isNotEmpty()) {
|
||||
Log.i("$TAG Updating displayed default account")
|
||||
val defaultAccount = core.defaultAccount ?: core.accountList.first()
|
||||
|
||||
account.value?.destroy()
|
||||
account.postValue(AccountModel(defaultAccount))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,14 +68,9 @@ class BottomNavBarViewModel @UiThread constructor() : ViewModel() {
|
|||
coreContext.postOnCoreThread { core ->
|
||||
core.addListener(coreListener)
|
||||
updateMissedCallsCount()
|
||||
|
||||
hideConversations.postValue(corePreferences.disableChat)
|
||||
|
||||
val hideGroupCall = corePreferences.disableMeetings || !LinphoneUtils.isRemoteConferencingAvailable(
|
||||
core
|
||||
)
|
||||
hideMeetings.postValue(hideGroupCall)
|
||||
}
|
||||
|
||||
updateAvailableMenus()
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
|
@ -106,4 +101,17 @@ class BottomNavBarViewModel @UiThread constructor() : ViewModel() {
|
|||
updateMissedCallsCount()
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateAvailableMenus() {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
hideConversations.postValue(corePreferences.disableChat)
|
||||
|
||||
val hideGroupCall =
|
||||
corePreferences.disableMeetings || !LinphoneUtils.isRemoteConferencingAvailable(
|
||||
core
|
||||
)
|
||||
hideMeetings.postValue(hideGroupCall)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue