-
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
Merged
Merged
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
91e2f58
allow favorited tools to be move tools around and create useCases
rachaelblue 879b6d4
sort favorites by position
rachaelblue 05d79be
add test for reordering
rachaelblue 04deec3
add second test
rachaelblue 8aba919
fix off by one error when moving an item down
rachaelblue 3017023
fix all buttons triggering on list tap
rachaelblue aeea2a2
adjust positions when favorite is removed
rachaelblue ee84694
fix failing tests
rachaelblue 37edaa2
store cancellables in static var
rachaelblue bf6fa3f
validate favorites positions
rachaelblue cfcd1c7
sort by createdAt when validating
rachaelblue f04c558
Merge branch 'develop' of https://github.com/CruGlobal/godtools-swift…
rachaelblue 98cb20a
add reorderFavorite domain model
rachaelblue a4019a2
add test for removingFavorite and checking position
rachaelblue e7a5edd
fix failing test
rachaelblue 293f677
add test for adding a favorite tool
rachaelblue 0b7e8db
commit changes
rachaelblue 30fdfc2
remove row separator from top of list
rachaelblue 3fb9dba
Reverting changes to dev since nothing changed
levieggertcru 2a839df
Merge pull request #2528 from CruGlobal/GT-1719-revert-tool-card-view…
levieggertcru 8d63445
Create failing test by adding all favorited tools at position 0.
levieggertcru 611bd82
validate favorites after storing
rachaelblue 4ce2e10
validate resources sorted by position not in publisher
rachaelblue 5fa4611
Revert "validate favorites after storing"
rachaelblue 306dc33
fix adding multiple favorites all having position 0 and write test
rachaelblue e70f1ec
Merge branch 'develop' of https://github.com/CruGlobal/godtools-swift…
rachaelblue 94dc147
Merge branch 'GT-1719-Favorites-Drag-and-Drop' into GT-1719-create-fa…
levieggertcru d7a21dc
Merge pull request #2529 from CruGlobal/GT-1719-create-failing-test-i…
levieggertcru 98795c3
Remove invalid test
levieggertcru cca0719
Merge pull request #2538 from CruGlobal/GT-1719-remove-invalid-test
levieggertcru b478f91
return void from store favorites method
rachaelblue cb4d2fe
rename validation method to migration and delete methods that fetch/s…
rachaelblue 17f27ef
remove ascending order param
rachaelblue 16f1f81
Merge branch 'develop' into GT-1719-Favorites-Drag-and-Drop
levieggertcru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
godtools/App/Features/Favorites/Data-DomainInterface/ReorderFavoritedToolRepository.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// ReorderFavoritedToolRepository.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 3/19/25. | ||
// Copyright © 2025 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
class ReorderFavoritedToolRepository: ReorderFavoritedToolRepositoryInterface { | ||
|
||
private let favoritedResourcesRepository: FavoritedResourcesRepository | ||
|
||
init(favoritedResourcesRepository: FavoritedResourcesRepository) { | ||
self.favoritedResourcesRepository = favoritedResourcesRepository | ||
} | ||
|
||
func reorderFavoritedToolPubilsher(toolId: String, originalPosition: Int, newPosition: Int) -> AnyPublisher<[ReorderFavoritedToolDomainModel], Error> { | ||
|
||
return favoritedResourcesRepository.reorderFavoritedResourcePublisher(id: toolId, originalPosition: originalPosition, newPosition: newPosition) | ||
.map { favoritesReordered in | ||
return favoritesReordered.map { | ||
ReorderFavoritedToolDomainModel(dataModelId: $0.id, position: $0.position) | ||
} | ||
} | ||
.eraseToAnyPublisher() | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
godtools/App/Features/Favorites/Domain/Entities/ReorderFavoritedToolDomainModel.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// ReorderFavoritedToolDomainModel.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 3/28/25. | ||
// Copyright © 2025 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct ReorderFavoritedToolDomainModel { | ||
|
||
let dataModelId: String | ||
let position: Int | ||
} | ||
|
||
extension ReorderFavoritedToolDomainModel: Identifiable { | ||
|
||
var id: String { | ||
return dataModelId | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ols/App/Features/Favorites/Domain/Interface/ReorderFavoritedToolRepositoryInterface.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// ReorderFavoritedToolRepositoryInterface.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 3/19/25. | ||
// Copyright © 2025 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
protocol ReorderFavoritedToolRepositoryInterface { | ||
|
||
func reorderFavoritedToolPubilsher(toolId: String, originalPosition: Int, newPosition: Int) -> AnyPublisher<[ReorderFavoritedToolDomainModel], Error> | ||
} |
24 changes: 24 additions & 0 deletions
24
godtools/App/Features/Favorites/Domain/UseCases/ReorderFavoritedToolUseCase.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// ReorderFavoritedToolUseCase.swift | ||
// godtools | ||
// | ||
// Created by Rachael Skeath on 3/19/25. | ||
// Copyright © 2025 Cru. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
class ReorderFavoritedToolUseCase { | ||
|
||
private let reorderFavoritedToolRepository: ReorderFavoritedToolRepositoryInterface | ||
|
||
init(reorderFavoritedToolRepository: ReorderFavoritedToolRepositoryInterface) { | ||
self.reorderFavoritedToolRepository = reorderFavoritedToolRepository | ||
} | ||
|
||
func reorderFavoritedToolPublisher(toolId: String, originalPosition: Int, newPosition: Int) -> AnyPublisher<[ReorderFavoritedToolDomainModel], Error> { | ||
|
||
return reorderFavoritedToolRepository.reorderFavoritedToolPubilsher(toolId: toolId, originalPosition: originalPosition, newPosition: newPosition) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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. |
||
.flatMap({ (favoritedResources: [FavoritedResourceDataModel]) -> AnyPublisher<[ToolShortcutLinkDomainModel], Never> in | ||
|
||
let toolShortcutLinks: [ToolShortcutLinkDomainModel] = favoritedResources | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.