Skip to content

Commit 049f661

Browse files
committed
more wip
1 parent e092a1b commit 049f661

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

src/components/structures/MatrixChat.tsx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,23 +1380,24 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
13801380
*
13811381
* TODO: fix docs
13821382
*/
1383-
private async showNextPostLoginView(): Promise<void> {
1383+
private async showNextView(): Promise<void> {
13841384
const cli = MatrixClientPeg.safeGet();
13851385

1386+
const forceVerification = SdkConfig.get("force_verification");
1387+
logger.debug(`showNextView: current view=${this.state.view}; force_verification=${forceVerification}`);
1388+
13861389
// First of all, figure out if we need to do some cross-signing setup.
13871390
// Traditionally, we would only do that just after logging in, but with the advent of `force_verification`,
13881391
// we may need to do it on every restart.
13891392
if (
1390-
(this.state.view == Views.LOGIN ||
1391-
this.state.view == Views.REGISTER ||
1392-
SdkConfig.get("force_verification")) &&
1393+
(this.state.view == Views.LOGIN || this.state.view == Views.REGISTER || forceVerification) &&
13931394
!(await shouldSkipSetupEncryption(cli))
13941395
) {
13951396
const crypto = cli.getCrypto()!;
13961397

13971398
// Check if we need to create cross-signing keys for this user.
13981399
if (!(await crypto!.userHasCrossSigningKeys())) {
1399-
logger.info("showNextPostLoginScreen: user lacks cross-signing keys, starting setup");
1400+
logger.info("showNextView: user lacks cross-signing keys, starting setup");
14001401
InitialCryptoSetupStore.sharedInstance().startInitialCryptoSetup(
14011402
cli,
14021403
this.onCompleteSecurityE2eSetupFinished,
@@ -1410,21 +1411,21 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
14101411
ModuleRunner.instance.extensions.cryptoSetup.SHOW_ENCRYPTION_SETUP_UI &&
14111412
(await this.deviceNeedsVerification())
14121413
) {
1413-
logger.info("showNextPostLoginScreen: user must verify device, starting verification");
1414+
logger.info("showNextView: user must verify device, starting verification");
14141415
this.setStateForNewView({ view: Views.COMPLETE_SECURITY });
14151416
return;
14161417
}
14171418
}
14181419

14191420
// We've done the E2E setup stuff, so we can transition to the regular application, with
14201421
// an appropriate screen.
1421-
logger.info("showNextPostLoginScreen: E2E setup done, transitioning to logged in view.");
1422+
logger.info("showNextView: E2E setup done, transitioning to logged in view.");
14221423

14231424
this.setStateForNewView({ view: Views.LOGGED_IN });
14241425
// If a specific screen is set to be shown after login, show that above
14251426
// all else, as it probably means the user clicked on something already.
14261427
if (this.screenAfterLogin?.screen) {
1427-
logger.info(`showNextPostLoginView: showing screen ${this.screenAfterLogin.screen}`);
1428+
logger.info(`showNextView: showing screen ${this.screenAfterLogin.screen}`);
14281429
this.showScreen(this.screenAfterLogin.screen, this.screenAfterLogin.params);
14291430
this.screenAfterLogin = undefined;
14301431
} else if (MatrixClientPeg.currentUserIsJustRegistered()) {
@@ -1433,7 +1434,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
14331434
if (ThreepidInviteStore.instance.pickBestInvite()) {
14341435
// The user has a 3pid invite pending - show them that
14351436
const threepidInvite = ThreepidInviteStore.instance.pickBestInvite();
1436-
logger.info(`showNextPostLoginView: showing room ${threepidInvite.roomId} after registration`);
1437+
logger.info(`showNextView: showing room ${threepidInvite.roomId} after registration`);
14371438

14381439
// HACK: This is a pretty brutal way of threading the invite back through
14391440
// our systems, but it's the safest we have for now.
@@ -1442,11 +1443,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
14421443
} else {
14431444
// The user has just logged in after registering,
14441445
// so show the homepage.
1445-
logger.info("showNextPostLoginView: Showing home page after registration");
1446+
logger.info("showNextView: Showing home page after registration");
14461447
dis.dispatch<ViewHomePagePayload>({ action: Action.ViewHomePage, justRegistered: true });
14471448
}
14481449
} else {
1449-
logger.info("showNextPostLoginView: showScreenAfterLogin");
1450+
logger.info("showNextView: showScreenAfterLogin");
14501451
this.showScreenAfterLogin();
14511452
}
14521453

@@ -1779,7 +1780,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
17791780
ready: true,
17801781
});
17811782

1782-
await this.showNextPostLoginView();
1783+
await this.showNextView();
17831784
}
17841785

17851786
public showScreen(screen: string, params?: { [key: string]: any }): void {
@@ -2083,11 +2084,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
20832084
};
20842085

20852086
/** Called when {@link Views.E2E_SETUP} or {@link Views.COMPLETE_SECURITY} have completed. */
2086-
private onCompleteSecurityE2eSetupFinished(): void {
2087-
this.showNextPostLoginView().catch((e) => {
2087+
private onCompleteSecurityE2eSetupFinished = (): void => {
2088+
this.showNextView().catch((e) => {
20882089
logErrorAndShowErrorDialog("Exception showing post-login screen", e);
20892090
});
2090-
}
2091+
};
20912092

20922093
private getFragmentAfterLogin(): string {
20932094
let fragmentAfterLogin = "";

0 commit comments

Comments
 (0)