Update country name when prefix is manually changed
This commit is contained in:
parent
d623b597b5
commit
0ee446ffce
4 changed files with 13 additions and 1 deletions
|
@ -75,6 +75,10 @@ class AccountLoginFragment : AbstractPhoneFragment<AssistantAccountLoginFragment
|
|||
startActivity(intent)
|
||||
}
|
||||
|
||||
viewModel.prefix.observe(viewLifecycleOwner) { internationalPrefix ->
|
||||
viewModel.getCountryNameFromPrefix(internationalPrefix)
|
||||
}
|
||||
|
||||
viewModel.goToSmsValidationEvent.observe(
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
|
|
|
@ -62,6 +62,10 @@ class PhoneAccountCreationFragment :
|
|||
countryPickerFragment.show(childFragmentManager, "CountryPicker")
|
||||
}
|
||||
|
||||
viewModel.prefix.observe(viewLifecycleOwner) { internationalPrefix ->
|
||||
viewModel.getCountryNameFromPrefix(internationalPrefix)
|
||||
}
|
||||
|
||||
viewModel.goToSmsValidationEvent.observe(
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
|
|
|
@ -73,6 +73,10 @@ class PhoneAccountLinkingFragment : AbstractPhoneFragment<AssistantPhoneAccountL
|
|||
countryPickerFragment.show(childFragmentManager, "CountryPicker")
|
||||
}
|
||||
|
||||
viewModel.prefix.observe(viewLifecycleOwner) { internationalPrefix ->
|
||||
viewModel.getCountryNameFromPrefix(internationalPrefix)
|
||||
}
|
||||
|
||||
viewModel.goToSmsValidationEvent.observe(
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
|
|
|
@ -69,7 +69,7 @@ abstract class AbstractPhoneViewModel(accountCreator: AccountCreator) :
|
|||
}
|
||||
}
|
||||
|
||||
private fun getCountryNameFromPrefix(prefix: String?) {
|
||||
fun getCountryNameFromPrefix(prefix: String?) {
|
||||
if (!prefix.isNullOrEmpty()) {
|
||||
val countryCode = if (prefix.first() == '+') prefix.substring(1) else prefix
|
||||
val dialPlan = PhoneNumberUtils.getDialPlanFromCountryCallingPrefix(countryCode)
|
||||
|
|
Loading…
Reference in a new issue