diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-06-10 13:48:33 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-06-10 13:48:33 +0200 |
| commit | f9d364431c866118a18b06454bfada3a3a655815 (patch) | |
| tree | 05adc6824c48e6e513d19bb844510e8735317813 /gui/src/shared/notifications/inconsistentVersion.ts | |
| parent | d7fdccb58e8205ae26023629873922979644bfdd (diff) | |
| parent | 3fc5cbd567e48edec416e57037e5e9279a2c3af6 (diff) | |
| download | mullvadvpn-f9d364431c866118a18b06454bfada3a3a655815.tar.xz mullvadvpn-f9d364431c866118a18b06454bfada3a3a655815.zip | |
Merge branch 'refactor-notifications'
Diffstat (limited to 'gui/src/shared/notifications/inconsistentVersion.ts')
| -rw-r--r-- | gui/src/shared/notifications/inconsistentVersion.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gui/src/shared/notifications/inconsistentVersion.ts b/gui/src/shared/notifications/inconsistentVersion.ts new file mode 100644 index 0000000000..94c33bd925 --- /dev/null +++ b/gui/src/shared/notifications/inconsistentVersion.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', + ), + }; + } +} |
