Skip to content

Conversation

@DenBond7
Copy link
Collaborator

@DenBond7 DenBond7 commented Feb 12, 2025

This PR improved handling attachments.

  1. Added the ability to use any app to preview attachments for users who have a problem with a common approach.

Doesn't affect users with existing RESTRICT_ANDROID_ATTACHMENT_HANDLING policy.

Screen_recording_20250218_125036_smart_mode.mp4

Added a test to cover the following case: Test visibility for Settings -> General when RESTRICT_ANDROID_ATTACHMENT_HANDLING is present and vice versa.

As intents are handled by the system, it's hard to test 'smart mode' via Espresso(outside of the app scope). Tested manually.

  1. Fixed the issue with a wrong name for duplicated downloads.

close #2894
close #2944

Tests (delete all except exactly one):

  • Tests added or updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities

@DenBond7 DenBond7 marked this pull request as ready for review February 18, 2025 15:01
@DenBond7 DenBond7 requested a review from sosnovsky as a code owner February 18, 2025 15:01
@sosnovsky
Copy link
Collaborator

Hi @ioanmo226, will you be able to perform reviews for Android PRs as you did before?
If so, please start by checking this PR, thanks!

@sosnovsky sosnovsky requested a review from ioanmo226 February 19, 2025 07:20
@DenBond7
Copy link
Collaborator Author

DenBond7 commented Feb 19, 2025

Works well!. Btw I can only see MainSettingsFragmentEnterpriseFlowTest.kt test added. I don't see tests which cover #2894 and #2944.

Maybe it is difficult to add UI test for this case?

Added a test to cover the following case: Test visibility for Settings -> General when RESTRICT_ANDROID_ATTACHMENT_HANDLING is present and vice versa.

As intents are handled by the system, it's hard to test 'smart mode' via Espresso(outside of the app scope). Tested manually.

I've updated the PR details.

@martgil
Copy link
Collaborator

martgil commented Feb 19, 2025

Hi @ioanmo226 Sorry for the late reply. I will have it tested the newer updates and let you know of the result.

@martgil
Copy link
Collaborator

martgil commented Feb 19, 2025

I tested the current one and notices that it still shows blank white images when the image attachment was previewed using the apps default photo app - I thought it was just happened on AOSP (with older android version).

I think it needs to be corrected. For instance, if user doesn't have an alternative app such as Google Photos, then I'll be problematic for them and will received just a white blank image.

Please feel free to review the follow screen recording below:

FlowCrypt.-.default.photo.app.shows.blank.white.image.mp4

@DenBond7
Copy link
Collaborator Author

I tested the current one and notices that it still shows blank white images when the image attachment was previewed using the apps default photo app - I thought it was just happened on AOSP (with older android version).
I think it needs to be corrected. For instance, if user doesn't have an alternative app such as Google Photos, then I'll be problematic for them and will received just a white blank image.

  1. unfortunately, it can't be improved on our side with the current realization(data in RAM cache). We use a common standard way to share data for other apps. How to handle received data is the responsibility of the app-receiver. If a user can't preview an attachment via existing installed apps we can just advise him to install one more file-viewer in this case(or download a file and preview it via existing apps direcrlty). For example, I've attested a lot of image-viewers(modern apps). And all of them worked well.
  2. Or we can change our implementation to store attachments locally before the preview. In that case, we will have a behavior similar to download case. As for me, it's a worst case. The current one is secure and provides a safe way to preview received data. A user can preview an attachment and doesn't care about a file(don't need to delete it).

@DenBond7
Copy link
Collaborator Author

I tested the current one and notices that it still shows blank white images when the image attachment was previewed using the apps default photo app - I thought it was just happened on AOSP (with older android version).

One more addition. We should understand that there are millions of Android devices with different Android versions and from different manufacturers.

default photo app - it can be a different app from version to version(Android), from manufacturer to manufacturer. A manufacturer can delete the default implementation when creating its firmware and add the custom implementation.

@martgil
Copy link
Collaborator

martgil commented Feb 19, 2025

Thanks for the detailed explanation, Den. I agree that don't want to store them locally during attachment preview as it was less secure so would be just okay to inform users to install compatible apps such as Google Photos or just download the image attachment anyway.

Copy link
Collaborator

@martgil martgil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please approve this PR if it's fine for you too

Thanks Ioan, its LGTM 👍🏼

@ioanmo226 ioanmo226 merged commit c8a8bf7 into master Feb 19, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decrypted files from preview does not offer the right application to open the downloaded attachment Attachment preview shows only blank image

3 participants