mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-05 04:45:14 +01:00
Fix registration resuming.
This commit is contained in:
@@ -62,6 +62,7 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
|
||||
private static final int STATE_TRANSFER_OR_RESTORE = 11;
|
||||
private static final int STATE_RESUME_LINKING_REG = 12;
|
||||
private static final int STATE_CLOCK_SKEW = 13;
|
||||
private static final int STATE_RESUME_REGISTRATION = 14;
|
||||
|
||||
private SignalServiceNetworkAccess networkAccess;
|
||||
private BroadcastReceiver clearKeyReceiver;
|
||||
@@ -162,6 +163,7 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
|
||||
case STATE_TRANSFER_OR_RESTORE: return getTransferOrRestoreIntent();
|
||||
case STATE_RESUME_LINKING_REG: return getResumeLinkedRegistrationIntent();
|
||||
case STATE_CLOCK_SKEW: return getClockSkewIntent();
|
||||
case STATE_RESUME_REGISTRATION: return getResumeRegistrationIntent();
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -177,6 +179,8 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
|
||||
return STATE_WELCOME_PUSH_SCREEN;
|
||||
} else if (shouldResumeLinkingRegistration()) {
|
||||
return STATE_RESUME_LINKING_REG;
|
||||
} else if (shouldResumeRegistration()) {
|
||||
return STATE_RESUME_REGISTRATION;
|
||||
} else if (userCanTransferOrRestore()) {
|
||||
return STATE_TRANSFER_OR_RESTORE;
|
||||
} else if (SignalStore.storageService().getNeedsAccountRestore()) {
|
||||
@@ -211,6 +215,17 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
|
||||
RestoreDecisionStateUtil.isDecisionPending(SignalStore.registration().getRestoreDecisionState());
|
||||
}
|
||||
|
||||
/**
|
||||
* The registration module owns every step of the flow until it marks registration complete, including the steps that
|
||||
* happen after the account itself is registered (restore, PIN). If we come back to a cold start in the middle of that,
|
||||
* hand the user back to the registration module.
|
||||
*/
|
||||
private boolean shouldResumeRegistration() {
|
||||
return Environment.USE_NEW_REGISTRATION &&
|
||||
!SignalStore.registration().isRegistrationComplete() &&
|
||||
SignalStore.registration().getInProgressRegistrationDataBlobUri() != null;
|
||||
}
|
||||
|
||||
private boolean userMustCreateSignalPin() {
|
||||
return !SignalStore.registration().isRegistrationComplete() &&
|
||||
!SignalStore.svr().hasPin() &&
|
||||
@@ -268,6 +283,10 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
|
||||
return getRoutedIntent(intent, MainActivity.clearTop(this));
|
||||
}
|
||||
|
||||
private Intent getResumeRegistrationIntent() {
|
||||
return org.signal.registration.RegistrationActivity.createIntent(this, MainActivity.clearTop(this));
|
||||
}
|
||||
|
||||
private Intent getResumeLinkedRegistrationIntent() {
|
||||
return org.signal.registration.RegistrationActivity.createIntent(this, MainActivity.clearTop(this), RegistrationRoute.MessageSync.INSTANCE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user