diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ef7b6410..c2ebbed3 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -257,5 +257,13 @@ "learnMore": { "message": "Learn more about verifying keys.", "description": "Text that links to a support article on verifying identity keys" + }, + "expiredWarning": { + "message": "This version of Signal Desktop has expired. Please upgrade to the latest version to continue messaging.", + "description": "Warning notification that this version of the app has expired" + }, + "upgrade": { + "message": "Upgrade", + "description": "Label text for button to upgrade the app to the latest version" } } diff --git a/background.html b/background.html index 2f845aea..1be40bd2 100644 --- a/background.html +++ b/background.html @@ -38,6 +38,15 @@ + + diff --git a/js/background.js b/js/background.js index 3935900f..81fdb0b3 100644 --- a/js/background.js +++ b/js/background.js @@ -94,7 +94,9 @@ var mySignalingKey = storage.get('signaling_key'); // initialize the socket and start listening for messages - messageReceiver = new textsecure.MessageReceiver(SERVER_URL, USERNAME, PASSWORD, mySignalingKey, ATTACHMENT_SERVER_URL); + messageReceiver = new textsecure.MessageReceiver( + SERVER_URL, USERNAME, PASSWORD, mySignalingKey, ATTACHMENT_SERVER_URL + ); messageReceiver.addEventListener('message', onMessageReceived); messageReceiver.addEventListener('receipt', onDeliveryReceipt); messageReceiver.addEventListener('contact', onContactReceived); @@ -103,7 +105,9 @@ messageReceiver.addEventListener('read', onReadReceipt); messageReceiver.addEventListener('error', onError); - window.textsecure.messaging = new textsecure.MessageSender(SERVER_URL, USERNAME, PASSWORD, ATTACHMENT_SERVER_URL); + window.textsecure.messaging = new textsecure.MessageSender( + SERVER_URL, USERNAME, PASSWORD, ATTACHMENT_SERVER_URL + ); if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') { var syncRequest = new textsecure.SyncRequest(textsecure.messaging, messageReceiver); syncRequest.addEventListener('success', function() { diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index d587253e..f2333f37 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -6,6 +6,15 @@ window.Whisper = window.Whisper || {}; emoji.init_colons(); + Whisper.ExpiredToast = Whisper.ToastView.extend({ + templateName: 'expired_toast', + render_attributes: function() { + return { + expiredWarning: i18n('expiredWarning') + }; + } + }); + Whisper.ConversationView = Whisper.View.extend({ className: function() { return [ 'conversation', this.model.get('type') ].join(' '); @@ -232,6 +241,12 @@ }, sendMessage: function(e) { + if (extension.expired()) { + var toast = new Whisper.ExpiredToast(); + toast.$el.insertAfter(this.$el); + toast.render(); + return; + } e.preventDefault(); var input = this.$messageField; var message = this.replace_colons(input.val()).trim(); diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 384ed755..bc5595e6 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -94,14 +94,20 @@ extension.windows.onClosed(function() { this.inboxListView.stopListening(); }.bind(this)); + + if (extension.expired()) { + var banner = new Whisper.ExpiredAlertBanner().render(); + banner.$el.prependTo(this.$el); + this.$el.addClass('expired'); + } }, render_attributes: { - welcomeToSignal: i18n('welcomeToSignal'), - selectAContact: i18n('selectAContact'), - searchForPeopleOrGroups: i18n('searchForPeopleOrGroups'), - submitDebugLog: i18n('submitDebugLog'), - settings: i18n('settings'), - restartSignal: i18n('restartSignal') + welcomeToSignal : i18n('welcomeToSignal'), + selectAContact : i18n('selectAContact'), + searchForPeopleOrGroups : i18n('searchForPeopleOrGroups'), + submitDebugLog : i18n('submitDebugLog'), + settings : i18n('settings'), + restartSignal : i18n('restartSignal'), }, events: { 'click': 'closeMenu', @@ -166,4 +172,15 @@ } }); + Whisper.ExpiredAlertBanner = Whisper.View.extend({ + templateName: 'expired_alert', + className: 'expiredAlert clearfix', + render_attributes: function() { + return { + expiredWarning: i18n('expiredWarning'), + upgrade: i18n('upgrade'), + }; + } + }); + })(); diff --git a/stylesheets/_global.scss b/stylesheets/_global.scss index 44aabe84..d9bd9317 100644 --- a/stylesheets/_global.scss +++ b/stylesheets/_global.scss @@ -496,3 +496,21 @@ input[type=text], input[type=search], textarea { outline: 1px solid $blue; } } + +.expiredAlert { + background: #F3F3A7; + padding: 10px; + line-height: 36px; + + button { + float: right; + border: none; + border-radius: $border-radius; + color: white; + font-weight: bold; + line-height: 36px; + padding: 0 20px; + background: $blue; + margin-left: 20px; + } +} diff --git a/stylesheets/_index.scss b/stylesheets/_index.scss index e29df619..c1d8dd20 100644 --- a/stylesheets/_index.scss +++ b/stylesheets/_index.scss @@ -3,6 +3,12 @@ height: 100%; } +.expired { + .conversation-stack, .gutter { + height: calc(100% - 56px); + } +} + .scrollable { height: 100%; overflow: auto; diff --git a/stylesheets/manifest.css b/stylesheets/manifest.css index 8fba31e1..990ed341 100644 --- a/stylesheets/manifest.css +++ b/stylesheets/manifest.css @@ -420,6 +420,21 @@ img.emoji { input[type=text]:active, input[type=text]:focus, input[type=search]:active, input[type=search]:focus, textarea:active, textarea:focus { outline: 1px solid #2090ea; } +.expiredAlert { + background: #F3F3A7; + padding: 10px; + line-height: 36px; } + .expiredAlert button { + float: right; + border: none; + border-radius: 5px; + color: white; + font-weight: bold; + line-height: 36px; + padding: 0 20px; + background: #2090ea; + margin-left: 20px; } + @keyframes progress-bar-stripes { from { background-position: 40px 0; } @@ -451,6 +466,9 @@ input[type=text]:active, input[type=text]:focus, input[type=search]:active, inpu .new-conversation, .inbox, .gutter { height: 100%; } +.expired .conversation-stack, .expired .gutter { + height: calc(100% - 56px); } + .scrollable { height: 100%; overflow: auto; } diff --git a/test/index.html b/test/index.html index 942df6a1..e64a3d9f 100644 --- a/test/index.html +++ b/test/index.html @@ -124,6 +124,7 @@ +