Forráskód Böngészése

Show caption input only on file and image messages (#336)

Fixes #332
Silly 8 éve
szülő
commit
b14191ea65
2 módosított fájl, 4 hozzáadás és 1 törlés
  1. 3 1
      src/partials/messenger.ts
  2. 1 0
      src/sass/components/_dialogs.scss

+ 3 - 1
src/partials/messenger.ts

@@ -427,10 +427,12 @@ class ConversationController {
                 case 'file':
                     // Determine file type
                     let showSendAsFileCheckbox = false;
+                    let captionSupported = false;
                     for (let msg of contents as threema.FileMessageData[]) {
                         if (!msg.fileType) {
                             msg.fileType = 'application/octet-stream';
                         }
+                        captionSupported = this.mimeService.isImage(msg.fileType);
                         if (this.mimeService.isImage(msg.fileType)
                             || this.mimeService.isAudio(msg.fileType)
                             || this.mimeService.isVideo(msg.fileType)) {
@@ -456,7 +458,7 @@ class ConversationController {
                             <md-dialog class="send-file-dialog">
                                 <md-dialog-content class="md-dialog-content">
                                     <h2 class="md-title">${title}</h2>
-                                    <md-input-container md-no-float class="input-caption md-prompt-input-container">
+                                    <md-input-container md-no-float class="input-caption md-prompt-input-container" ng-show="!${showSendAsFileCheckbox} || ctrl.sendAsFile || ${captionSupported}">
                                         <input md-autofocus ng-keypress="ctrl.keypress($event)" ng-model="ctrl.caption" placeholder="${placeholder}" aria-label="${placeholder}">
                                     </md-input-container>
                                     <md-input-container md-no-float class="input-send-as-file md-prompt-input-container" ng-show="${showSendAsFileCheckbox}">

+ 1 - 0
src/sass/components/_dialogs.scss

@@ -36,5 +36,6 @@ md-dialog.send-file-dialog {
     }
     md-input-container.input-send-as-file {
         margin-top: 0;
+        margin-bottom: 0;
     }
 }