mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-21 12:08:29 +00:00
Improved parsing of account settings + navigate out of resuming fragment if no longer available due to config changes
This commit is contained in:
parent
dce27530e0
commit
7ba19364b9
6 changed files with 39 additions and 6 deletions
|
|
@ -309,6 +309,13 @@ class ConversationsListFragment : AbstractTopBarFragment() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
|
if (listViewModel.hideMeetings.value == true) {
|
||||||
|
Log.w(
|
||||||
|
"$TAG Resuming fragment that should no longer be accessible, going to contacts list instead"
|
||||||
|
)
|
||||||
|
sharedViewModel.navigateToContactsEvent.value = Event(true)
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
adapter.registerAdapterDataObserver(dataObserver)
|
adapter.registerAdapterDataObserver(dataObserver)
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: IllegalStateException) {
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,12 @@ abstract class AbstractTopBarFragment : GenericFragment() {
|
||||||
viewModel.resetMissedCallsCount()
|
viewModel.resetMissedCallsCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sharedViewModel.forceUpdateAvailableNavigationItems.observe(viewLifecycleOwner) {
|
||||||
|
it.consume {
|
||||||
|
viewModel.updateAvailableMenus()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initBottomNavBar(navBar: View) {
|
fun initBottomNavBar(navBar: View) {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import org.linphone.ui.main.fragment.AbstractTopBarFragment
|
||||||
import org.linphone.ui.main.meetings.adapter.MeetingsListAdapter
|
import org.linphone.ui.main.meetings.adapter.MeetingsListAdapter
|
||||||
import org.linphone.ui.main.meetings.viewmodel.MeetingsListViewModel
|
import org.linphone.ui.main.meetings.viewmodel.MeetingsListViewModel
|
||||||
import org.linphone.utils.AppUtils
|
import org.linphone.utils.AppUtils
|
||||||
|
import org.linphone.utils.Event
|
||||||
import org.linphone.utils.RecyclerViewHeaderDecoration
|
import org.linphone.utils.RecyclerViewHeaderDecoration
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
|
|
@ -219,6 +220,17 @@ class MeetingsListFragment : AbstractTopBarFragment() {
|
||||||
bottomSheetDialog = null
|
bottomSheetDialog = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
|
||||||
|
if (listViewModel.hideMeetings.value == true) {
|
||||||
|
Log.w(
|
||||||
|
"$TAG Resuming fragment that should no longer be accessible, going to contacts list instead"
|
||||||
|
)
|
||||||
|
sharedViewModel.navigateToContactsEvent.value = Event(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun scrollToToday() {
|
private fun scrollToToday() {
|
||||||
val todayMeeting = listViewModel.meetings.value.orEmpty().find {
|
val todayMeeting = listViewModel.meetings.value.orEmpty().find {
|
||||||
it.isToday
|
it.isToday
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import org.linphone.core.tools.Log
|
||||||
import org.linphone.databinding.AccountSettingsFragmentBinding
|
import org.linphone.databinding.AccountSettingsFragmentBinding
|
||||||
import org.linphone.ui.main.fragment.GenericFragment
|
import org.linphone.ui.main.fragment.GenericFragment
|
||||||
import org.linphone.ui.main.settings.viewmodel.AccountSettingsViewModel
|
import org.linphone.ui.main.settings.viewmodel.AccountSettingsViewModel
|
||||||
|
import org.linphone.utils.Event
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
class AccountSettingsFragment : GenericFragment() {
|
class AccountSettingsFragment : GenericFragment() {
|
||||||
|
|
@ -113,5 +114,7 @@ class AccountSettingsFragment : GenericFragment() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
|
|
||||||
viewModel.saveChanges()
|
viewModel.saveChanges()
|
||||||
|
// It is possible some value have changed, causing some menu to appear or disappear
|
||||||
|
sharedViewModel.forceUpdateAvailableNavigationItems.value = Event(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import java.util.Locale
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import org.linphone.core.AVPFMode
|
import org.linphone.core.AVPFMode
|
||||||
import org.linphone.core.Account
|
import org.linphone.core.Account
|
||||||
import org.linphone.core.Factory
|
|
||||||
import org.linphone.core.NatPolicy
|
import org.linphone.core.NatPolicy
|
||||||
import org.linphone.core.TransportType
|
import org.linphone.core.TransportType
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
|
@ -122,7 +121,7 @@ class AccountSettingsViewModel @UiThread constructor() : ViewModel() {
|
||||||
|
|
||||||
val server = sipProxyServer.value.orEmpty()
|
val server = sipProxyServer.value.orEmpty()
|
||||||
if (server.isNotEmpty()) {
|
if (server.isNotEmpty()) {
|
||||||
val serverAddress = Factory.instance().createAddress(server)
|
val serverAddress = core.interpretUrl(server, false)
|
||||||
if (serverAddress != null) {
|
if (serverAddress != null) {
|
||||||
serverAddress.transport = selectedTransport.value
|
serverAddress.transport = selectedTransport.value
|
||||||
newParams.serverAddress = serverAddress
|
newParams.serverAddress = serverAddress
|
||||||
|
|
@ -142,13 +141,15 @@ class AccountSettingsViewModel @UiThread constructor() : ViewModel() {
|
||||||
|
|
||||||
newParams.expires = expire.value?.toInt() ?: 31536000
|
newParams.expires = expire.value?.toInt() ?: 31536000
|
||||||
|
|
||||||
val conferenceFactoryAddress = Factory.instance().createAddress(
|
val conferenceFactoryAddress = core.interpretUrl(
|
||||||
conferenceFactoryUri.value.orEmpty()
|
conferenceFactoryUri.value.orEmpty(),
|
||||||
|
false
|
||||||
)
|
)
|
||||||
newParams.conferenceFactoryAddress = conferenceFactoryAddress
|
newParams.conferenceFactoryAddress = conferenceFactoryAddress
|
||||||
|
|
||||||
val audioVideoConferenceFactoryAddress = Factory.instance().createAddress(
|
val audioVideoConferenceFactoryAddress = core.interpretUrl(
|
||||||
audioVideoConferenceFactoryUri.value.orEmpty()
|
audioVideoConferenceFactoryUri.value.orEmpty(),
|
||||||
|
false
|
||||||
)
|
)
|
||||||
newParams.audioVideoConferenceFactoryAddress = audioVideoConferenceFactoryAddress
|
newParams.audioVideoConferenceFactoryAddress = audioVideoConferenceFactoryAddress
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
|
||||||
MutableLiveData<Event<Boolean>>()
|
MutableLiveData<Event<Boolean>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val forceUpdateAvailableNavigationItems: MutableLiveData<Event<Boolean>> by lazy {
|
||||||
|
MutableLiveData<Event<Boolean>>()
|
||||||
|
}
|
||||||
|
|
||||||
/* Contacts related */
|
/* Contacts related */
|
||||||
|
|
||||||
val showContactEvent: MutableLiveData<Event<String>> by lazy {
|
val showContactEvent: MutableLiveData<Event<String>> by lazy {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue