require a flag to enable account setup during login

as it blocks login from progressing, any sdk usage should enable
to indicate they are listening for the AccountSetup status.
This commit is contained in:
Bruno Windels 2021-11-03 02:28:01 +01:00
parent bffe34fe0a
commit 790b9cbc13
2 changed files with 8 additions and 5 deletions

View file

@ -107,7 +107,7 @@ export class LoginViewModel extends ViewModel {
async attemptLogin(loginMethod) { async attemptLogin(loginMethod) {
this._setBusy(true); this._setBusy(true);
this._sessionContainer.startWithLogin(loginMethod); this._sessionContainer.startWithLogin(loginMethod, {inspectAccountSetup: true});
const loadStatus = this._sessionContainer.loadStatus; const loadStatus = this._sessionContainer.loadStatus;
const handle = loadStatus.waitFor(status => status !== LoadStatus.Login); const handle = loadStatus.waitFor(status => status !== LoadStatus.Login);
await handle.promise; await handle.promise;

View file

@ -131,7 +131,7 @@ export class SessionContainer {
}); });
} }
async startWithLogin(loginMethod) { async startWithLogin(loginMethod, {inspectAccountSetup} = {}) {
const currentStatus = this._status.get(); const currentStatus = this._status.get();
if (currentStatus !== LoadStatus.LoginFailed && if (currentStatus !== LoadStatus.LoginFailed &&
currentStatus !== LoadStatus.NotLoading && currentStatus !== LoadStatus.NotLoading &&
@ -176,9 +176,12 @@ export class SessionContainer {
} }
return; return;
} }
const dehydratedDevice = await this._inspectAccountAfterLogin(sessionInfo, log); let dehydratedDevice;
if (dehydratedDevice) { if (inspectAccountSetup) {
sessionInfo.deviceId = dehydratedDevice.deviceId; dehydratedDevice = await this._inspectAccountAfterLogin(sessionInfo, log);
if (dehydratedDevice) {
sessionInfo.deviceId = dehydratedDevice.deviceId;
}
} }
await this._platform.sessionInfoStorage.add(sessionInfo); await this._platform.sessionInfoStorage.add(sessionInfo);
// loading the session can only lead to // loading the session can only lead to