In iOS theme, join attachment bubble with caption bubble

This commit is contained in:
Scott Nonnenberg 2018-04-06 14:51:52 -07:00
parent 3a76c3c86e
commit ae043bf239
No known key found for this signature in database
GPG key ID: 5F82280C35134661
9 changed files with 246 additions and 97 deletions

View file

@ -69,7 +69,7 @@
];
Whisper.AttachmentView = Backbone.View.extend({
tagName: 'span',
tagName: 'div',
className() {
if (this.isImage()) {
return 'attachment';

View file

@ -355,6 +355,24 @@
this.timerView.setElement(this.$('.timer'));
this.timerView.update();
},
isImageWithoutCaption: function() {
var attachments = this.model.get('attachments');
var body = this.model.get('body');
if (!attachments || attachments.length === 0) {
return false;
}
if (body && body.trim()) {
return false;
}
var first = attachments[0];
if (first.contentType.startsWith('image/') && first.contentType !== 'image/tiff') {
return true;
}
return false;
},
render: function() {
var contact = this.model.isIncoming() ? this.model.getContact() : null;
this.$el.html(
@ -364,6 +382,7 @@
sender: (contact && contact.getTitle()) || '',
avatar: (contact && contact.getAvatar()),
profileName: (contact && contact.getProfileName()),
innerBubbleClasses: this.isImageWithoutCaption() ? '' : 'with-tail',
}, this.render_partials())
);
this.timeStampView.setElement(this.$('.timestamp'));