Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWN-8923 - striga clean phone when country changed #1866

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
c308f67
PWN-8946 - striga bugfixes
eduardmaximovich Jun 15, 2023
6e3e36c
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 16, 2023
ad12d42
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 16, 2023
f14c28f
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 19, 2023
ef5cd79
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 19, 2023
1309c4a
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 20, 2023
e392a57
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 20, 2023
e213009
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 20, 2023
b932f13
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 20, 2023
cd2ee40
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 21, 2023
a526f32
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 21, 2023
88b03fa
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 21, 2023
1710190
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into dev…
eduardmaximovich Jun 21, 2023
348ff7f
PWN-8923 - striga. clean phone number when phone country is changed
eduardmaximovich Jun 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface StrigaSignUpFirstStepContract {
fun onCountryOfBirthClicked()
fun saveChanges()
fun onSubmit()
fun onPhoneCountryCodeChanged(newCountry: CountryCode)
fun onPhoneCountryCodeChanged(newCountry: CountryCode, changedByUser: Boolean)
fun onPhoneNumberChanged(newPhone: String)
fun onPhoneCountryCodeClicked()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class StrigaSignUpFirstStepFragment :
}
bundle.containsKey(RESULT_KEY_PHONE_COUNTRY_CODE) -> {
val countryCode = bundle.getParcelableCompat<CountryCode>(RESULT_KEY_PHONE_COUNTRY_CODE) ?: return
presenter.onPhoneCountryCodeChanged(countryCode)
presenter.onPhoneCountryCodeChanged(countryCode, changedByUser = true)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class StrigaSignUpFirstStepPresenter(
}
}

override fun onPhoneCountryCodeChanged(newCountry: CountryCode) {
override fun onPhoneCountryCodeChanged(newCountry: CountryCode, changedByUser: Boolean) {
phoneCountryCode = newCountry
view?.showPhoneCountryCode(phoneCountryCode)

Expand All @@ -103,6 +103,10 @@ class StrigaSignUpFirstStepPresenter(
countryCodeRepository = countryRepository
)
)

if (changedByUser) {
view?.updateSignupField(StrigaSignupDataType.PHONE_NUMBER, "")
}
}

override fun onPhoneNumberChanged(newPhone: String) {
Expand Down Expand Up @@ -156,7 +160,7 @@ class StrigaSignUpFirstStepPresenter(
cachedPhoneNumber = signupData[StrigaSignupDataType.PHONE_NUMBER]?.value
)

onPhoneCountryCodeChanged(phoneNumberWithCode.phoneCode)
onPhoneCountryCodeChanged(phoneNumberWithCode.phoneCode, false)

// Using the updated phoneCode and selectedPhoneNumber
view?.setupPhoneCountryCodePicker(
Expand All @@ -180,7 +184,7 @@ class StrigaSignUpFirstStepPresenter(

signupData[StrigaSignupDataType.PHONE_CODE_WITH_PLUS]?.value?.let {
val phoneCountryCode = countryRepository.findCountryCodeByPhoneCode(it)
phoneCountryCode?.let(::onPhoneCountryCodeChanged)
phoneCountryCode?.let { countryCode -> onPhoneCountryCodeChanged(countryCode, false) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ class StrigaSignupFirstStepPresenterTest {
presenter.attach(view)
interactor.setPhoneValidator(PhoneNumberInputValidator("90", countryCodeRepository))
presenter.onPhoneCountryCodeChanged(
CountryCode("tr", "tur", "90", "Turkey", ",")
CountryCode("tr", "tur", "90", "Turkey", ","),
true
)
presenter.onPhoneNumberChanged("5556667788")
presenter.onFieldChanged(StrigaSignupDataType.PHONE_CODE_WITH_PLUS, "+90")
Expand Down Expand Up @@ -396,7 +397,7 @@ class StrigaSignupFirstStepPresenterTest {
verify(exactly = 1) { view.showPhoneCountryCodePicker(TurkeyCountry) }

advanceUntilIdle()
presenter.onPhoneCountryCodeChanged(TurkeyCountry)
presenter.onPhoneCountryCodeChanged(TurkeyCountry, true)
verify { view.showPhoneCountryCode(TurkeyCountry) }

presenter.detach()
Expand Down
Loading