mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Protect navigate() calls
This commit is contained in:
parent
6b11e37b14
commit
f48da167ab
10 changed files with 107 additions and 55 deletions
|
|
@ -86,8 +86,11 @@ class LandingFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
binding.setQrCodeClickListener {
|
||||
val action = LandingFragmentDirections.actionLandingFragmentToQrCodeScannerFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.landingFragment) {
|
||||
val action =
|
||||
LandingFragmentDirections.actionLandingFragmentToQrCodeScannerFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setThirdPartySipAccountLoginClickListener {
|
||||
|
|
@ -151,17 +154,21 @@ class LandingFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
private fun goToRegisterFragment() {
|
||||
val action = LandingFragmentDirections.actionLandingFragmentToRegisterFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.landingFragment) {
|
||||
val action = LandingFragmentDirections.actionLandingFragmentToRegisterFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
private fun goToLoginThirdPartySipAccountFragment(skipWarning: Boolean) {
|
||||
val action = if (skipWarning) {
|
||||
LandingFragmentDirections.actionLandingFragmentToThirdPartySipAccountLoginFragment()
|
||||
} else {
|
||||
LandingFragmentDirections.actionLandingFragmentToThirdPartySipAccountWarningFragment()
|
||||
if (findNavController().currentDestination?.id == R.id.landingFragment) {
|
||||
val action = if (skipWarning) {
|
||||
LandingFragmentDirections.actionLandingFragmentToThirdPartySipAccountLoginFragment()
|
||||
} else {
|
||||
LandingFragmentDirections.actionLandingFragmentToThirdPartySipAccountWarningFragment()
|
||||
}
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
private fun showAcceptConditionsAndPrivacyDialog(
|
||||
|
|
|
|||
|
|
@ -156,8 +156,11 @@ class RegisterFragment : GenericFragment() {
|
|||
viewModel.goToSmsCodeConfirmationViewEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG Going to SMS code confirmation fragment")
|
||||
val action = RegisterFragmentDirections.actionRegisterFragmentToRegisterCodeConfirmationFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.registerFragment) {
|
||||
val action =
|
||||
RegisterFragmentDirections.actionRegisterFragmentToRegisterCodeConfirmationFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,11 +135,13 @@ class ThirdPartySipAccountLoginFragment : GenericFragment() {
|
|||
Log.i(
|
||||
"$TAG Navigating to Single Sign On Fragment with server URL [$serverUrl] and username [$username]"
|
||||
)
|
||||
val action = SingleSignOnFragmentDirections.actionGlobalSingleSignOnFragment(
|
||||
serverUrl,
|
||||
username
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.thirdPartySipAccountLoginFragment) {
|
||||
val action = SingleSignOnFragmentDirections.actionGlobalSingleSignOnFragment(
|
||||
serverUrl,
|
||||
username
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,13 +71,19 @@ class ThirdPartySipAccountWarningFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
binding.setCreateAccountClickListener {
|
||||
val action = ThirdPartySipAccountWarningFragmentDirections.actionThirdPartySipAccountWarningFragmentToRegisterFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.thirdPartySipAccountWarningFragment) {
|
||||
val action =
|
||||
ThirdPartySipAccountWarningFragmentDirections.actionThirdPartySipAccountWarningFragmentToRegisterFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setLoginClickListener {
|
||||
val action = ThirdPartySipAccountWarningFragmentDirections.actionThirdPartySipAccountWarningFragmentToThirdPartySipAccountLoginFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.thirdPartySipAccountWarningFragment) {
|
||||
val action =
|
||||
ThirdPartySipAccountWarningFragmentDirections.actionThirdPartySipAccountWarningFragmentToThirdPartySipAccountLoginFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -284,14 +284,20 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
|
|||
|
||||
binding.setCallsListClickListener {
|
||||
Log.i("$TAG Going to calls list fragment")
|
||||
val action = ActiveConferenceCallFragmentDirections.actionActiveConferenceCallFragmentToCallsListFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.activeConferenceCallFragment) {
|
||||
val action =
|
||||
ActiveConferenceCallFragmentDirections.actionActiveConferenceCallFragmentToCallsListFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setParticipantsListClickListener {
|
||||
Log.i("$TAG Going to conference participants list fragment")
|
||||
val action = ActiveConferenceCallFragmentDirections.actionActiveConferenceCallFragmentToConferenceParticipantsListFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.activeConferenceCallFragment) {
|
||||
val action =
|
||||
ActiveConferenceCallFragmentDirections.actionActiveConferenceCallFragmentToConferenceParticipantsListFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setShareConferenceClickListener {
|
||||
|
|
|
|||
|
|
@ -214,18 +214,27 @@ class ActiveCallFragment : GenericCallFragment() {
|
|||
}
|
||||
|
||||
binding.setTransferCallClickListener {
|
||||
val action = ActiveCallFragmentDirections.actionActiveCallFragmentToTransferCallFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.activeCallFragment) {
|
||||
val action =
|
||||
ActiveCallFragmentDirections.actionActiveCallFragmentToTransferCallFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setNewCallClickListener {
|
||||
val action = ActiveCallFragmentDirections.actionActiveCallFragmentToNewCallFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.activeCallFragment) {
|
||||
val action =
|
||||
ActiveCallFragmentDirections.actionActiveCallFragmentToNewCallFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setCallsListClickListener {
|
||||
val action = ActiveCallFragmentDirections.actionActiveCallFragmentToCallsListFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.activeCallFragment) {
|
||||
val action =
|
||||
ActiveCallFragmentDirections.actionActiveCallFragmentToCallsListFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setCallStatisticsClickListener {
|
||||
|
|
|
|||
|
|
@ -69,8 +69,10 @@ class HelpFragment : GenericMainFragment() {
|
|||
}
|
||||
|
||||
binding.setDebugClickListener {
|
||||
val action = HelpFragmentDirections.actionHelpFragmentToDebugFragment()
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.helpFragment) {
|
||||
val action = HelpFragmentDirections.actionHelpFragmentToDebugFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
binding.setPrivacyPolicyClickListener {
|
||||
|
|
|
|||
|
|
@ -127,10 +127,13 @@ class MeetingFragment : SlidingPaneChildFragment() {
|
|||
Log.i(
|
||||
"$TAG Navigating to meeting edit fragment with conference URI [$conferenceUri]"
|
||||
)
|
||||
val action = MeetingFragmentDirections.actionMeetingFragmentToEditMeetingFragment(
|
||||
conferenceUri
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.meetingFragment) {
|
||||
val action =
|
||||
MeetingFragmentDirections.actionMeetingFragmentToEditMeetingFragment(
|
||||
conferenceUri
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,9 +143,11 @@ class MeetingsListFragment : AbstractMainFragment() {
|
|||
Log.w("$TAG Meeting with ID [${model.id}] is cancelled, can't show the details")
|
||||
} else {
|
||||
Log.i("$TAG Show meeting with ID [${model.id}]")
|
||||
sharedViewModel.displayedMeeting = model.conferenceInfo
|
||||
val action = MeetingFragmentDirections.actionGlobalMeetingFragment(model.id)
|
||||
binding.meetingsNavContainer.findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.meetingsListFragment) {
|
||||
sharedViewModel.displayedMeeting = model.conferenceInfo
|
||||
val action = MeetingFragmentDirections.actionGlobalMeetingFragment(model.id)
|
||||
binding.meetingsNavContainer.findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,37 +155,49 @@ class SettingsFragment : GenericMainFragment() {
|
|||
|
||||
viewModel.addLdapServerEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToLdapServerConfigurationFragment(
|
||||
null
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.settingsFragment) {
|
||||
val action =
|
||||
SettingsFragmentDirections.actionSettingsFragmentToLdapServerConfigurationFragment(
|
||||
null
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.editLdapServerEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { name ->
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToLdapServerConfigurationFragment(
|
||||
name
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.settingsFragment) {
|
||||
val action =
|
||||
SettingsFragmentDirections.actionSettingsFragmentToLdapServerConfigurationFragment(
|
||||
name
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.addCardDavServerEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToCardDavAddressBookConfigurationFragment(
|
||||
null
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.settingsFragment) {
|
||||
val action =
|
||||
SettingsFragmentDirections.actionSettingsFragmentToCardDavAddressBookConfigurationFragment(
|
||||
null
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.editCardDavServerEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { name ->
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToCardDavAddressBookConfigurationFragment(
|
||||
name
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
if (findNavController().currentDestination?.id == R.id.settingsFragment) {
|
||||
val action =
|
||||
SettingsFragmentDirections.actionSettingsFragmentToCardDavAddressBookConfigurationFragment(
|
||||
name
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue