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

update(FilePreview): Open image preview in high quality #1698

Conversation

lgmarchi
Copy link
Contributor

@lgmarchi lgmarchi commented Jan 10, 2024

What this PR does 📖

1. If user click to preview an image from chat or storage, it will download that file, and load its path for user see it on maximum quality.

2. Those images have been downloaded in a temp_dir directory inside .uplink folder, and now cropped images from profile and banner as well.

3. Each time user see a preview of image, and closes modal, it will delete that image from local folder.

4. Each time uplink runs again, it will delete all temp_files dir.

Which issue(s) this PR fixes 🔨

Special notes for reviewers 🗒️

Additional comments 🎤

@lgmarchi lgmarchi self-assigned this Jan 10, 2024
@lgmarchi lgmarchi linked an issue Jan 10, 2024 that may be closed by this pull request
@github-actions github-actions bot added Don't merge yet DO NOT MERGE Missing dev review Still needs to be reviewed by a dev labels Jan 10, 2024
…on-when-viewing-image-in-chat' into 1692-taskchat-show-full-resolution-when-viewing-image-in-chat
@github-actions github-actions bot added the Failed Automated Test This PR is failing Luis's Appium test and needs revised label Jan 10, 2024
Copy link
Contributor

github-actions bot commented Jan 10, 2024

UI Automated Test Results Summary for MacOS/Windows

484 tests   432 ✅  2h 19m 4s ⏱️
 40 suites   52 💤
  3 files      0 ❌

Results for commit 482a31c.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jan 10, 2024

UI Automated Tests execution is complete! You can find the test results report here

@github-actions github-actions bot removed the Failed Automated Test This PR is failing Luis's Appium test and needs revised label Jan 10, 2024
@phillsatellite
Copy link
Contributor

While testing I ran into something weird on Windows

When I try to open the preview, it wont show the image. This doesnt seem to happen with all images though. Like in the screen recording from my PC you can see I am able to open some that were sent to me earlier in chat. Sometimes if I go up and preview those old images and come back to the new ones they will all the sudden appear fine. I replicated this on my PC and on my Windows VM as well. Although on the VM no matter how many times I tried, the image would never preview

Windows PC:

20240111-0019-20.3637802.mp4

Windows VM:

Screen.Recording.2024-01-10.at.7.48.12.PM.mov

@phillsatellite phillsatellite added the Changes requested When other dev or QA request a change label Jan 11, 2024
@lgmarchi lgmarchi added Ready for testing Ready for QA to test and removed Changes requested When other dev or QA request a change labels Jan 11, 2024
@phillsatellite phillsatellite removed the linter failing Cargo Workflow (linter) failed on this PR label Jan 11, 2024
@phillsatellite phillsatellite added Waiting for CI Waiting for at least one CI job to complete before merging QA Tested QA has tested and approved and removed Ready for testing Ready for QA to test Waiting for CI Waiting for at least one CI job to complete before merging labels Jan 11, 2024
cx.use_hook(|| {
cx.spawn(async move {
// This will be run once the component is mounted
std::future::ready::<()>(()).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, does the task need to yield first before calling create?

common/src/utils/local_file_path.rs Outdated Show resolved Hide resolved
common/src/utils/local_file_path.rs Outdated Show resolved Hide resolved
Comment on lines +219 to +221
src: format_args!("{}", if temp_dir.exists()
{ temp_file_path_as_string}
else {large_thumbnail} ),
Copy link
Contributor

Choose a reason for hiding this comment

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

You may be able to avoid using format_args (or format) if both variables are strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I will fix it.

ui/src/layouts/chats/presentation/messages/mod.rs Outdated Show resolved Hide resolved
@lgmarchi lgmarchi changed the title update(FilePreview): Open file preview in high quality update(FilePreview): Open image preview in high quality Jan 15, 2024
@github-actions github-actions bot added Failed Automated Test This PR is failing Luis's Appium test and needs revised and removed Failed Automated Test This PR is failing Luis's Appium test and needs revised labels Jan 15, 2024
Copy link
Member

@stavares843 stavares843 left a comment

Choose a reason for hiding this comment

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

Gravacao.do.ecra.2024-01-16.as.19.25.14.mov

you can fast forward the video to the end 😂

its always reproducible on this branch i couldn't reproduce on dev

macOS, m1

let me know if you need the image

@stavares843 stavares843 added Changes requested When other dev or QA request a change and removed QA Tested QA has tested and approved labels Jan 16, 2024
@github-actions github-actions bot added the missing fixing conflict A conflict exists in current PR and needs resolution label Jan 17, 2024
cx.spawn(async move {
// This will be run once the component is mounted
std::future::ready::<()>(()).await;
create();
Copy link
Contributor

@dariusc93 dariusc93 Jan 17, 2024

Choose a reason for hiding this comment

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

Something ive overlooked here is that youre calling this in a async task. While im not sure what the context behind it might be for every use case, if blocking functions are called, it might be best to spawn a blocking task here so it does not block the executor by using tokio::task::spawn_blocking

@lgmarchi
Copy link
Contributor Author

Closing this PR. Preview Video Files is already doing what this PR does and even better.

@lgmarchi lgmarchi closed this Jan 19, 2024
@stavares843 stavares843 deleted the 1692-taskchat-show-full-resolution-when-viewing-image-in-chat branch April 12, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes requested When other dev or QA request a change Don't merge yet DO NOT MERGE Missing dev review Still needs to be reviewed by a dev missing fixing conflict A conflict exists in current PR and needs resolution
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

task(chat): Show full resolution when viewing image in chat
5 participants