-
Notifications
You must be signed in to change notification settings - Fork 13
Remove stones as a weight unit, keeping only pounds and kilograms #12
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: pierceboggan <[email protected]>
Co-authored-by: pierceboggan <[email protected]>
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.
Pull Request Overview
This PR removes support for stones as a weight unit, streamlines the UI, and adds migration for existing stone-based users to pounds.
- Removed
.stonescases and conversion logic from models - Simplified onboarding and settings views to only handle pounds and kilograms
- Introduced a migration path in
UserDataManagerand updated tests accordingly
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Dropped/Models/UserData.swift | Removed stones enum cases and conversion logic; added migration logic |
| Dropped/Views/SettingsView.swift | Removed stones picker UI |
| Dropped/Views/OnboardingView.swift | Removed stones option in onboarding |
| Dropped/ViewModels/OnboardingViewModel.swift | Removed showStonesOption and related logic |
| DroppedTests/UserDataTests.swift | Removed stones tests; added migration and allCases verification |
| DroppedTests/OnboardingViewModelTests.swift | Updated tests to reflect pounds↔kilograms flows |
| if userData.weightUnit == "st" { | ||
| var migratedData = userData | ||
| migratedData.weightUnit = WeightUnit.pounds.rawValue | ||
| self.userData = migratedData |
Copilot
AI
Jun 13, 2025
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.
The migration logic updates in-memory userData but does not persist these changes to storage. Consider calling saveUserData(migratedData) within this block to ensure the migration is saved.
| self.userData = migratedData | |
| saveUserData(migratedData) |
|
|
||
| func loadUserData() -> UserData { | ||
| // Migrate any existing stones users to pounds | ||
| if userData.weightUnit == "st" { |
Copilot
AI
Jun 13, 2025
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.
[nitpick] Avoid using the hardcoded literal "st". Define a legacy constant or extension to represent the old stones unit, which improves readability and reduces magic strings.
| if userData.weightUnit == "st" { | |
| if userData.weightUnit == WeightUnit.stones.rawValue { |
…opped directory
This PR removes support for stones as a weight unit from the Dropped cycling app, focusing only on imperial (pounds) and metric (kilograms) units as requested in the issue.
Changes Made
Core Model Updates
.stones = "st"case from the enumconvert()functionUI Simplification
showStonesOptionproperty and related logicTest Updates
Migration Strategy
Existing users who had stones selected will be automatically migrated to pounds when their data is loaded. The weight value remains stored in kilograms internally for consistency, but the display unit preference is changed from "st" to "lb".
Before/After Comparison
Before: 3 weight units (pounds, kilograms, stones)
After: 2 weight units (pounds, kilograms)
The UI now presents a clean imperial/metric toggle without the additional complexity of stones selection.
Fixes #11.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.