More specific type definition and adhering to code style better

pull/21833/head
Germain Souquet 2021-06-18 12:44:15 +01:00
parent 3f1ca970d6
commit d22617c422
13 changed files with 66 additions and 72 deletions

View File

@ -59,7 +59,7 @@ import IconizedContextMenu, {
} from "../views/context_menus/IconizedContextMenu"; } from "../views/context_menus/IconizedContextMenu";
import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton"; import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton";
import {BetaPill} from "../views/beta/BetaCard"; import {BetaPill} from "../views/beta/BetaCard";
import { USER_TAB } from "../views/dialogs/UserSettingsDialog"; import { UserTab } from "../views/dialogs/UserSettingsDialog";
import SettingsStore from "../../settings/SettingsStore"; import SettingsStore from "../../settings/SettingsStore";
import dis from "../../dispatcher/dispatcher"; import dis from "../../dispatcher/dispatcher";
import Modal from "../../Modal"; import Modal from "../../Modal";
@ -166,7 +166,7 @@ const SpaceInfo = ({ space }) => {
const onBetaClick = () => { const onBetaClick = () => {
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
action: Action.ViewUserSettings, action: Action.ViewUserSettings,
initialTabId: USER_TAB.LABS, initialTabId: UserTab.Labs,
}); });
}; };

View File

@ -26,7 +26,7 @@ import { ActionPayload } from "../../dispatcher/payloads";
import { Action } from "../../dispatcher/actions"; import { Action } from "../../dispatcher/actions";
import { _t } from "../../languageHandler"; import { _t } from "../../languageHandler";
import { ContextMenuButton } from "./ContextMenu"; import { ContextMenuButton } from "./ContextMenu";
import { USER_TAB } from "../views/dialogs/UserSettingsDialog"; import { UserTab } from "../views/dialogs/UserSettingsDialog";
import { OpenToTabPayload } from "../../dispatcher/payloads/OpenToTabPayload"; import { OpenToTabPayload } from "../../dispatcher/payloads/OpenToTabPayload";
import FeedbackDialog from "../views/dialogs/FeedbackDialog"; import FeedbackDialog from "../views/dialogs/FeedbackDialog";
import Modal from "../../Modal"; import Modal from "../../Modal";
@ -408,12 +408,12 @@ export default class UserMenu extends React.Component<IProps, IState> {
<IconizedContextMenuOption <IconizedContextMenuOption
iconClassName="mx_UserMenu_iconBell" iconClassName="mx_UserMenu_iconBell"
label={_t("Notification settings")} label={_t("Notification settings")}
onClick={(e) => this.onSettingsOpen(e, USER_TAB.NOTIFICATIONS)} onClick={(e) => this.onSettingsOpen(e, UserTab.Notifications)}
/> />
<IconizedContextMenuOption <IconizedContextMenuOption
iconClassName="mx_UserMenu_iconLock" iconClassName="mx_UserMenu_iconLock"
label={_t("Security & privacy")} label={_t("Security & privacy")}
onClick={(e) => this.onSettingsOpen(e, USER_TAB.SECURITY)} onClick={(e) => this.onSettingsOpen(e, UserTab.Security)}
/> />
<IconizedContextMenuOption <IconizedContextMenuOption
iconClassName="mx_UserMenu_iconSettings" iconClassName="mx_UserMenu_iconSettings"

View File

@ -269,7 +269,7 @@ export default class Registration extends React.Component<IProps, IState> {
); );
} }
private onUIAuthFinished = async (success, response) => { private onUIAuthFinished = async (success: boolean, response: any) => {
if (!success) { if (!success) {
let msg = response.message || response.toString(); let msg = response.message || response.toString();
// can we give a better error message? // can we give a better error message?

View File

@ -29,7 +29,7 @@ import InfoDialog from "./InfoDialog";
import AccessibleButton from "../elements/AccessibleButton"; import AccessibleButton from "../elements/AccessibleButton";
import defaultDispatcher from "../../../dispatcher/dispatcher"; import defaultDispatcher from "../../../dispatcher/dispatcher";
import {Action} from "../../../dispatcher/actions"; import {Action} from "../../../dispatcher/actions";
import { USER_TAB } from "./UserSettingsDialog"; import { UserTab } from "./UserSettingsDialog";
interface IProps extends IDialogProps { interface IProps extends IDialogProps {
featureId: string; featureId: string;
@ -70,7 +70,7 @@ const BetaFeedbackDialog: React.FC<IProps> = ({featureId, onFinished}) => {
onFinished(false); onFinished(false);
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
action: Action.ViewUserSettings, action: Action.ViewUserSettings,
initialTabId: USER_TAB.LABS, initialTabId: UserTab.Labs,
}); });
}}> }}>
{ _t("To leave the beta, visit your settings.") } { _t("To leave the beta, visit your settings.") }

View File

@ -58,12 +58,6 @@ export default class ConfirmUserActionDialog extends React.Component<IProps> {
askReason: false, askReason: false,
}; };
constructor(props) {
super(props);
this.reasonField = null;
}
public onOk = (): void => { public onOk = (): void => {
let reason; let reason;
if (this.reasonField) { if (this.reasonField) {

View File

@ -115,7 +115,7 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
this.setState({errStr: _t("There was a problem communicating with the server. Please try again.")}); this.setState({errStr: _t("There was a problem communicating with the server. Please try again.")});
}; };
private onUIAuthComplete = (auth): void => { private onUIAuthComplete = (auth: any): void => {
MatrixClientPeg.get().deactivateAccount(auth, this.state.shouldErase).then(r => { MatrixClientPeg.get().deactivateAccount(auth, this.state.shouldErase).then(r => {
// Deactivation worked - logout & close this dialog // Deactivation worked - logout & close this dialog
Analytics.trackEvent('Account', 'Deactivate Account'); Analytics.trackEvent('Account', 'Deactivate Account');

View File

@ -19,7 +19,7 @@ import React from 'react';
import TabbedView, {Tab} from "../../structures/TabbedView"; import TabbedView, {Tab} from "../../structures/TabbedView";
import {_t, _td} from "../../../languageHandler"; import {_t, _td} from "../../../languageHandler";
import GeneralUserSettingsTab from "../settings/tabs/user/GeneralUserSettingsTab"; import GeneralUserSettingsTab from "../settings/tabs/user/GeneralUserSettingsTab";
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore, { CallbackFn } from "../../../settings/SettingsStore";
import LabsUserSettingsTab from "../settings/tabs/user/LabsUserSettingsTab"; import LabsUserSettingsTab from "../settings/tabs/user/LabsUserSettingsTab";
import AppearanceUserSettingsTab from "../settings/tabs/user/AppearanceUserSettingsTab"; import AppearanceUserSettingsTab from "../settings/tabs/user/AppearanceUserSettingsTab";
import SecurityUserSettingsTab from "../settings/tabs/user/SecurityUserSettingsTab"; import SecurityUserSettingsTab from "../settings/tabs/user/SecurityUserSettingsTab";
@ -34,17 +34,17 @@ import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab
import {UIFeature} from "../../../settings/UIFeature"; import {UIFeature} from "../../../settings/UIFeature";
import {replaceableComponent} from "../../../utils/replaceableComponent"; import {replaceableComponent} from "../../../utils/replaceableComponent";
export enum USER_TAB { export enum UserTab {
GENERAL = "USER_GENERAL_TAB", General = "USER_GENERAL_TAB",
APPEARANCE = "USER_APPEARANCE_TAB", Appearance = "USER_APPEARANCE_TAB",
FLAIR = "USER_FLAIR_TAB", Flair = "USER_FLAIR_TAB",
NOTIFICATIONS = "USER_NOTIFICATIONS_TAB", Notifications = "USER_NOTIFICATIONS_TAB",
PREFERENCES = "USER_PREFERENCES_TAB", Preferences = "USER_PREFERENCES_TAB",
VOICE = "USER_VOICE_TAB", Voice = "USER_VOICE_TAB",
SECURITY = "USER_SECURITY_TAB", Security = "USER_SECURITY_TAB",
LABS = "USER_LABS_TAB", Labs = "USER_LABS_TAB",
MJOLNIR = "USER_MJOLNIR_TAB", Mjolnir = "USER_MJOLNIR_TAB",
HELP = "USER_HELP_TAB", Help = "USER_HELP_TAB",
} }
interface IProps { interface IProps {
@ -76,7 +76,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
SettingsStore.unwatchSetting(this.mjolnirWatcher); SettingsStore.unwatchSetting(this.mjolnirWatcher);
} }
private mjolnirChanged = (settingName, roomId, atLevel, newValue: boolean) => { private mjolnirChanged: CallbackFn = (settingName, roomId, atLevel, newValue) => {
// We can cheat because we know what levels a feature is tracked at, and how it is tracked // We can cheat because we know what levels a feature is tracked at, and how it is tracked
this.setState({mjolnirEnabled: newValue}); this.setState({mjolnirEnabled: newValue});
} }
@ -85,33 +85,33 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
const tabs = []; const tabs = [];
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.GENERAL, UserTab.General,
_td("General"), _td("General"),
"mx_UserSettingsDialog_settingsIcon", "mx_UserSettingsDialog_settingsIcon",
<GeneralUserSettingsTab closeSettingsFn={this.props.onFinished} />, <GeneralUserSettingsTab closeSettingsFn={this.props.onFinished} />,
)); ));
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.APPEARANCE, UserTab.Appearance,
_td("Appearance"), _td("Appearance"),
"mx_UserSettingsDialog_appearanceIcon", "mx_UserSettingsDialog_appearanceIcon",
<AppearanceUserSettingsTab />, <AppearanceUserSettingsTab />,
)); ));
if (SettingsStore.getValue(UIFeature.Flair)) { if (SettingsStore.getValue(UIFeature.Flair)) {
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.FLAIR, UserTab.Flair,
_td("Flair"), _td("Flair"),
"mx_UserSettingsDialog_flairIcon", "mx_UserSettingsDialog_flairIcon",
<FlairUserSettingsTab />, <FlairUserSettingsTab />,
)); ));
} }
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.NOTIFICATIONS, UserTab.Notifications,
_td("Notifications"), _td("Notifications"),
"mx_UserSettingsDialog_bellIcon", "mx_UserSettingsDialog_bellIcon",
<NotificationUserSettingsTab />, <NotificationUserSettingsTab />,
)); ));
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.PREFERENCES, UserTab.Preferences,
_td("Preferences"), _td("Preferences"),
"mx_UserSettingsDialog_preferencesIcon", "mx_UserSettingsDialog_preferencesIcon",
<PreferencesUserSettingsTab />, <PreferencesUserSettingsTab />,
@ -119,7 +119,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
if (SettingsStore.getValue(UIFeature.Voip)) { if (SettingsStore.getValue(UIFeature.Voip)) {
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.VOICE, UserTab.Voice,
_td("Voice & Video"), _td("Voice & Video"),
"mx_UserSettingsDialog_voiceIcon", "mx_UserSettingsDialog_voiceIcon",
<VoiceUserSettingsTab />, <VoiceUserSettingsTab />,
@ -127,7 +127,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
} }
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.SECURITY, UserTab.Security,
_td("Security & Privacy"), _td("Security & Privacy"),
"mx_UserSettingsDialog_securityIcon", "mx_UserSettingsDialog_securityIcon",
<SecurityUserSettingsTab closeSettingsFn={this.props.onFinished} />, <SecurityUserSettingsTab closeSettingsFn={this.props.onFinished} />,
@ -137,7 +137,7 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
|| SettingsStore.getFeatureSettingNames().some(k => SettingsStore.getBetaInfo(k)) || SettingsStore.getFeatureSettingNames().some(k => SettingsStore.getBetaInfo(k))
) { ) {
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.LABS, UserTab.Labs,
_td("Labs"), _td("Labs"),
"mx_UserSettingsDialog_labsIcon", "mx_UserSettingsDialog_labsIcon",
<LabsUserSettingsTab />, <LabsUserSettingsTab />,
@ -145,14 +145,14 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
} }
if (this.state.mjolnirEnabled) { if (this.state.mjolnirEnabled) {
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.MJOLNIR, UserTab.Mjolnir,
_td("Ignored users"), _td("Ignored users"),
"mx_UserSettingsDialog_mjolnirIcon", "mx_UserSettingsDialog_mjolnirIcon",
<MjolnirUserSettingsTab />, <MjolnirUserSettingsTab />,
)); ));
} }
tabs.push(new Tab( tabs.push(new Tab(
USER_TAB.HELP, UserTab.Help,
_td("Help & About"), _td("Help & About"),
"mx_UserSettingsDialog_helpIcon", "mx_UserSettingsDialog_helpIcon",
<HelpUserSettingsTab closeSettingsFn={() => this.props.onFinished(true)} />, <HelpUserSettingsTab closeSettingsFn={() => this.props.onFinished(true)} />,

View File

@ -34,7 +34,7 @@ interface IProps {
interface IState { interface IState {
error: Error | null; error: Error | null;
canUploadKeysWithPasswordOnly: boolean | null; canUploadKeysWithPasswordOnly?: boolean;
accountPassword: string; accountPassword: string;
} }
@ -45,7 +45,7 @@ interface IState {
*/ */
@replaceableComponent("views.dialogs.security.CreateCrossSigningDialog") @replaceableComponent("views.dialogs.security.CreateCrossSigningDialog")
export default class CreateCrossSigningDialog extends React.PureComponent<IProps, IState> { export default class CreateCrossSigningDialog extends React.PureComponent<IProps, IState> {
constructor(props) { constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {
@ -90,7 +90,7 @@ export default class CreateCrossSigningDialog extends React.PureComponent<IProps
} }
} }
private doBootstrapUIAuth = async (makeRequest): Promise<void> => { private doBootstrapUIAuth = async (makeRequest: (authData: any) => void): Promise<void> => {
if (this.state.canUploadKeysWithPasswordOnly && this.state.accountPassword) { if (this.state.canUploadKeysWithPasswordOnly && this.state.accountPassword) {
await makeRequest({ await makeRequest({
type: 'm.login.password', type: 'm.login.password',

View File

@ -18,11 +18,11 @@ import React from 'react';
import SetupEncryptionBody from '../../../structures/auth/SetupEncryptionBody'; import SetupEncryptionBody from '../../../structures/auth/SetupEncryptionBody';
import BaseDialog from '../BaseDialog'; import BaseDialog from '../BaseDialog';
import { _t } from '../../../../languageHandler'; import { _t } from '../../../../languageHandler';
import { SetupEncryptionStore, PHASE } from '../../../../stores/SetupEncryptionStore'; import { SetupEncryptionStore, Phase } from '../../../../stores/SetupEncryptionStore';
import {replaceableComponent} from "../../../../utils/replaceableComponent"; import {replaceableComponent} from "../../../../utils/replaceableComponent";
function iconFromPhase(phase: PHASE) { function iconFromPhase(phase: Phase) {
if (phase === PHASE.DONE) { if (phase === Phase.Done) {
return require("../../../../../res/img/e2e/verified.svg"); return require("../../../../../res/img/e2e/verified.svg");
} else { } else {
return require("../../../../../res/img/e2e/warning.svg"); return require("../../../../../res/img/e2e/warning.svg");
@ -34,14 +34,14 @@ interface IProps {
} }
interface IState { interface IState {
icon: PHASE; icon: Phase;
} }
@replaceableComponent("views.dialogs.security.SetupEncryptionDialog") @replaceableComponent("views.dialogs.security.SetupEncryptionDialog")
export default class SetupEncryptionDialog extends React.Component<IProps, IState> { export default class SetupEncryptionDialog extends React.Component<IProps, IState> {
private store: SetupEncryptionStore; private store: SetupEncryptionStore;
constructor(props) { constructor(props: IProps) {
super(props); super(props);
this.store = SetupEncryptionStore.sharedInstance(); this.store = SetupEncryptionStore.sharedInstance();

View File

@ -48,7 +48,7 @@ import EncryptionPanel from "./EncryptionPanel";
import { useAsyncMemo } from '../../../hooks/useAsyncMemo'; import { useAsyncMemo } from '../../../hooks/useAsyncMemo';
import { legacyVerifyUser, verifyDevice, verifyUser } from '../../../verification'; import { legacyVerifyUser, verifyDevice, verifyUser } from '../../../verification';
import { Action } from "../../../dispatcher/actions"; import { Action } from "../../../dispatcher/actions";
import { USER_TAB } from "../dialogs/UserSettingsDialog"; import { UserTab } from "../dialogs/UserSettingsDialog";
import { useIsEncrypted } from "../../../hooks/useIsEncrypted"; import { useIsEncrypted } from "../../../hooks/useIsEncrypted";
import BaseCard from "./BaseCard"; import BaseCard from "./BaseCard";
import { E2EStatus } from "../../../utils/ShieldUtils"; import { E2EStatus } from "../../../utils/ShieldUtils";
@ -1381,7 +1381,7 @@ const BasicUserInfo: React.FC<{
<AccessibleButton className="mx_UserInfo_field" onClick={() => { <AccessibleButton className="mx_UserInfo_field" onClick={() => {
dis.dispatch({ dis.dispatch({
action: Action.ViewUserSettings, action: Action.ViewUserSettings,
initialTabId: USER_TAB.SECURITY, initialTabId: UserTab.Security,
}); });
}}> }}>
{ _t("Edit devices") } { _t("Edit devices") }

View File

@ -29,7 +29,7 @@ import AccessibleButton from "../elements/AccessibleButton";
import {BetaPill} from "../beta/BetaCard"; import {BetaPill} from "../beta/BetaCard";
import defaultDispatcher from "../../../dispatcher/dispatcher"; import defaultDispatcher from "../../../dispatcher/dispatcher";
import {Action} from "../../../dispatcher/actions"; import {Action} from "../../../dispatcher/actions";
import { USER_TAB } from "../dialogs/UserSettingsDialog"; import { UserTab } from "../dialogs/UserSettingsDialog";
import Field from "../elements/Field"; import Field from "../elements/Field";
import withValidation from "../elements/Validation"; import withValidation from "../elements/Validation";
import {SpaceFeedbackPrompt} from "../../structures/SpaceRoomView"; import {SpaceFeedbackPrompt} from "../../structures/SpaceRoomView";
@ -224,7 +224,7 @@ const SpaceCreateMenu = ({ onFinished }) => {
onFinished(); onFinished();
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
action: Action.ViewUserSettings, action: Action.ViewUserSettings,
initialTabId: USER_TAB.LABS, initialTabId: UserTab.Labs,
}); });
}} /> }} />
{ body } { body }

View File

@ -22,18 +22,18 @@ import { MatrixClientPeg } from '../MatrixClientPeg';
import { accessSecretStorage, AccessCancelledError } from '../SecurityManager'; import { accessSecretStorage, AccessCancelledError } from '../SecurityManager';
import { PHASE_DONE as VERIF_PHASE_DONE } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest"; import { PHASE_DONE as VERIF_PHASE_DONE } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
export enum PHASE { export enum Phase {
LOADING = 0, Loading = 0,
INTRO = 1, Intro = 1,
BUSY = 2, Busy = 2,
DONE = 3, // final done stage, but still showing UX Done = 3, // final done stage, but still showing UX
CONFIRM_SKIP = 4, ConfirmSkip = 4,
FINISHED = 5, // UX can be closed Finished = 5, // UX can be closed
} }
export class SetupEncryptionStore extends EventEmitter { export class SetupEncryptionStore extends EventEmitter {
private started: boolean; private started: boolean;
public phase: PHASE; public phase: Phase;
public verificationRequest: VerificationRequest; public verificationRequest: VerificationRequest;
public backupInfo: IKeyBackupVersion; public backupInfo: IKeyBackupVersion;
public keyId: string; public keyId: string;
@ -50,7 +50,7 @@ export class SetupEncryptionStore extends EventEmitter {
return; return;
} }
this.started = true; this.started = true;
this.phase = PHASE.LOADING; this.phase = Phase.Loading;
this.verificationRequest = null; this.verificationRequest = null;
this.backupInfo = null; this.backupInfo = null;
@ -110,15 +110,15 @@ export class SetupEncryptionStore extends EventEmitter {
if (!this.hasDevicesToVerifyAgainst && !this.keyInfo) { if (!this.hasDevicesToVerifyAgainst && !this.keyInfo) {
// skip before we can even render anything. // skip before we can even render anything.
this.phase = PHASE.FINISHED; this.phase = Phase.Finished;
} else { } else {
this.phase = PHASE.INTRO; this.phase = Phase.Intro;
} }
this.emit("update"); this.emit("update");
} }
public async usePassPhrase(): Promise<void> { public async usePassPhrase(): Promise<void> {
this.phase = PHASE.BUSY; this.phase = Phase.Busy;
this.emit("update"); this.emit("update");
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
try { try {
@ -147,7 +147,7 @@ export class SetupEncryptionStore extends EventEmitter {
}); });
if (cli.getCrossSigningId()) { if (cli.getCrossSigningId()) {
this.phase = PHASE.DONE; this.phase = Phase.Done;
this.emit("update"); this.emit("update");
} }
} catch (e) { } catch (e) {
@ -155,7 +155,7 @@ export class SetupEncryptionStore extends EventEmitter {
console.log(e); console.log(e);
} }
// this will throw if the user hits cancel, so ignore // this will throw if the user hits cancel, so ignore
this.phase = PHASE.INTRO; this.phase = Phase.Intro;
this.emit("update"); this.emit("update");
} }
} }
@ -164,7 +164,7 @@ export class SetupEncryptionStore extends EventEmitter {
if (userId !== MatrixClientPeg.get().getUserId()) return; if (userId !== MatrixClientPeg.get().getUserId()) return;
const publicKeysTrusted = MatrixClientPeg.get().getCrossSigningId(); const publicKeysTrusted = MatrixClientPeg.get().getCrossSigningId();
if (publicKeysTrusted) { if (publicKeysTrusted) {
this.phase = PHASE.DONE; this.phase = Phase.Done;
this.emit("update"); this.emit("update");
} }
} }
@ -185,28 +185,28 @@ export class SetupEncryptionStore extends EventEmitter {
// cross signing to be ready to use, so wait for the user trust status to // cross signing to be ready to use, so wait for the user trust status to
// change (or change to DONE if it's already ready). // change (or change to DONE if it's already ready).
const publicKeysTrusted = MatrixClientPeg.get().getCrossSigningId(); const publicKeysTrusted = MatrixClientPeg.get().getCrossSigningId();
this.phase = publicKeysTrusted ? PHASE.DONE : PHASE.BUSY; this.phase = publicKeysTrusted ? Phase.Done : Phase.Busy;
this.emit("update"); this.emit("update");
} }
} }
public skip(): void { public skip(): void {
this.phase = PHASE.CONFIRM_SKIP; this.phase = Phase.ConfirmSkip;
this.emit("update"); this.emit("update");
} }
public skipConfirm(): void { public skipConfirm(): void {
this.phase = PHASE.FINISHED; this.phase = Phase.Finished;
this.emit("update"); this.emit("update");
} }
public returnAfterSkip(): void { public returnAfterSkip(): void {
this.phase = PHASE.INTRO; this.phase = Phase.Intro;
this.emit("update"); this.emit("update");
} }
public done(): void { public done(): void {
this.phase = PHASE.FINISHED; this.phase = Phase.Finished;
this.emit("update"); this.emit("update");
// async - ask other clients for keys, if necessary // async - ask other clients for keys, if necessary
MatrixClientPeg.get().crypto.cancelAndResendAllOutgoingKeyRequests(); MatrixClientPeg.get().crypto.cancelAndResendAllOutgoingKeyRequests();

View File

@ -21,7 +21,7 @@ import DeviceListener from '../DeviceListener';
import ToastStore from "../stores/ToastStore"; import ToastStore from "../stores/ToastStore";
import GenericToast from "../components/views/toasts/GenericToast"; import GenericToast from "../components/views/toasts/GenericToast";
import { Action } from "../dispatcher/actions"; import { Action } from "../dispatcher/actions";
import { USER_TAB } from "../components/views/dialogs/UserSettingsDialog"; import { UserTab } from "../components/views/dialogs/UserSettingsDialog";
function toastKey(deviceId: string) { function toastKey(deviceId: string) {
return "unverified_session_" + deviceId; return "unverified_session_" + deviceId;
@ -34,7 +34,7 @@ export const showToast = async (deviceId: string) => {
DeviceListener.sharedInstance().dismissUnverifiedSessions([deviceId]); DeviceListener.sharedInstance().dismissUnverifiedSessions([deviceId]);
dis.dispatch({ dis.dispatch({
action: Action.ViewUserSettings, action: Action.ViewUserSettings,
initialTabId: USER_TAB.SECURITY, initialTabId: UserTab.Security,
}); });
}; };