diff options
Diffstat (limited to 'gui/src/renderer')
| -rw-r--r-- | gui/src/renderer/app.tsx | 9 | ||||
| -rw-r--r-- | gui/src/renderer/components/Accordion.tsx | 5 | ||||
| -rw-r--r-- | gui/src/renderer/components/AppButton.tsx | 7 | ||||
| -rw-r--r-- | gui/src/renderer/components/Login.tsx | 7 | ||||
| -rw-r--r-- | gui/src/renderer/components/NotificationBanner.tsx | 5 | ||||
| -rw-r--r-- | gui/src/renderer/containers/AccountPage.tsx | 3 | ||||
| -rw-r--r-- | gui/src/renderer/containers/LoginPage.tsx | 3 | ||||
| -rw-r--r-- | gui/src/renderer/containers/PreferencesPage.tsx | 3 |
8 files changed, 25 insertions, 17 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index 888e41120d..9eabd147b5 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -27,6 +27,7 @@ import { loadTranslations, messages, relayLocations } from '../shared/gettext'; import { IGuiSettingsState, SYSTEM_PREFERRED_LOCALE_KEY } from '../shared/gui-settings-state'; import { IpcRendererEventChannel, IRelayListPair } from '../shared/ipc-event-channel'; import { getRendererLogFile, setupLogging } from '../shared/logging'; +import consumePromise from '../shared/promise'; import { AccountToken, @@ -121,7 +122,7 @@ export default class AppRenderer { }); IpcRendererEventChannel.daemonConnected.listen(() => { - this.onDaemonConnected(); + consumePromise(this.onDaemonConnected()); }); IpcRendererEventChannel.daemonDisconnected.listen((errorMessage?: string) => { @@ -206,7 +207,7 @@ export default class AppRenderer { this.setWireguardPublicKey(initialState.wireguardPublicKey); if (initialState.isConnected) { - this.onDaemonConnected(); + consumePromise(this.onDaemonConnected()); } // disable pinch to zoom @@ -270,7 +271,7 @@ export default class AppRenderer { // switch to the connecting state ahead of time to make the app look more responsive this.reduxActions.connection.connecting(); - return await IpcRendererEventChannel.tunnel.connect(); + return IpcRendererEventChannel.tunnel.connect(); } } @@ -301,7 +302,7 @@ export default class AppRenderer { } catch (e) { log.error(`Failed to get the WWW auth token: ${e.message}`); } - shell.openExternal(`${link}?token=${token}`); + consumePromise(shell.openExternal(`${link}?token=${token}`)); } public async setAllowLan(allowLan: boolean) { diff --git a/gui/src/renderer/components/Accordion.tsx b/gui/src/renderer/components/Accordion.tsx index 19c9ddee56..cf6603774e 100644 --- a/gui/src/renderer/components/Accordion.tsx +++ b/gui/src/renderer/components/Accordion.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import { Animated, Component, Styles, Types, UserInterface, View } from 'reactxp'; +import consumePromise from '../../shared/promise'; interface IProps { expanded: boolean; @@ -56,11 +57,11 @@ export default class Accordion extends Component<IProps, IState> { if (this.props.expanded && !this.state.mountChildren) { this.setState({ mountChildren: true }); } else { - this.animate(this.props.expanded); + consumePromise(this.animate(this.props.expanded)); } } else if (this.state.mountChildren && !oldState.mountChildren) { // run animations once the children are mounted - this.animate(this.props.expanded); + consumePromise(this.animate(this.props.expanded)); } } diff --git a/gui/src/renderer/components/AppButton.tsx b/gui/src/renderer/components/AppButton.tsx index 8bb11972d1..e1c37c014b 100644 --- a/gui/src/renderer/components/AppButton.tsx +++ b/gui/src/renderer/components/AppButton.tsx @@ -2,6 +2,7 @@ import log from 'electron-log'; import * as React from 'react'; import { Button, Component, Styles, Text, Types, UserInterface, View } from 'reactxp'; import { colors } from '../../config.json'; +import consumePromise from '../../shared/promise'; import styles from './AppButtonStyles'; import ImageView from './ImageView'; @@ -94,7 +95,7 @@ class BaseButton extends Component<IProps, IState> { private textViewRef = React.createRef<PrivateLabel>(); public componentDidMount() { - this.forceUpdateTextAdjustment(); + consumePromise(this.forceUpdateTextAdjustment()); } public render() { @@ -135,7 +136,7 @@ class BaseButton extends Component<IProps, IState> { this, ); - this.updateTextAdjustment(containerLayout); + await this.updateTextAdjustment(containerLayout); } } @@ -161,7 +162,7 @@ class BaseButton extends Component<IProps, IState> { } private onLayout = (containerLayout: Types.ViewOnLayoutEvent) => { - this.updateTextAdjustment(containerLayout); + consumePromise(this.updateTextAdjustment(containerLayout)); }; } diff --git a/gui/src/renderer/components/Login.tsx b/gui/src/renderer/components/Login.tsx index 476aa5cc28..f49054f076 100644 --- a/gui/src/renderer/components/Login.tsx +++ b/gui/src/renderer/components/Login.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { Animated, Component, Styles, Text, TextInput, Types, UserInterface, View } from 'reactxp'; import { colors, links } from '../../config.json'; +import consumePromise from '../../shared/promise'; import { messages } from '../../shared/gettext'; import Accordion from './Accordion'; import * as AppButton from './AppButton'; @@ -72,7 +73,7 @@ export default class Login extends Component<IProps, IState> { } public componentDidMount() { - this.setFooterVisibility(this.shouldShowFooter()); + consumePromise(this.setFooterVisibility(this.shouldShowFooter())); } public componentDidUpdate(prevProps: IProps, _prevState: IState) { @@ -91,7 +92,7 @@ export default class Login extends Component<IProps, IState> { } this.setLoginButtonActive(this.shouldActivateLoginButton()); - this.setFooterVisibility(this.shouldShowFooter()); + consumePromise(this.setFooterVisibility(this.shouldShowFooter())); } public render() { @@ -336,7 +337,7 @@ export default class Login extends Component<IProps, IState> { }; private onRemoveAccountFromHistory = (accountToken: string) => { - this.removeAccountFromHistory(accountToken); + consumePromise(this.removeAccountFromHistory(accountToken)); }; private async removeAccountFromHistory(accountToken: AccountToken) { diff --git a/gui/src/renderer/components/NotificationBanner.tsx b/gui/src/renderer/components/NotificationBanner.tsx index ba626c07f4..360c910403 100644 --- a/gui/src/renderer/components/NotificationBanner.tsx +++ b/gui/src/renderer/components/NotificationBanner.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { Animated, Button, Component, Styles, Text, Types, UserInterface, View } from 'reactxp'; import { colors } from '../../config.json'; +import consumePromise from '../../shared/promise'; import { BlockingButton } from './AppButton'; import ImageView from './ImageView'; @@ -213,7 +214,7 @@ export class NotificationBanner extends Component< if (prevProps.visible !== this.props.visible) { // enable drawer-like animation when changing banner's visibility this.setState({ contentPinnedToBottom: true }, () => { - this.animateHeightChanges(); + consumePromise(this.animateHeightChanges()); }); } } @@ -249,7 +250,7 @@ export class NotificationBanner extends Component< // notification banner to slide down each time the component is mounted. if (this.didFinishFirstLayoutPass) { if (oldHeight !== height) { - this.animateHeightChanges(); + consumePromise(this.animateHeightChanges()); } } else { this.didFinishFirstLayoutPass = true; diff --git a/gui/src/renderer/containers/AccountPage.tsx b/gui/src/renderer/containers/AccountPage.tsx index 945512a2f7..012427b94d 100644 --- a/gui/src/renderer/containers/AccountPage.tsx +++ b/gui/src/renderer/containers/AccountPage.tsx @@ -2,6 +2,7 @@ import { goBack } from 'connected-react-router'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { links } from '../../config.json'; +import consumePromise from '../../shared/promise'; import Account from '../components/Account'; import withAppContext, { IAppContext } from '../context'; @@ -17,7 +18,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext) => { const history = bindActionCreators({ goBack }, dispatch); return { onLogout: () => { - props.app.logout(); + consumePromise(props.app.logout()); }, onClose: () => { history.goBack(); diff --git a/gui/src/renderer/containers/LoginPage.tsx b/gui/src/renderer/containers/LoginPage.tsx index 9b39520881..2f221ad875 100644 --- a/gui/src/renderer/containers/LoginPage.tsx +++ b/gui/src/renderer/containers/LoginPage.tsx @@ -2,6 +2,7 @@ import { push } from 'connected-react-router'; import { shell } from 'electron'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import consumePromise from '../../shared/promise'; import Login from '../components/Login'; import withAppContext, { IAppContext } from '../context'; import accountActions from '../redux/account/actions'; @@ -24,7 +25,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext) => { history.push('/settings'); }, login: (account: string) => { - props.app.login(account); + consumePromise(props.app.login(account)); }, resetLoginError: () => { resetLoginError(); diff --git a/gui/src/renderer/containers/PreferencesPage.tsx b/gui/src/renderer/containers/PreferencesPage.tsx index 068f6f8d1d..299d5799cb 100644 --- a/gui/src/renderer/containers/PreferencesPage.tsx +++ b/gui/src/renderer/containers/PreferencesPage.tsx @@ -2,6 +2,7 @@ import { goBack } from 'connected-react-router'; import log from 'electron-log'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; +import consumePromise from '../../shared/promise'; import Preferences from '../components/Preferences'; import withAppContext, { IAppContext } from '../context'; import { IReduxState, ReduxDispatch } from '../redux/store'; @@ -35,7 +36,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext) => { props.app.setAutoConnect(autoConnect); }, setAllowLan: (allowLan: boolean) => { - props.app.setAllowLan(allowLan); + consumePromise(props.app.setAllowLan(allowLan)); }, setStartMinimized: (startMinimized: boolean) => { props.app.setStartMinimized(startMinimized); |
