do not offer share button when file hasnt been downloaded. fixes #3971

(cherry picked from commit 3b43cb0bda)
This commit is contained in:
Daniel Gultsch 2021-01-21 18:35:12 +01:00 committed by Christian Schneppe
parent 7ddc71ef2c
commit c0d523b7b4

View file

@ -1310,9 +1310,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
MenuItem downloadFile = menu.findItem(R.id.download_file);
MenuItem deleteFile = menu.findItem(R.id.delete_file);
MenuItem showErrorMessage = menu.findItem(R.id.show_error_message);
final boolean unInitiatedButKnownSize = MessageUtils.unInitiatedButKnownSize(m);
final boolean showError = m.getStatus() == Message.STATUS_SEND_FAILED && m.getErrorMessage() != null && !Message.ERROR_MESSAGE_CANCELLED.equals(m.getErrorMessage());
deleteMessage.setVisible(true);
if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable()) {
if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable() && !unInitiatedButKnownSize && t == null) {
copyMessage.setVisible(true);
quoteMessage.setVisible(!showError && MessageUtils.prepareQuote(m).length() > 0);
String body = m.getMergedBody().toString();
@ -1333,7 +1334,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
&& m.getConversation() instanceof Conversation) {
correctMessage.setVisible(true);
}
if ((m.isFileOrImage() && !deleted && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) {
if ((m.isFileOrImage() && !deleted && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable()) && !unInitiatedButKnownSize && t == null) {
shareWith.setVisible(true);
}
@ -1344,6 +1345,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|| m.isGeoUri()
|| m.isXmppUri()
|| m.treatAsDownloadable()
|| unInitiatedButKnownSize
|| t instanceof HttpDownloadConnection) {
copyUrl.setVisible(true);
}