Skip to content

Commit

Permalink
add message length warning for android clients
Browse files Browse the repository at this point in the history
  • Loading branch information
cybre-finn authored and scottnonnenberg committed Jun 7, 2017
1 parent d269751 commit ec3278c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions _locales/en/messages.json
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion background.html
Expand Up @@ -130,7 +130,9 @@ <h3>{{ welcomeToSignal }}</h3>
<div class='capture-audio'>
<button class='microphone'></button>
</div>

<div class='android-length-warning'>
{{ android-length-warning }}
</div>
</div>
</form>
</div>
Expand Down
9 changes: 9 additions & 0 deletions js/views/conversation_view.js
Expand Up @@ -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
};
},
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -630,6 +638,7 @@
return this.$('.bottom-bar form').submit();
}
this.toggleMicrophone();
this.toggleLenghtWarning();

this.view.measureScrollPosition();
window.autosize(this.$messageField);
Expand Down
4 changes: 4 additions & 0 deletions stylesheets/_conversation.scss
Expand Up @@ -625,6 +625,10 @@ li.entry .error-icon-container {
float: right;
height: 36px;
}
.android-length-warning {
padding: 10px;
max-width:150px;
}

}

Expand Down
3 changes: 3 additions & 0 deletions stylesheets/manifest.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit ec3278c

@WhisperBTC
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! BitHub has sent payment of $145.49USD for this commit.

Please sign in to comment.