Conversation
Custom runners and custom metrics sources were listed in the order they were registered, and the only way to change that order was to remove an entry and add it again. Both settings sections now use List + onMove, and the new order is persisted. - Add RunnerService.move and CustomMetricsService.moveSources, driven by the onMoveCustomRunnerRow / onMoveCustomMetricsSourceRow actions - Replace the frame image DropDelegate with a reusable SortableViewModifier built on draggable / dropDestination - Extract CustomRunnerRowView, replace Runner.displayText with formatted, and rename RunnerService.save(customRunner:with:) to add(customRunner:with:) - Cover the new actions and service methods with tests, and align the test order with the Action and method declaration order Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context of Contribution
Summary of the Proposal
Custom runners and custom metrics sources can now be reordered by dragging their rows in Settings, and the new order is persisted.
Listand useonMove, which brings the standard drag handle and drop animation. The custom runner row is extracted intoCustomRunnerRowView.CustomRunnerSettings.onMoveCustomRunnerRowandCustomMetricsSettings.onMoveCustomMetricsSourceRow, backed byRunnerService.move(fromOffsets:toOffset:)(rewritesCUSTOM_RUNNERS.jsonand reloads the bundle list) andCustomMetricsService.moveSources(fromOffsets:toOffset:)(rewritesCustomMetricsConfiguration.sourcesand emits a configuration change).Minor changes that come with it:
SortableViewModifierbuilt ondraggable/dropDestination, replacing the oldDropDelegate.RunnerService.save(customRunner:with:)is renamed toadd(customRunner:with:)so it reads as the counterpart ofdelete(customRunner:)/move(fromOffsets:toOffset:).Runner.displayText: TextbecomesRunner.formatted: String, so the row views decide how to render it.CriticalEvent.sortingCustomRunnersFailedfor the failure path of the reordering.Actioncases and their test cases are put back in the same order, so a case and its tests stay easy to pair up.Tests: 169 tests pass locally (
LocalPackage-Packagescheme, macOS arm64). The new actions and the two new service methods are covered.Reason for the new feature
The order of custom runners and custom metrics sources is the order they appear in the runner picker and the metrics bar, but until now it was fixed to the order in which they were added. The only way to move an item was to delete it and add it back — for custom runners that means re-importing every frame image. Users who register several runners or several JSON sources hit this quickly.
onMoveon aListis a stock SwiftUI API, so the maintenance cost is limited to the two service methods that rewrite the persisted order, both of which are unit tested.Checklist
DependencyClient, no logic inUserInterfaceviews, no Asset/String Catalog references fromModel.Related Issues
close #59