summaryrefslogtreecommitdiffhomepage
path: root/app/components/Connect.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-08-07 13:00:02 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-08-08 16:25:34 +0200
commit3e63b2509962201cd25861dc752b2a404f1b614d (patch)
tree0b0e7ca4b54a94a54c9f4750ada7dde95daff064 /app/components/Connect.js
parent3e6a4de0a1682bbe51300f4bee4f84f2679a8c25 (diff)
downloadmullvadvpn-3e63b2509962201cd25861dc752b2a404f1b614d.tar.xz
mullvadvpn-3e63b2509962201cd25861dc752b2a404f1b614d.zip
Add WindowStateObserver
Diffstat (limited to 'app/components/Connect.js')
-rw-r--r--app/components/Connect.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/components/Connect.js b/app/components/Connect.js
index 1a6e21599a..71ddb365f4 100644
--- a/app/components/Connect.js
+++ b/app/components/Connect.js
@@ -9,9 +9,9 @@ import * as AppButton from './AppButton';
import Img from './Img';
import Accordion from './Accordion';
import styles from './ConnectStyles';
-
import { NoCreditError, NoInternetError } from '../errors';
import Map from './Map';
+import WindowStateObserver from '../lib/window-state-observer';
import type { HeaderBarStyle } from './HeaderBar';
import type { ConnectionReduxState } from '../redux/connection/reducers';
@@ -41,6 +41,7 @@ export default class Connect extends Component<Props, State> {
};
_copyTimer: ?TimeoutID;
+ _windowStateObserver = new WindowStateObserver();
shouldComponentUpdate(nextProps: Props, nextState: State) {
const { connection: prevConnection, ...otherPrevProps } = this.props;
@@ -60,12 +61,18 @@ export default class Connect extends Component<Props, State> {
componentDidMount() {
this.props.updateAccountExpiry();
+
+ this._windowStateObserver.onShow = () => {
+ this.props.updateAccountExpiry();
+ };
}
componentWillUnmount() {
if (this._copyTimer) {
clearTimeout(this._copyTimer);
}
+
+ this._windowStateObserver.dispose();
}
render() {