diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-08-07 13:00:02 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-08-08 16:25:34 +0200 |
| commit | 3e63b2509962201cd25861dc752b2a404f1b614d (patch) | |
| tree | 0b0e7ca4b54a94a54c9f4750ada7dde95daff064 /app/components/Account.js | |
| parent | 3e6a4de0a1682bbe51300f4bee4f84f2679a8c25 (diff) | |
| download | mullvadvpn-3e63b2509962201cd25861dc752b2a404f1b614d.tar.xz mullvadvpn-3e63b2509962201cd25861dc752b2a404f1b614d.zip | |
Add WindowStateObserver
Diffstat (limited to 'app/components/Account.js')
| -rw-r--r-- | app/components/Account.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/components/Account.js b/app/components/Account.js index e7a39b68ed..700f33af2b 100644 --- a/app/components/Account.js +++ b/app/components/Account.js @@ -9,6 +9,7 @@ import SettingsHeader, { HeaderTitle } from './SettingsHeader'; import styles from './AccountStyles'; import Img from './Img'; import { formatAccount } from '../lib/formatters'; +import WindowStateObserver from '../lib/window-state-observer'; import type { AccountToken } from '../lib/daemon-rpc'; @@ -35,12 +36,16 @@ export default class Account extends Component<Props, State> { }; _isMounted = false; - _copyTimer: ?TimeoutID; + _windowStateObserver = new WindowStateObserver(); componentDidMount() { this._isMounted = true; this._refreshAccountExpiry(); + + this._windowStateObserver.onShow = () => { + this._refreshAccountExpiry(); + }; } componentWillUnmount() { @@ -49,6 +54,8 @@ export default class Account extends Component<Props, State> { if (this._copyTimer) { clearTimeout(this._copyTimer); } + + this._windowStateObserver.dispose(); } onAccountTokenClick() { |
