Add mobile registration and dispatch event for mobile postmessage dance
This commit is contained in:
parent
eae9d9e248
commit
a6dec86374
5 changed files with 79 additions and 19 deletions
|
@ -140,7 +140,7 @@ import { cleanUpDraftsIfRequired } from "../../DraftCleaner";
|
|||
// legacy export
|
||||
export { default as Views } from "../../Views";
|
||||
|
||||
const AUTH_SCREENS = ["register", "login", "forgot_password", "start_sso", "start_cas", "welcome"];
|
||||
const AUTH_SCREENS = ["register", "mobile_register", "login", "forgot_password", "start_sso", "start_cas", "welcome"];
|
||||
|
||||
// Actions that are redirected through the onboarding process prior to being
|
||||
// re-dispatched. NOTE: some actions are non-trivial and would require
|
||||
|
@ -189,6 +189,7 @@ interface IState {
|
|||
register_session_id?: string;
|
||||
// eslint-disable-next-line camelcase
|
||||
register_id_sid?: string;
|
||||
isMobileRegistration?: boolean;
|
||||
// When showing Modal dialogs we need to set aria-hidden on the root app element
|
||||
// and disable it when there are no dialogs
|
||||
hideToSRUsers: boolean;
|
||||
|
@ -243,6 +244,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
currentUserId: null,
|
||||
|
||||
hideToSRUsers: false,
|
||||
isMobileRegistration: false,
|
||||
|
||||
syncError: null, // If the current syncing status is ERROR, the error object, otherwise null.
|
||||
resizeNotifier: new ResizeNotifier(),
|
||||
|
@ -650,6 +652,9 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
case "require_registration":
|
||||
startAnyRegistrationFlow(payload as any);
|
||||
break;
|
||||
case "start_mobile_registration":
|
||||
this.startRegistration(payload.params || {}, true);
|
||||
break;
|
||||
case "start_registration":
|
||||
if (Lifecycle.isSoftLogout()) {
|
||||
this.onSoftLogout();
|
||||
|
@ -946,7 +951,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
});
|
||||
}
|
||||
|
||||
private async startRegistration(params: { [key: string]: string }): Promise<void> {
|
||||
private async startRegistration(params: { [key: string]: string }, isMobileRegistration?: boolean): Promise<void> {
|
||||
if (!SettingsStore.getValue(UIFeature.Registration)) {
|
||||
this.showScreen("welcome");
|
||||
return;
|
||||
|
@ -976,12 +981,15 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
newState.register_client_secret = params.client_secret;
|
||||
newState.register_session_id = params.session_id;
|
||||
newState.register_id_sid = params.sid;
|
||||
newState.register_id_sid = params.sid;
|
||||
}
|
||||
|
||||
newState.isMobileRegistration = isMobileRegistration; //&& SettingsStore.getValue("Registration.mobileRegistrationHelper");
|
||||
|
||||
this.setStateForNewView(newState);
|
||||
ThemeController.isLogin = true;
|
||||
this.themeWatcher.recheck();
|
||||
this.notifyNewScreen("register");
|
||||
this.notifyNewScreen(isMobileRegistration ? "mobile_register" : "register");
|
||||
}
|
||||
|
||||
// switch view to the given room
|
||||
|
@ -1721,6 +1729,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
params: params,
|
||||
});
|
||||
PerformanceMonitor.instance.start(PerformanceEntryNames.REGISTER);
|
||||
} else if (screen === "mobile_register") {
|
||||
dis.dispatch({
|
||||
action: "start_mobile_registration",
|
||||
params: params,
|
||||
});
|
||||
} else if (screen === "login") {
|
||||
dis.dispatch({
|
||||
action: "start_login",
|
||||
|
@ -2080,6 +2093,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
onServerConfigChange={this.onServerConfigChange}
|
||||
defaultDeviceDisplayName={this.props.defaultDeviceDisplayName}
|
||||
fragmentAfterLogin={fragmentAfterLogin}
|
||||
mobileRegister={this.state.isMobileRegistration}
|
||||
{...this.getServerProperties()}
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue