From ec3278ca3aba04fcd73516097409e00927a5d5b6 Mon Sep 17 00:00:00 2001 From: Ikarulus Date: Fri, 26 May 2017 18:50:23 +0200 Subject: [PATCH] add message length warning for android clients --- _locales/en/messages.json | 4 ++++ background.html | 4 +++- js/views/conversation_view.js | 9 +++++++++ stylesheets/_conversation.scss | 4 ++++ stylesheets/manifest.css | 3 +++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ac51afeee588..25c1fd9d81db 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -351,6 +351,10 @@ "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" }, + "androidMessageLengthWarning": { + "message": "Android clients will only receive the first 2000 characters of this message.", + "description": "Warning that long messages could not get received completely by Android clients." + }, "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 aafaa1e4896a..fbc2e1eed5f9 100644 --- a/background.html +++ b/background.html @@ -130,7 +130,9 @@
- +
+ {{ android-length-warning }} +
diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 7b65ccec6d28..59e23c1ce4d3 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -78,6 +78,7 @@ 'destroy' : i18n('deleteMessages'), 'send-message' : i18n('sendMessage'), 'disappearing-messages': i18n('disappearingMessages'), + 'android-length-warning': i18n('androidMessageLengthWarning'), timer_options : Whisper.ExpirationTimerOptions.models }; }, @@ -180,6 +181,13 @@ this.$('.capture-audio').show(); } }, + toggleLenghtWarning: function() { + if (this.$('.send-message').val().length > 2000 || this.fileInput.hasFiles()) { + this.$('.android-length-warning').show(); + } else { + this.$('.android-length-warning').hide(); + } + }, captureAudio: function(e) { e.preventDefault(); var view = new Whisper.RecorderView().render(); @@ -630,6 +638,7 @@ return this.$('.bottom-bar form').submit(); } this.toggleMicrophone(); + this.toggleLenghtWarning(); this.view.measureScrollPosition(); window.autosize(this.$messageField); diff --git a/stylesheets/_conversation.scss b/stylesheets/_conversation.scss index 944be07167d0..16b7a186900d 100644 --- a/stylesheets/_conversation.scss +++ b/stylesheets/_conversation.scss @@ -625,6 +625,10 @@ li.entry .error-icon-container { float: right; height: 36px; } + .android-length-warning { + padding: 10px; + max-width:150px; + } } diff --git a/stylesheets/manifest.css b/stylesheets/manifest.css index ef5c0e8f6cd7..123f3b1e6633 100644 --- a/stylesheets/manifest.css +++ b/stylesheets/manifest.css @@ -1453,6 +1453,9 @@ li.entry .error-icon-container { .bottom-bar .capture-audio { float: right; height: 36px; } + .bottom-bar .android-length-warning { + padding: 10px; + max-width: 150px; } .toast { position: absolute;