Skip to content

Commit

Permalink
Addressed commit feedback & removed desktop string 'attachmentsClickT…
Browse files Browse the repository at this point in the history
…oDownload' as we use 'attachmentsTapToDownload'
  • Loading branch information
alansley committed Aug 19, 2024
1 parent acc8d47 commit 816f21b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,17 @@ private boolean areConstraintsSatisfied(final @NonNull Context context,
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 {
Expand Down
1 change: 0 additions & 1 deletion libsession/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
<string name="attachmentsAutoDownloadModalTitle">Auto Download</string>
<string name="attachmentsClearAll">Clear All Attachments</string>
<string name="attachmentsClearAllDescription">Are you sure you want to clear all attachments? Messages with attachments will also be deleted.</string>
<string name="attachmentsClickToDownload">Click to download {file_type}</string>
<string name="attachmentsCollapseOptions">Collapse attachment options</string>
<string name="attachmentsCollecting">Collecting attachments...</string>
<string name="attachmentsDownload">Download Attachment</string>
Expand Down

0 comments on commit 816f21b

Please sign in to comment.