Skip to content

Commit 30267c6

Browse files
committed
Go back to registration pin entry when SVR server returns an unknown error
1 parent c023473 commit 30267c6

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

Signal/Registration/RegistrationCoordinatorImpl.swift

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,21 @@ public class RegistrationCoordinatorImpl: RegistrationCoordinator {
15601560
}
15611561
return .value(.showErrorSheet(.networkError))
15621562
case .genericError:
1563-
return .value(.showErrorSheet(.genericError))
1563+
if retriesLeft > 0 {
1564+
return self.restoreSVRMasterSecretForAuthCredentialPath(
1565+
pin: pin,
1566+
credential: credential,
1567+
retriesLeft: retriesLeft - 1
1568+
)
1569+
} else {
1570+
self.inMemoryState.pinFromUser = nil
1571+
return .value(.pinEntry(RegistrationPinState(
1572+
operation: .enteringExistingPin(skippability: .canSkip, remainingAttempts: nil),
1573+
error: .serverError,
1574+
contactSupportMode: self.contactSupportRegistrationPINMode(),
1575+
exitConfiguration: pinCodeEntryExitConfiguration()
1576+
)))
1577+
}
15641578
}
15651579
}
15661580
}
@@ -2956,8 +2970,24 @@ public class RegistrationCoordinatorImpl: RegistrationCoordinator {
29562970
case .genericError(let error):
29572971
if error.isPostRegDeregisteredError {
29582972
return self.becameDeregisteredBeforeCompleting(accountIdentity: accountIdentity)
2973+
} else if retriesLeft > 0 {
2974+
return self.restoreSVRBackupPostRegistration(
2975+
pin: pin,
2976+
accountIdentity: accountIdentity,
2977+
retriesLeft: retriesLeft - 1
2978+
)
2979+
} else {
2980+
self.inMemoryState.pinFromUser = nil
2981+
return .value(.pinEntry(RegistrationPinState(
2982+
operation: .enteringExistingPin(
2983+
skippability: .canSkipAndCreateNew,
2984+
remainingAttempts: nil
2985+
),
2986+
error: .serverError,
2987+
contactSupportMode: self.contactSupportRegistrationPINMode(),
2988+
exitConfiguration: self.pinCodeEntryExitConfiguration()
2989+
)))
29592990
}
2960-
return .value(.showErrorSheet(.genericError))
29612991
}
29622992
}
29632993
}

Signal/Registration/UserInterface/RegistrationPinViewController.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public struct RegistrationPinConfirmationBlob: Equatable {
2929

3030
public enum RegistrationPinValidationError: Equatable {
3131
case wrongPin(wrongPin: String)
32+
case serverError
3233
}
3334

3435
// MARK: - RegistrationPinState
@@ -525,6 +526,12 @@ class RegistrationPinViewController: OWSViewController {
525526
)
526527
}
527528
newViewsAtTheBottom.append(pinValidationLabel)
529+
case .serverError:
530+
pinValidationLabel.text = OWSLocalizedString(
531+
"SOMETHING_WENT_WRONG_TRY_AGAIN_LATER_ERROR",
532+
comment: "An error message generically indicating that something went wrong, and that the user should try again later."
533+
)
534+
newViewsAtTheBottom.append(pinValidationLabel)
528535
}
529536
pinValidationLabel.textColor = .ows_accentRed
530537

0 commit comments

Comments
 (0)