@@ -867,20 +867,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
867867 Modal . createDialog ( DialPadModal , { } , "mx_Dialog_dialPadWrapper" ) ;
868868 break ;
869869 case Action . OnLoggedIn :
870- this . stores . client = MatrixClientPeg . safeGet ( ) ;
871- StorageManager . tryPersistStorage ( ) ;
872-
873- if (
874- // Skip this handling for token login as that always calls onShowPostLoginScreen itself
875- ! this . tokenLogin &&
876- ! Lifecycle . isSoftLogout ( ) &&
877- this . state . view !== Views . LOGIN &&
878- this . state . view !== Views . REGISTER &&
879- this . state . view !== Views . COMPLETE_SECURITY &&
880- this . state . view !== Views . E2E_SETUP
881- ) {
882- this . onShowPostLoginScreen ( ) ;
883- }
870+ this . onLoggedIn ( ) ;
884871 break ;
885872 case Action . ClientNotViable :
886873 this . onSoftLogout ( ) ;
@@ -1512,6 +1499,28 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
15121499 } ) ;
15131500 }
15141501
1502+ /**
1503+ * Handle an {@link Action.OnLoggedIn} action (i.e, we now have a client with working credentials).
1504+ */
1505+ private onLoggedIn ( ) : void {
1506+ this . stores . client = MatrixClientPeg . safeGet ( ) ;
1507+ StorageManager . tryPersistStorage ( ) ;
1508+
1509+ // If we're in the middle of a login/registration, we wait for it to complete before transitioning to the logged
1510+ // in view the login flow will call `postLoginSetup` when it's done, which will arrange for `onShowPostLoginScreen`
1511+ // to be called.
1512+ if (
1513+ ! this . tokenLogin &&
1514+ ! Lifecycle . isSoftLogout ( ) &&
1515+ this . state . view !== Views . LOGIN &&
1516+ this . state . view !== Views . REGISTER &&
1517+ this . state . view !== Views . COMPLETE_SECURITY &&
1518+ this . state . view !== Views . E2E_SETUP
1519+ ) {
1520+ this . onShowPostLoginScreen ( ) ;
1521+ }
1522+ }
1523+
15151524 /**
15161525 * Called when the session is logged out
15171526 */
0 commit comments