mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Hide 'mode selector' in account profile for third party SIP accounts + fixed issues when switching between a linphone account and a third party one
This commit is contained in:
parent
dcca7d6952
commit
29218a5311
6 changed files with 33 additions and 32 deletions
|
|
@ -309,7 +309,7 @@ class ConversationsListFragment : AbstractTopBarFragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
if (listViewModel.hideMeetings.value == true) {
|
||||
if (listViewModel.hideConversations.value == true) {
|
||||
Log.w(
|
||||
"$TAG Resuming fragment that should no longer be accessible, going to contacts list instead"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
package org.linphone.ui.main.fragment
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.annotation.UiThread
|
||||
|
|
@ -52,10 +51,6 @@ abstract class AbstractTopBarFragment : GenericFragment() {
|
|||
|
||||
abstract fun onDefaultAccountChanged()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
fun initSlidingPane(slidingPane: SlidingPaneLayout) {
|
||||
val slidingPaneBackPressedCallback = SlidingPaneBackPressedCallback(slidingPane)
|
||||
requireActivity().onBackPressedDispatcher.addCallback(
|
||||
|
|
|
|||
|
|
@ -57,10 +57,12 @@ class MeetingsListFragment : AbstractTopBarFragment() {
|
|||
private var bottomSheetDialog: BottomSheetDialogFragment? = null
|
||||
|
||||
override fun onDefaultAccountChanged() {
|
||||
Log.i(
|
||||
"$TAG Default account changed, updating avatar in top bar & re-computing meetings list"
|
||||
)
|
||||
listViewModel.applyFilter()
|
||||
if (!goToContactsIfMeetingsAreDisabledForCurrentlyDefaultAccount()) {
|
||||
Log.i(
|
||||
"$TAG Default account changed, updating avatar in top bar & re-computing meetings list"
|
||||
)
|
||||
listViewModel.applyFilter()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateAnimation(transit: Int, enter: Boolean, nextAnim: Int): Animation? {
|
||||
|
|
@ -223,12 +225,18 @@ class MeetingsListFragment : AbstractTopBarFragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
goToContactsIfMeetingsAreDisabledForCurrentlyDefaultAccount()
|
||||
}
|
||||
|
||||
private fun goToContactsIfMeetingsAreDisabledForCurrentlyDefaultAccount(): Boolean {
|
||||
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)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun scrollToToday() {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val registerEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val showModeSelection = MutableLiveData<Boolean>()
|
||||
|
||||
val isCurrentlySelectedModeSecure = MutableLiveData<Boolean>()
|
||||
|
||||
val devices = MutableLiveData<ArrayList<AccountDeviceModel>>()
|
||||
|
|
@ -93,28 +95,18 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
|
|||
sipAddress.postValue(account.params.identityAddress?.asStringUriOnly())
|
||||
displayName.postValue(account.params.identityAddress?.displayName)
|
||||
|
||||
val limeServerUrl = account.params.limeServerUrl
|
||||
val conferenceFactoryUri = account.params.conferenceFactoryUri
|
||||
val showMode = limeServerUrl.orEmpty().isNotEmpty() && conferenceFactoryUri.orEmpty().isNotEmpty()
|
||||
if (!showMode) {
|
||||
Log.i(
|
||||
"$TAG Either LIME server URL or conference factory URI isn't set, hiding end-to-end encrypted/interop mode selection"
|
||||
)
|
||||
}
|
||||
showModeSelection.postValue(showMode)
|
||||
|
||||
val devicesList = arrayListOf<AccountDeviceModel>()
|
||||
// TODO FIXME: use real devices list from API
|
||||
devicesList.add(
|
||||
AccountDeviceModel("Pixel 6 Pro de Sylvain", "03/10/2023", "9h25") {
|
||||
}
|
||||
)
|
||||
devicesList.add(
|
||||
AccountDeviceModel(
|
||||
"Sylvain Galaxy Tab S9 Pro+ Ultra",
|
||||
"03/10/2023",
|
||||
"9h25"
|
||||
) {
|
||||
}
|
||||
)
|
||||
devicesList.add(
|
||||
AccountDeviceModel("MacBook Pro de Marcel", "03/10/2023", "9h25") {
|
||||
}
|
||||
)
|
||||
devicesList.add(
|
||||
AccountDeviceModel("sylvain@fedora-linux-38", "03/10/2023", "9h25") {
|
||||
}
|
||||
)
|
||||
devices.postValue(devicesList)
|
||||
|
||||
val prefix = account.params.internationalPrefix
|
||||
|
|
|
|||
|
|
@ -142,11 +142,11 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
|
|||
account.postValue(AccountModel(defaultAccount))
|
||||
}
|
||||
|
||||
defaultAccountChangedEvent.postValue(Event(true))
|
||||
|
||||
updateUnreadMessagesCount()
|
||||
updateMissedCallsCount()
|
||||
updateAvailableMenus()
|
||||
|
||||
defaultAccountChangedEvent.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,12 @@
|
|||
app:constraint_referenced_ids="details_background, sip_address, sip_address_label, display_name, display_name_label, prefix, prefix_caret, prefix_label, prefix_label_tooltip, push_notifications_switch, push_notifications_title"
|
||||
android:visibility="@{viewModel.expandDetails ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="mode_background, current_mode, change_mode"
|
||||
android:visibility="@{viewModel.showModeSelection ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
style="@style/avatar_imageview"
|
||||
android:onClick="@{pickImageClickListener}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue