-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
Codecov ReportAttention: Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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.
...App/Features/Favorites/Presentation/AllYourFavoriteTools/AllYourFavoriteToolsViewModel.swift
Outdated
Show resolved
Hide resolved
godtools/App/Share/Data/FavoritedResourcesRepository/Cache/Models/RealmFavoritedResource.swift
Show resolved
Hide resolved
...App/Features/Favorites/Presentation/AllYourFavoriteTools/AllYourFavoriteToolsViewModel.swift
Show resolved
Hide resolved
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. |
godtools/App/Features/Dashboard/Presentation/Tools/Subviews/ToolCard/ToolCardView.swift
Outdated
Show resolved
Hide resolved
...sTests/App/Features/Favorites/Data-DomainInterface/ReorderFavoritedToolRepositoryTests.swift
Show resolved
Hide resolved
godtools/App/Features/Favorites/Domain/UseCases/ReorderFavoritedToolUseCase.swift
Outdated
Show resolved
Hide resolved
…into GT-1719-Favorites-Drag-and-Drop
Hey @levieggertcru, I think this is ready for a second look. |
…-changes GT-1719 revert tool card view changes
There was a problem hiding this 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.
...ools/App/Features/Favorites/Presentation/AllYourFavoriteTools/AllYourFavoriteToolsView.swift
Show resolved
Hide resolved
...App/Features/Favorites/Presentation/AllYourFavoriteTools/AllYourFavoriteToolsViewModel.swift
Show resolved
Hide resolved
godtools/App/Share/Data/FavoritedResourcesRepository/Cache/RealmFavoritedResourcesCache.swift
Show resolved
Hide resolved
godtools/App/Share/Data/FavoritedResourcesRepository/Cache/RealmFavoritedResourcesCache.swift
Outdated
Show resolved
Hide resolved
godtools/App/Share/Data/FavoritedResourcesRepository/Cache/RealmFavoritedResourcesCache.swift
Outdated
Show resolved
Hide resolved
This reverts commit 611bd82.
…into GT-1719-Favorites-Drag-and-Drop
…iling-test-in-toggle-tool-favorited-repository-tests
…n-toggle-tool-favorited-repository-tests GT-1719 create failing test in toggle tool favorited repository tests
GT-1719 remove invalid test
Hey @levieggertcru, made those changes we discussed and ready for review. |
Thanks @rachaelblue ! |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🫣
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
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.