From 5cb7703ae5a209f65d05fa6d32659a9478de5fb5 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Fri, 26 Jul 2019 16:00:52 +1000 Subject: [PATCH 1/2] Add one-time disclaimer at startup for beta release --- background.html | 37 +++++++++++++++++++++ js/views/beta_release_disclaimer_view.js | 42 ++++++++++++++++++++++++ js/views/inbox_view.js | 9 +++++ 3 files changed, 88 insertions(+) create mode 100644 js/views/beta_release_disclaimer_view.js diff --git a/background.html b/background.html index fd5c46bc4..a62c7dd4c 100644 --- a/background.html +++ b/background.html @@ -245,6 +245,42 @@ + + diff --git a/js/views/beta_release_disclaimer_view.js b/js/views/beta_release_disclaimer_view.js new file mode 100644 index 000000000..871a6df04 --- /dev/null +++ b/js/views/beta_release_disclaimer_view.js @@ -0,0 +1,42 @@ +/* global Whisper, i18n, window */ + +// eslint-disable-next-line func-names +(function() { + 'use strict'; + + window.Whisper = window.Whisper || {}; + + Whisper.BetaReleaseDisclaimer = Whisper.View.extend({ + className: 'loki-dialog beta-disclaimer-dialog modal', + templateName: 'beta-disclaimer-dialog', + initialize(options = {}) { + this.okText = options.okText || i18n('ok'); + this.render(); + this.$('.betaDisclaimerView').show(); + this.$('.beta-disclaimer-dialog').bind('keyup', event => this.onKeyup(event)); + }, + events: { + 'click .ok': 'close', + }, + render_attributes() { + return { + ok: this.okText, + }; + }, + close() { + window.storage.put('betaReleaseDisclaimerAccepted', true); + this.remove(); + }, + onKeyup(event) { + switch (event.key) { + case 'Enter': + case 'Escape': + case 'Esc': + this.close(); + break; + default: + break; + } + }, + }); +})(); diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 54762ecba..1791d8ca5 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -91,6 +91,11 @@ model: { window: options.window }, }); + if (!window.storage.get('betaReleaseDisclaimerAccepted')) + { + this.showBetaReleaseDisclaimer(); + } + if (!options.initialLoadComplete) { this.appLoadingScreen = new Whisper.AppLoadingScreen(); this.appLoadingScreen.render(); @@ -344,6 +349,10 @@ toast.$el.appendTo(this.$('.gutter')); toast.render(); }, + showBetaReleaseDisclaimer() { + const dialog = new Whisper.BetaReleaseDisclaimer(); + this.el.append(dialog.el); + }, }); Whisper.ExpiredAlertBanner = Whisper.View.extend({ From 468a92f861e2e7b7bfc3cff8df27bd47bda996d3 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Wed, 31 Jul 2019 10:23:10 +1000 Subject: [PATCH 2/2] Fix electron tests --- test/index.html | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/index.html b/test/index.html index 17796c9c9..61087bb86 100644 --- a/test/index.html +++ b/test/index.html @@ -155,7 +155,42 @@ + + +