Compare commits

...

2 Commits

Author SHA1 Message Date
Alex Hart
38ed75fb64 Bump version to 7.74.4 2026-02-19 11:02:47 -04:00
Alex Hart
26ab20f860 Fix possible captcha race. 2026-02-19 10:53:59 -04:00
3 changed files with 22 additions and 5 deletions

View File

@@ -31,8 +31,8 @@ plugins {
apply(from = "static-ips.gradle.kts")
val canonicalVersionCode = 1651
val canonicalVersionName = "7.74.3"
val currentHotfixVersion = 0
val canonicalVersionName = "7.74.4"
val currentHotfixVersion = 1
val maxHotfixVersions = 100
// We don't want versions to ever end in 0 so that they don't conflict with nightly versions

View File

@@ -458,8 +458,8 @@ class RegistrationViewModel : ViewModel() {
}
fun submitCaptchaToken(context: Context) {
val e164 = getCurrentE164() ?: throw IllegalStateException("Can't submit captcha token if no phone number is set!")
val captchaToken = store.value.captchaToken ?: throw IllegalStateException("Can't submit captcha token if no captcha token is set!")
val e164 = getCurrentE164() ?: return clearChallengesAndBail { Log.w(TAG, "Phone number was null when trying to submit captcha token.") }
val captchaToken = store.value.captchaToken ?: return bail { Log.w(TAG, "Captcha token was null when trying to submit captcha token.") }
store.update {
it.copy(captchaToken = null, challengeInProgress = true, inProgress = true)
@@ -486,7 +486,7 @@ class RegistrationViewModel : ViewModel() {
fun requestAndSubmitPushToken(context: Context) {
Log.v(TAG, "validatePushToken()")
val e164 = getCurrentE164() ?: throw IllegalStateException("Can't submit captcha token if no phone number is set!")
val e164 = getCurrentE164() ?: return clearChallengesAndBail { Log.w(TAG, "Phone number was null when trying to submit push token.") }
viewModelScope.launch {
Log.d(TAG, "Getting session in order to perform push token verification…")
@@ -1063,6 +1063,22 @@ class RegistrationViewModel : ViewModel() {
setInProgress(false)
}
/**
* Like [bail], but also clears challenge state. This is needed when challenge handling fails due to missing phone number,
* since otherwise the stale challenges would re-trigger the observer on every config change.
*/
private fun clearChallengesAndBail(logMessage: () -> Unit) {
logMessage()
store.update {
it.copy(
inProgress = false,
challengesRequested = emptyList(),
challengeInProgress = false,
captchaToken = null
)
}
}
fun registerWithBackupKey(context: Context, backupKey: String, e164: String?, pin: String?, aciIdentityKeyPair: IdentityKeyPair?, pniIdentityKeyPair: IdentityKeyPair?) {
setInProgress(true)

View File

@@ -600,6 +600,7 @@ class EnterPhoneNumberFragment : LoggingFragment(R.layout.fragment_registration_
private fun updateEnabledControls(showProgress: Boolean, isReRegister: Boolean) {
binding.countryCode.isEnabled = !showProgress
binding.number.isEnabled = !showProgress
countryPickerView.isEnabled = !showProgress
binding.cancelButton.visible = !showProgress && isReRegister
}