Ensure that we can still navigate when we get a response from server.

This commit is contained in:
Alan Evans
2019-11-08 11:19:57 -05:00
committed by GitHub
parent 5d87ad0301
commit 17f850b31a

View File

@@ -218,6 +218,10 @@ public final class EnterPhoneNumberFragment extends BaseRegistrationFragment {
@Override
public void onNeedCaptcha() {
if (getContext() == null) {
Log.i(TAG, "Got onNeedCaptcha response, but fragment is no longer attached.");
return;
}
navController.navigate(EnterPhoneNumberFragmentDirections.actionRequestCaptcha());
cancelSpinning(register);
enableAllEntries();
@@ -227,6 +231,10 @@ public final class EnterPhoneNumberFragment extends BaseRegistrationFragment {
@Override
public void requestSent(@Nullable String fcmToken) {
if (getContext() == null) {
Log.i(TAG, "Got requestSent response, but fragment is no longer attached.");
return;
}
model.setFcmToken(fcmToken);
model.markASuccessfulAttempt();
navController.navigate(EnterPhoneNumberFragmentDirections.actionEnterVerificationCode());