summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-06-17 15:51:32 +0200
committerOskar Nyberg <oskar@mullvad.net>2020-06-24 11:24:36 +0200
commit3d7b5def877520e5af76969f8de57c688b34211b (patch)
tree2293e60bc60ced96e867d34ee2940e866ba9e595 /gui/src
parent797083b4d0eda93d53373575253e91083f4a29b9 (diff)
downloadmullvadvpn-3d7b5def877520e5af76969f8de57c688b34211b.tar.xz
mullvadvpn-3d7b5def877520e5af76969f8de57c688b34211b.zip
Remove tooSoon property from CloseToAccountExpiryNotificationContext
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/index.ts10
-rw-r--r--gui/src/shared/notifications/close-to-account-expiry.ts5
2 files changed, 6 insertions, 9 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 668b975b46..cef8eda51b 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -1227,21 +1227,21 @@ class ApplicationMain {
const closeToExpiryNotification = new CloseToAccountExpiryNotificationProvider({
accountExpiry: this.accountData.expiry,
locale: this.locale,
- tooSoon: this.accountExpiryNotificationScheduler.isRunning,
});
if (expiredNotification.mayDisplay()) {
this.accountExpiryNotificationScheduler.cancel();
this.notificationController.notify(expiredNotification.getSystemNotification());
- } else if (closeToExpiryNotification.mayDisplay()) {
+ } else if (
+ !this.accountExpiryNotificationScheduler.isRunning &&
+ closeToExpiryNotification.mayDisplay()
+ ) {
this.notificationController.notify(closeToExpiryNotification.getSystemNotification());
const twelveHours = 12 * 60 * 60 * 1000;
const remainingMilliseconds = moment(this.accountData.expiry).diff(new Date());
const delay = Math.min(twelveHours, remainingMilliseconds);
- this.accountExpiryNotificationScheduler.schedule(() => {
- this.handleAccountExpiry();
- }, delay);
+ this.accountExpiryNotificationScheduler.schedule(() => this.handleAccountExpiry(), delay);
}
}
}
diff --git a/gui/src/shared/notifications/close-to-account-expiry.ts b/gui/src/shared/notifications/close-to-account-expiry.ts
index 3cf3d82826..b30aff2542 100644
--- a/gui/src/shared/notifications/close-to-account-expiry.ts
+++ b/gui/src/shared/notifications/close-to-account-expiry.ts
@@ -13,7 +13,6 @@ import {
interface CloseToAccountExpiryNotificationContext {
accountExpiry: string;
locale: string;
- tooSoon?: boolean;
}
export class CloseToAccountExpiryNotificationProvider
@@ -25,9 +24,7 @@ export class CloseToAccountExpiryNotificationProvider
moment().add(3, 'days'),
);
- return (
- !hasExpired(this.context.accountExpiry) && willHaveExpiredInThreeDays && !this.context.tooSoon
- );
+ return !hasExpired(this.context.accountExpiry) && willHaveExpiredInThreeDays;
}
public getSystemNotification(): SystemNotification {