summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared/notifications/inconsistent-version.ts
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-06-17 15:20:56 +0200
committerOskar Nyberg <oskar@mullvad.net>2020-06-24 11:23:12 +0200
commit2341e2eea669ed29e1146d012fa7a4e5dc9bebf6 (patch)
tree47d17244c20745a0b71a6eca5b0947deea088704 /gui/src/shared/notifications/inconsistent-version.ts
parentddf0ace17e8ca6cd27aa13c3db63e0d16ae504ba (diff)
downloadmullvadvpn-2341e2eea669ed29e1146d012fa7a4e5dc9bebf6.tar.xz
mullvadvpn-2341e2eea669ed29e1146d012fa7a4e5dc9bebf6.zip
Rename notification provider files to kebab-case
Diffstat (limited to 'gui/src/shared/notifications/inconsistent-version.ts')
-rw-r--r--gui/src/shared/notifications/inconsistent-version.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/gui/src/shared/notifications/inconsistent-version.ts b/gui/src/shared/notifications/inconsistent-version.ts
new file mode 100644
index 0000000000..94c33bd925
--- /dev/null
+++ b/gui/src/shared/notifications/inconsistent-version.ts
@@ -0,0 +1,41 @@
+import { messages } from '../../shared/gettext';
+import {
+ InAppNotification,
+ InAppNotificationProvider,
+ SystemNotification,
+ SystemNotificationProvider,
+} from './notification';
+
+interface InconsistentVersionNotificationContext {
+ consistent: boolean;
+}
+
+export class InconsistentVersionNotificationProvider
+ implements SystemNotificationProvider, InAppNotificationProvider {
+ public constructor(private context: InconsistentVersionNotificationContext) {}
+
+ public mayDisplay = () => !this.context.consistent;
+
+ public getSystemNotification(): SystemNotification {
+ return {
+ message: messages.pgettext(
+ 'notifications',
+ 'Inconsistent internal version information, please restart the app',
+ ),
+ critical: true,
+ presentOnce: { value: true, name: this.constructor.name },
+ suppressInDevelopment: true,
+ };
+ }
+
+ public getInAppNotification(): InAppNotification {
+ return {
+ indicator: 'error',
+ title: messages.pgettext('in-app-notifications', 'INCONSISTENT VERSION'),
+ subtitle: messages.pgettext(
+ 'in-app-notifications',
+ 'Inconsistent internal version information, please restart the app',
+ ),
+ };
+ }
+}