mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Should fix quit button visibility in drawer menu
This commit is contained in:
parent
9837a834d4
commit
b5a1e21f40
5 changed files with 35 additions and 1 deletions
|
|
@ -170,6 +170,14 @@ class DrawerMenuFragment : GenericMainFragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.refreshDrawerMenuQuitButtonEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
coreContext.postOnCoreThread {
|
||||
viewModel.checkIfKeepAliveServiceIsEnabled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showAccountPopupMenu(view: View, account: Account) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.linphone.databinding.SettingsAdvancedFragmentBinding
|
|||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.GenericMainFragment
|
||||
import org.linphone.ui.main.settings.viewmodel.SettingsViewModel
|
||||
import org.linphone.utils.Event
|
||||
|
||||
@UiThread
|
||||
class SettingsAdvancedFragment : GenericMainFragment() {
|
||||
|
|
@ -105,6 +106,12 @@ class SettingsAdvancedFragment : GenericMainFragment() {
|
|||
setupOutputAudioDevicePicker()
|
||||
}
|
||||
|
||||
viewModel.keepAliveServiceSettingChangedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
sharedViewModel.refreshDrawerMenuQuitButtonEvent.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ class SettingsViewModel
|
|||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val keepAliveServiceSettingChangedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
// Security settings
|
||||
val isVfsEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
|
|
@ -689,6 +693,7 @@ class SettingsViewModel
|
|||
} else {
|
||||
coreContext.stopKeepAliveService()
|
||||
}
|
||||
keepAliveServiceSettingChangedEvent.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ class DrawerMenuViewModel
|
|||
|
||||
hideRecordings.postValue(corePreferences.disableCallRecordings)
|
||||
hideSettings.postValue(corePreferences.hideSettings)
|
||||
hideQuitButton.postValue(!corePreferences.keepServiceAlive)
|
||||
|
||||
checkIfKeepAliveServiceIsEnabled()
|
||||
|
||||
computeAccountsList()
|
||||
computeShortcuts()
|
||||
|
|
@ -169,6 +170,15 @@ class DrawerMenuViewModel
|
|||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
fun checkIfKeepAliveServiceIsEnabled() {
|
||||
val useKeepAliveService = corePreferences.keepServiceAlive
|
||||
hideQuitButton.postValue(!useKeepAliveService)
|
||||
if (useKeepAliveService) {
|
||||
Log.i("$TAG Keep alive service is enabled, do not hide quit button")
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun computeAccountsList() {
|
||||
accounts.value.orEmpty().forEach(AccountModel::destroy)
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ class SharedMainViewModel
|
|||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val refreshDrawerMenuQuitButtonEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val forceUpdateAvailableNavigationItems: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue