More specific type definition and adhering to code style better

This commit is contained in:
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

@ -34,7 +34,7 @@ interface IProps {
interface IState {
error: Error | null;
canUploadKeysWithPasswordOnly: boolean | null;
canUploadKeysWithPasswordOnly?: boolean;
accountPassword: string;
}
@ -45,7 +45,7 @@ interface IState {
*/
@replaceableComponent("views.dialogs.security.CreateCrossSigningDialog")
export default class CreateCrossSigningDialog extends React.PureComponent<IProps, IState> {
constructor(props) {
constructor(props: IProps) {
super(props);
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) {
await makeRequest({
type: 'm.login.password',

View file

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