Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always download if image is unsupported #13534

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

parneet-guraya
Copy link
Contributor

@parneet-guraya parneet-guraya commented Sep 9, 2024

Fix: #8055

  • Image will always be downloaded if unsupported.

@nextcloud-android-bot
Copy link
Collaborator

Thanks for your contribution!
A toggle is not the best, as it clutters over time settings.
What about having a second snackbar?

  • "Resized images not found. Download image?"
    --> "yes"
  • "Do you want to always download it?"

Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution.

I do believe that a simple toggle in the preferences is a suitable solution for this problem. However, I would like to involve @nextcloud/designers in this discussion.

In my testing everything worked as expected. I've made suggestions for some minor improvements.

}.show()
(requireActivity() as PreviewImageActivity).let { parentImageActivity ->
if (parentImageActivity.preferences.shouldDownloadUnsupportedImage) {
parentImageActivity.requestForDownload(file)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion this call should be moved to the calling function. As this function is called setErrorPreviewMessage(), one would not expect for it do start a download. Alternatively, this function could be renamed to some thing like handleUnsupportedImage or unsupportedImageCallback.

app/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

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

To refer to our design guidelines from https://nextcloud.com/design/

Software should get out of the way.
Do things automatically instead of offering configuration options.

So in this case, what is the option supposed to do, and what is the default:

  • If it’s off by default, only a tiny fraction of people will enable it anyway
  • If it’s on by default, why don’t we just make it so, without the option?

@parneet-guraya what do you think?

EDIT: Also reading the original issue at #8017, the root cause does not seem to be best solved by introducing a setting, but rather by just doing it. :)

@parneet-guraya
Copy link
Contributor Author

@jancborchardt hi 👋 ,

If it’s on by default, why don’t we just make it so, without the option?

By default we ask for the resized image from the backend instead of full resolution (and only fallback to download full resolution if not supported), to save user's bandwidth. I introduced this preference just to keep the current default.

But, if we keep it always on as only option that'd mean unsupported images will always be downloaded. If that's something we are okay with (maybe @tobiasKaminsky can tell) then yes, we can keep this option on by default.

Let me know what you think.

@jancborchardt
Copy link
Member

@parneet-guraya thanks for the explanation. :)

But, if we keep it always on as only option that'd mean unsupported images will always be downloaded.

Yes, I would say that is fine – because people want to view the images. They don’t even know that we normally show only a resized version. So we should not expose implementation details to them and just load it.

@AndyScherzinger
Copy link
Member

I also agree with Jan's comment: always on 👍

@parneet-guraya
Copy link
Contributor Author

always on it is 👍

@parneet-guraya
Copy link
Contributor Author

@ZetaTom , I pushed the change and as discussed in the comments, unsupported image will always be downloaded.

@parneet-guraya parneet-guraya changed the title Add preference in settings if want to always download unsupported images. Always download if image is unsupported Sep 16, 2024
Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

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

Thank you for implementing the suggested changes.

Everything worked as expected.

Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

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

During my testing, these changes worked as expected. However, the preview of the actual image didn't work until I re-opened the file. As this behaves the same for me on master, I think that we can go ahead and merge anyway and address the issue of not loading at another date.

Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Copy link

Codacy

Lint

TypemasterPR
Warnings5959
Errors33

SpotBugs

CategoryBaseNew
Bad practice6464
Correctness6363
Dodgy code297297
Experimental11
Internationalization77
Malicious code vulnerability11
Multithreaded correctness66
Performance5353
Security1818
Total510510

Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13534.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@alperozturk96
Copy link
Collaborator

alperozturk96 commented Sep 23, 2024

@jancborchardt The toggle is no longer visible on the settings screen, and the default action is to always download if the image is unsupported.

@alperozturk96 alperozturk96 dismissed jancborchardt’s stale review September 23, 2024 10:24

Toggle not visible in the settings screen and default action is always download if image is unsupported.

@alperozturk96 alperozturk96 merged commit 6f08389 into master Sep 23, 2024
21 checks passed
@alperozturk96 alperozturk96 deleted the always-download-preference branch September 23, 2024 10:24
@AndyScherzinger AndyScherzinger added this to the Nextcloud App 3.31.0 milestone Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"No resized image available. Download full image?" -> always yes
6 participants