aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-01-25 22:35:16 +0100
committerChristian Schneppe <christian@pix-art.de>2019-01-25 22:35:16 +0100
commitc9d9e7ea8114b7a23cfa46fcafa1b3e491bc33b4 (patch)
tree16114bfe8af96ded9179b847f8534504c893edc9 /src
parent33c7fc7a61791a40f273453477e30cb814555377 (diff)
check if we have storage permission before marking a file as deleted on resend
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index eba4c88c5..55f6d7334 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -108,6 +108,7 @@ import de.pixart.messenger.ui.util.SendButtonAction;
import de.pixart.messenger.ui.util.SendButtonTool;
import de.pixart.messenger.ui.util.ShareUtil;
import de.pixart.messenger.ui.widget.EditMessage;
+import de.pixart.messenger.utils.Compatibility;
import de.pixart.messenger.utils.GeoHelper;
import de.pixart.messenger.utils.MenuDoubleTabUtil;
import de.pixart.messenger.utils.MessageUtils;
@@ -1906,8 +1907,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return;
}
final Conversation conversation = (Conversation) message.getConversation();
- DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
- if (file.exists()) {
+ final DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
+ if ((file.exists() && file.canRead()) || message.hasFileOnRemoteHost()) {
final XmppConnection xmppConnection = conversation.getAccount().getXmppConnection();
if (!message.hasFileOnRemoteHost()
&& xmppConnection != null
@@ -1923,9 +1924,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
});
return;
}
+ } else if (!Compatibility.hasStoragePermission(getActivity())) {
+ Toast.makeText(activity, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
+ return;
} else {
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
- //TODO check if we have storage permission
message.setFileDeleted(true);
activity.xmppConnectionService.updateMessage(message, false);
activity.onConversationsListItemUpdated();