diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index f1df07e0b..7edc309c9 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -134,6 +134,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public static final int REQUEST_TRUST_KEYS_ATTACHMENTS = 0x0209; public static final int REQUEST_START_DOWNLOAD = 0x0210; public static final int REQUEST_ADD_EDITOR_CONTENT = 0x0211; + public static final int REQUEST_COMMIT_ATTACHMENTS = 0x0212; public static final int ATTACHMENT_CHOICE = 0x0300; public static final int ATTACHMENT_CHOICE_CHOOSE_IMAGE = 0x0301; public static final int ATTACHMENT_CHOICE_TAKE_PHOTO = 0x0302; @@ -1034,6 +1035,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } private void commitAttachments() { + if (!hasPermissions(REQUEST_COMMIT_ATTACHMENTS, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { + return; + } if (conversation.getNextEncryption() == Message.ENCRYPTION_AXOLOTL && trustKeysIfNeeded(REQUEST_TRUST_KEYS_ATTACHMENTS)) { return; } @@ -1647,16 +1651,23 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { if (grantResults.length > 0) { if (allGranted(grantResults)) { - if (requestCode == REQUEST_START_DOWNLOAD) { - if (this.mPendingDownloadableMessage != null) { - startDownloadable(this.mPendingDownloadableMessage); - } - } else if (requestCode == REQUEST_ADD_EDITOR_CONTENT) { - if (this.mPendingEditorContent != null) { - attachEditorContentToConversation(this.mPendingEditorContent); - } - } else { - attachFile(requestCode); + switch (requestCode) { + case REQUEST_START_DOWNLOAD: + if (this.mPendingDownloadableMessage != null) { + startDownloadable(this.mPendingDownloadableMessage); + } + break; + case REQUEST_ADD_EDITOR_CONTENT: + if (this.mPendingEditorContent != null) { + attachEditorContentToConversation(this.mPendingEditorContent); + } + break; + case REQUEST_COMMIT_ATTACHMENTS: + commitAttachments(); + break; + default: + attachFile(requestCode); + break; } } else { @StringRes int res; @@ -1678,6 +1689,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (activity != null && activity.xmppConnectionService != null) { activity.xmppConnectionService.restartFileObserver(); } + refresh(); } } |