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

Fix: Fixed thumbails not loading in MTP devices #16782

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gave92
Copy link
Member

@gave92 gave92 commented Feb 5, 2025

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Added back some code removed in #14423 which is necessary for loading thumbails in MTP.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Verify that icons are loaded in MTP devices
  2. Verify that loading on normal drives is not impacted

@gave92 gave92 marked this pull request as draft February 5, 2025 22:15
@gave92 gave92 marked this pull request as ready for review February 5, 2025 22:28
@yaira2
Copy link
Member

yaira2 commented Feb 6, 2025

I was thinking we could take this a step forward with a single method in FileThumbnailHelper that would first attempt using the Win32 method, and StorageItem as a fallback.

/// <summary>
/// Returns thumbnail for given file or folder using Storage API
/// </summary>
public static async Task<byte[]?> GetIconAsync(IStorageItem item, uint requestedSize, ThumbnailMode thumbnailMode, ThumbnailOptions thumbnailOptions)
Copy link
Member

Choose a reason for hiding this comment

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

Is thumbnail mode always single?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both ListView and SingleItem are used

Copy link
Member

Choose a reason for hiding this comment

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

I think we can reduce complexity by just using SingleItem.

@gave92
Copy link
Member Author

gave92 commented Feb 9, 2025

Ok now thumbnails work in file list, in properties window and preview pane 💪

@@ -86,6 +86,7 @@ public async virtual Task<List<FileProperty>> LoadPreviewAndDetailsAsync()
{
var result = await FileThumbnailHelper.GetIconAsync(
Item.ItemPath,
Item.ItemFile,
Copy link
Member

Choose a reason for hiding this comment

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

If we're anyways passing StorageItem, is there any reason to continue passing the path?

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.

Bug: Thumbnails don't load for MTP devices (Phones)
2 participants