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

Code Quality: Introduced IWindowsRecentItemsService #16150

Merged

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented Sep 8, 2024

Resolved / Related Issues

Note

There's been a known issue with enumerating recent items, where the service enumerates pinned files as well as recent items. Because of this, if there's any, Clear All doesn't work properly. While this PR didn't introduce this issue we probably want to look into later.

Steps used to test these changes

  1. Enumerate recent items
  2. Delete one recent item
  3. Clear all recent items

@0x5bfa 0x5bfa marked this pull request as draft September 8, 2024 13:58
@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-IWindowsRecentItemsService branch 4 times, most recently from d424572 to c861720 Compare September 15, 2024 08:39
@0x5bfa 0x5bfa marked this pull request as ready for review September 15, 2024 10:46
@0x5bfa

This comment was marked as resolved.

@yaira2
Copy link
Member

yaira2 commented Sep 15, 2024

Can we use the context menu verb for that?

@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-IWindowsRecentItemsService branch from 0d0a836 to cf808bc Compare September 16, 2024 14:41
@yaira2
Copy link
Member

yaira2 commented Sep 18, 2024

It looks like folders are showing in the recent files widget

@0x5bfa

This comment was marked as resolved.

@yaira2
Copy link
Member

yaira2 commented Sep 19, 2024

Pinned files should be included

@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-IWindowsRecentItemsService branch 2 times, most recently from ddf1c68 to 24948f8 Compare September 21, 2024 03:15
@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-IWindowsRecentItemsService branch 2 times, most recently from ba20eeb to 24f5ba6 Compare September 29, 2024 04:59
@0x5bfa

This comment was marked as outdated.

@yaira2
Copy link
Member

yaira2 commented Sep 30, 2024

There is one issue I discovered where the order of the recent items doesn't match the behavior in main.

@0x5bfa

This comment was marked as outdated.

@0x5bfa
Copy link
Member Author

0x5bfa commented Sep 30, 2024

Sorry to have forgot to mention this, I meant to.

@yaira2
Copy link
Member

yaira2 commented Sep 30, 2024

The behavior in main matches File Explorer. We shouldn't be doing our own sorting here.

@jiejasonliu
Copy link
Contributor

There was a comment that mentioned the order is already sorted so don't sort here, but tbh I don't understand why @jiejasonliu wrote so.

I only slightly remember this but I figured it would be reasonable to include why we didn't sort since we did so for the folder flow. The initial implementation read directly from Quick Access so there was no need to sort again.
It looks like we still read from Quick Access (looking at the GUID) so we can still rely on enumeration order probably.

@0x5bfa
Copy link
Member Author

0x5bfa commented Oct 1, 2024

It looks like we still read from Quick Access (looking at the GUID) so we can still rely on enumeration order probably.

Do you know IApplicationDocumentLists? This is specifically enumeration interface for frequent and recent items. Also IApplicationDestinations is provided for deleting an item and clearing all. I have to try.

@jiejasonliu
Copy link
Contributor

It looks like we still read from Quick Access (looking at the GUID) so we can still rely on enumeration order probably.

Do you know IApplicationDocumentLists? This is specifically enumeration interface for frequent and recent items. Also IApplicationDestinations is provided for deleting an item and clearing all. I have to try.

I don't, but the API seems promising. From an glance, it looks like a bunch of SHAddToRecentDocs coupled with some other (undocumented?) internals -- the ability to unpin a specific destination is interesting. I'll say that when this was first implemented, I settled on whatever worked first.

@0x5bfa
Copy link
Member Author

0x5bfa commented Oct 12, 2024

@jiejasonliu Thank you for the review.
While whether we're going to get rid of recent folders support depends on @yaira2, I took care of all.

Speaking of IApplicationDocumentLists, I confirmed this was a completely different stuff; File Explorer only adds recent 'folders'. Presumably, we still gotta to use a dedicated shell folder, as we have.

@0x5bfa
Copy link
Member Author

0x5bfa commented Nov 10, 2024

This is ready for review again, tested everything on my end.

One thing I leave as the future work is to use IStorable for recent items, determining if it's IFolder or IFile and invoke one appropriate verb or two. This is also the case for any other UI item classes that represent a storage object.

@yaira2
Copy link
Member

yaira2 commented Nov 10, 2024

Can you rebase with the latest from main?

@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-IWindowsRecentItemsService branch from 8ea304b to 2754111 Compare November 12, 2024 02:36
Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

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

It looks like everything is working properly. @jiejasonliu do you have anything else to go over before I merge the PR?

@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Nov 12, 2024
Copy link
Contributor

@jiejasonliu jiejasonliu left a comment

Choose a reason for hiding this comment

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

lgtm! thanks for taking the time to not only refactor but to explore alternative ways to achieve similar behaviors.

@yaira2 yaira2 merged commit 8fac864 into files-community:main Nov 13, 2024
6 checks passed
@0x5bfa 0x5bfa deleted the 5bfa/CQ-IWindowsRecentItemsService branch November 13, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants