diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-06-15 20:11:24 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-06-24 11:23:07 +0200 |
| commit | 1f54942ca8da86efeb64b174dcceecdd9e48a85c (patch) | |
| tree | f1187dd93e4e6cb1f6ee1c91e87e101a7031694b /gui/src/main | |
| parent | 63193938c1c5719e06eae51f8d213af55125a2de (diff) | |
| download | mullvadvpn-1f54942ca8da86efeb64b174dcceecdd9e48a85c.tar.xz mullvadvpn-1f54942ca8da86efeb64b174dcceecdd9e48a85c.zip | |
Refactor AccountExpiry
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/index.ts | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index b09d83e292..407a348ca9 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -4,7 +4,7 @@ import log from 'electron-log'; import mkdirp from 'mkdirp'; import * as path from 'path'; import * as uuid from 'uuid'; -import AccountExpiry from '../shared/account-expiry'; +import { hasExpired } from '../shared/account-expiry'; import BridgeSettingsBuilder from '../shared/bridge-settings-builder'; import { AccountToken, @@ -1147,10 +1147,7 @@ class ApplicationMain { } private async autoConnect() { - if ( - !this.accountData || - !new AccountExpiry(this.accountData.expiry, this.locale).hasExpired() - ) { + if (!this.accountData || !hasExpired(this.accountData.expiry)) { try { log.info('Auto-connecting the tunnel'); await this.daemonRpc.connectTunnel(); @@ -1221,9 +1218,9 @@ class ApplicationMain { private notifyOfAccountExpiry() { if (this.accountData) { - const accountExpiry = new AccountExpiry(this.accountData.expiry, this.locale); const notificationProvider = new AccountExpiryNotificationProvider({ - accountExpiry, + accountExpiry: this.accountData.expiry, + locale: this.locale, tooSoon: this.accountExpiryNotificationTimeout !== undefined, }); if (notificationProvider.mayDisplay()) { |
