Fixed account settings back navigation
This commit is contained in:
parent
9802d0a8d8
commit
9a856f075a
4 changed files with 22 additions and 5 deletions
|
@ -34,6 +34,7 @@ import org.linphone.activities.main.contact.fragments.MasterContactsFragment
|
|||
import org.linphone.activities.main.history.fragments.DetailCallLogFragment
|
||||
import org.linphone.activities.main.history.fragments.MasterCallLogsFragment
|
||||
import org.linphone.activities.main.settings.fragments.SettingsFragment
|
||||
import org.linphone.activities.main.sidemenu.fragments.SideMenuFragment
|
||||
import org.linphone.contact.NativeContact
|
||||
import org.linphone.core.Address
|
||||
|
||||
|
@ -150,6 +151,18 @@ internal fun DetailCallLogFragment.navigateToFriend(friendAddress: Address) {
|
|||
|
||||
/* Settings related */
|
||||
|
||||
internal fun SideMenuFragment.navigateToAccountSettings(identity: String) {
|
||||
if (!resources.getBoolean(R.bool.isTablet)) {
|
||||
// If not a tablet, navigate directly to account settings fragment
|
||||
val deepLink = "linphone-android://account-settings/$identity"
|
||||
findNavController().navigate(Uri.parse(deepLink))
|
||||
} else {
|
||||
// On tablet, to keep the categories list on left side, navigate to settings fragment first
|
||||
val deepLink = "linphone-android://settings/$identity"
|
||||
findNavController().navigate(Uri.parse(deepLink))
|
||||
}
|
||||
}
|
||||
|
||||
internal fun SettingsFragment.navigateToAccountSettings(identity: String) {
|
||||
val bundle = bundleOf("Identity" to identity)
|
||||
if (!resources.getBoolean(R.bool.isTablet)) {
|
||||
|
|
|
@ -70,9 +70,10 @@ class SettingsFragment : Fragment() {
|
|||
viewModel.updateAccountsList()
|
||||
})
|
||||
|
||||
val identity = arguments?.getString("identity")
|
||||
val identity = arguments?.getString("Identity")
|
||||
if (identity != null) {
|
||||
Log.i("[Settings] Found identity parameter in arguments: $identity")
|
||||
arguments?.clear()
|
||||
navigateToAccountSettings(identity)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.linphone.activities.main.sidemenu.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -32,6 +31,7 @@ import androidx.navigation.fragment.findNavController
|
|||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
import org.linphone.activities.assistant.AssistantActivity
|
||||
import org.linphone.activities.main.navigateToAccountSettings
|
||||
import org.linphone.activities.main.settings.SettingListenerStub
|
||||
import org.linphone.activities.main.sidemenu.viewmodels.SideMenuViewModel
|
||||
import org.linphone.activities.main.viewmodels.SharedMainViewModel
|
||||
|
@ -77,8 +77,7 @@ class SideMenuFragment : Fragment() {
|
|||
Log.i("[Side Menu] Navigation to settings for proxy with identity: $identity")
|
||||
|
||||
sharedViewModel.toggleDrawerEvent.value = Event(true)
|
||||
val deepLink = "linphone-android://account-settings/$identity"
|
||||
findNavController().navigate(Uri.parse(deepLink))
|
||||
navigateToAccountSettings(identity)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@
|
|||
app:popUpToInclusive="false" />
|
||||
<deepLink
|
||||
android:id="@+id/settingsDeepLink"
|
||||
app:uri="linphone-android://account-settings/{identity}"
|
||||
app:uri="linphone-android://settings/{Identity}"
|
||||
android:autoVerify="true" />
|
||||
</fragment>
|
||||
<action
|
||||
|
@ -296,6 +296,10 @@
|
|||
<action
|
||||
android:id="@+id/action_accountSettingsFragment_to_phoneAccountLinkingFragment"
|
||||
app:destination="@id/phoneAccountLinkingFragment" />
|
||||
<deepLink
|
||||
android:id="@+id/accountSettingsDeepLink"
|
||||
app:uri="linphone-android://account-settings/{Identity}"
|
||||
android:autoVerify="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/advancedSettingsFragment"
|
||||
|
|
Loading…
Reference in a new issue