Skip to content

GT-1719 favorites drag and drop #2509

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

Merged
merged 34 commits into from
Apr 14, 2025
Merged

Conversation

rachaelblue
Copy link
Collaborator

@rachaelblue rachaelblue commented Mar 25, 2025

Hey @levieggertcru, the one thing that's bugging me with this is that to move a tool you have to long press on it, but the tool background highlights when you do that. Do you think it looks weird? I feel like only the card itself should move and the background shouldn't do anything.

@rachaelblue rachaelblue marked this pull request as ready for review March 25, 2025 00:49
Copy link

codecov bot commented Mar 25, 2025

Codecov Report

Attention: Patch coverage is 77.66180% with 107 lines in your changes missing coverage. Please review.

Project coverage is 40.18%. Comparing base (9f2e517) to head (16f1f81).
Report is 35 commits behind head on develop.

Files with missing lines Patch % Lines
...llYourFavoriteTools/AllYourFavoriteToolsView.swift 0.00% 36 Missing ⚠️
...epository/Cache/RealmFavoritedResourcesCache.swift 78.57% 27 Missing ⚠️
...rFavoriteTools/AllYourFavoriteToolsViewModel.swift 0.00% 25 Missing ⚠️
.../Domain/UseCases/ReorderFavoritedToolUseCase.swift 0.00% 7 Missing ⚠️
...encyContainer/FavoritesDataLayerDependencies.swift 0.00% 5 Missing ⚠️
...cyContainer/FavoritesDomainLayerDependencies.swift 0.00% 5 Missing ⚠️
godtools/App/Flows/App/AppFlow.swift 0.00% 1 Missing ⚠️
...sourcesRepository/FavoritedResourceDataModel.swift 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2509      +/-   ##
===========================================
+ Coverage    39.82%   40.18%   +0.36%     
===========================================
  Files         1144     1151       +7     
  Lines        58086    58467     +381     
===========================================
+ Hits         23131    23495     +364     
- Misses       34955    34972      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@levieggertcru levieggertcru left a comment

Choose a reason for hiding this comment

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

Hey @rachaelblue looking good so far! You hit the architecture points really well and I also like the tests you're including.
I did see one issue and I think it has to do with adding the Realm position 0 to start. Added more on that in the Review comments.

@levieggertcru
Copy link
Collaborator

Hey @rachaelblue I think it would be nice if we could exclude the highlight background from the drag and drop, however, I'm not sure how difficult it may be to exclude that? I'm curious to look at that some more in the Xcode UI debugger too so will look more at that.

@levieggertcru
Copy link
Collaborator

One more thing, can you remove this line at the top of the List? Hopefully that is easy to remove.

remove-line-at-top

@rachaelblue rachaelblue marked this pull request as draft March 27, 2025 19:37
@rachaelblue rachaelblue marked this pull request as ready for review April 1, 2025 19:08
@rachaelblue
Copy link
Collaborator Author

Hey @levieggertcru, I think this is ready for a second look.

Copy link
Collaborator

@levieggertcru levieggertcru left a comment

Choose a reason for hiding this comment

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

Hey @rachaelblue this is looking really nice! Sorting is running smooth.

I did notice a couple things. One with the sorting logic on storage of new favorites. See my comment there and let me know your thoughts on option 2. I created a PR to see what I'm referring to. (#2529)

Also with the validation, moving that method call out of the publisher. This actually might help with option 2 when storing new favorited tools.

@rachaelblue rachaelblue marked this pull request as draft April 3, 2025 20:03
@rachaelblue rachaelblue removed the request for review from levieggertcru April 3, 2025 20:05
@rachaelblue rachaelblue marked this pull request as ready for review April 10, 2025 19:33
@rachaelblue
Copy link
Collaborator Author

Hey @levieggertcru, made those changes we discussed and ready for review.

@levieggertcru
Copy link
Collaborator

Thanks @rachaelblue !

Copy link
Collaborator

@levieggertcru levieggertcru left a comment

Choose a reason for hiding this comment

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

Thanks @rachaelblue, I like this direction better. I like that the createdAt is removed too.

Just 2 little things I noticed.


let favoritesSortedByCreatedAt = realm
.objects(RealmFavoritedResource.self)
.sorted(byKeyPath: #keyPath(RealmFavoritedResource.createdAt), ascending: !ascendingOrder)
Copy link
Collaborator

@levieggertcru levieggertcru Apr 10, 2025

Choose a reason for hiding this comment

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

Hey @rachaelblue I ran a fresh build on develop, pre migration, and added a tool to my favorited list. I then ran this branch and I noticed my tool order was in reverse.

It took me a second to see why, but right here on ascendingOrder the flag is getting flipped !ascendingOrder .

Copy link
Collaborator

@levieggertcru levieggertcru Apr 10, 2025

Choose a reason for hiding this comment

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

I would suggest putting false there and removing the argument on the method. We will always want to migrate those so the most recent date is at position 0.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then you will need to update your methods getFavoritedResourcesSortedByPosition and getFavoritedResourcesSortedByPositionPublisher to sort by position if you want to use the ascendingOrder argument on those methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hey @levieggertcru, I went ahead and just removed ascendingOrder entirely. I think it made sense that you might want that flexibility when sorting by dates, but doesn't seem needed with positions. And it's error-prone with the migration, since ascending means opposite things depending on if you're sorting by position or date 🫣

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey @rachaelblue that sounds good!

@@ -25,7 +25,7 @@ class GetToolShortcutLinksRepository: GetToolShortcutLinksRepositoryInterface {

func getLinksPublisher(appLanguage: AppLanguageDomainModel) -> AnyPublisher<[ToolShortcutLinkDomainModel], Never> {

return favoritedResourcesRepository.getFavoritedResourcesSortedByCreatedAtPublisher(ascendingOrder: false)
return favoritedResourcesRepository.getFavoritedResourcesSortedByPositionPublisher(ascendingOrder: false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For tool shortcuts make sure it matches the favorited list order. Ascending defaults to true so you will want to remove this flag.

Copy link
Collaborator

@levieggertcru levieggertcru left a comment

Choose a reason for hiding this comment

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

Hey @rachaelblue looks good! Getting correct migration order.

@rachaelblue rachaelblue merged commit dd4d690 into develop Apr 14, 2025
4 checks passed
@rachaelblue rachaelblue deleted the GT-1719-Favorites-Drag-and-Drop branch April 14, 2025 18:04
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.

2 participants