From 816f21bb29e00633285cf084e314f4375eec31dc Mon Sep 17 00:00:00 2001 From: alansley Date: Tue, 20 Aug 2024 09:30:30 +1000 Subject: [PATCH] Addressed commit feedback & removed desktop string 'attachmentsClickToDownload' as we use 'attachmentsTapToDownload' --- .../conversation/v2/utilities/AttachmentManager.java | 9 ++++++--- libsession/src/main/res/values/strings.xml | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/AttachmentManager.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/AttachmentManager.java index e9a738637d..58a2630863 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/AttachmentManager.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/AttachmentManager.java @@ -367,14 +367,17 @@ public class AttachmentManager { if (slide == null) return false; // Attachments are excessively large? Not satisfied. + // Note: This file size test must come BEFORE the `constraints.isSatisfied` check below because + // it is a more specific type of check. if (slide.asAttachment().getSize() > MAX_ATTACHMENTS_FILE_SIZE_BYTES) { Toast.makeText(context, R.string.attachmentsErrorSize, Toast.LENGTH_SHORT).show(); return false; } - // Otherwise our constraints-satisfied condition becomes whether we can resize it (obviously - // this will only work on images). - return constraints.canResize(slide.asAttachment()); + // Otherwise we return whether our constraints are satisfied OR if we can resize the attachment + // (in the case of one or more images) - either one will be acceptable, but if both aren't then + // we fail the constraint test. + return constraints.isSatisfied(context, slide.asAttachment()) || constraints.canResize(slide.asAttachment()); } public interface AttachmentListener { diff --git a/libsession/src/main/res/values/strings.xml b/libsession/src/main/res/values/strings.xml index 353d6e01bf..add1842076 100644 --- a/libsession/src/main/res/values/strings.xml +++ b/libsession/src/main/res/values/strings.xml @@ -118,7 +118,6 @@ Auto Download Clear All Attachments Are you sure you want to clear all attachments? Messages with attachments will also be deleted. - Click to download {file_type} Collapse attachment options Collecting attachments... Download Attachment