Complete CloudKit Integration with Enhanced UI/UX#5
Merged
Conversation
- Fix DayStorage to properly save Day objects with persistent IDs - Remove duplicate DayStorage entries for the same date - Clean up orphaned Day references - Add duplicate date cleanup in daysRecorded array - Improve logging for better debugging of calendar data flow The workout data now properly saves when completed and displays correctly when clicking on calendar days with red dots.
…jects This prevents accidentally deleting template days (like Upper 1) that belong to splits. The previous logic was too complex and was incorrectly identifying template days.
## Major Features Added: - ✅ HealthKit permissions now stored in UserDefaults (no CloudKit sync) - ✅ Calendar red dots show correctly after app reinstall - ✅ Profile image refreshes immediately after login/CloudKit sync - ✅ SignInView redesigned to match app's FloatingClouds theme - ✅ BMI cell color updates immediately when HealthKit status changes ## HealthKit Integration: - Fixed toggle state to reflect actual HealthKit permissions on reinstall - Toggle automatically syncs with actual system permissions - Uses local UserDefaults instead of CloudKit for permission state - Settings view refreshes HealthKit data when permissions change ## Calendar Improvements: - Red dots now appear for workout days even after fresh install - Calendar checks both daysRecorded array AND actual DayStorage entries - Automatic cleanup rebuilds daysRecorded from DayStorage on view appear - Fixed duplicate date issues in daysRecorded array ## Profile & UI Enhancements: - Profile image loads immediately after CloudKit sync completes - SignInView now uses consistent FloatingClouds design - Better visual consistency across the entire app - Improved login flow with proper timing for CloudKit sync ## Bug Fixes: - Fixed deletion logic to prevent accidental removal of template exercises - Safer workout history cleanup (only removes DayStorage, preserves Day objects) - Resolved compiler timeout issues in TodayWorkoutView - Fixed BMI color not updating when HealthKit status changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review: CloudKit Integration with Enhanced UI/UX✅ Strengths
🔍 Code Quality & Best Practices1. Redundant Code & Optimization
2. Property Naming Convention
🐛 Potential Bugs1. Race Condition in Profile Image Loading
2. Force Unwrapping Risk
⚡ Performance Considerations1. Excessive Logging in Production
2. Main Thread Blocking
🔒 Security Concerns1. UserDefaults for Sensitive Data
2. Missing Error Handling
🧪 Test CoverageCritical Missing Tests:
Recommended Test Cases:// Example test structure needed
func testCalendarDuplicateCleanup() {
// Test removing duplicate dates
// Test rebuilding from DayStorage
// Test fallback when fetch fails
}
func testHealthKitPermissionSync() {
// Test toggle state matches actual permissions
// Test persistence across app launches
}📝 Additional Recommendations
🎯 Priority Fixes
Overall, this is a solid implementation with good attention to user experience. The main concerns are around error handling, test coverage, and some performance optimizations. Great work on the comprehensive CloudKit integration! 🚀 |
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.
Summary
🚀 Major CloudKit integration milestone with comprehensive UI/UX improvements and critical bug fixes!
🔧 HealthKit Integration
📅 Calendar Enhancements
👤 Profile & Authentication
🐛 Critical Bug Fixes
Test plan
🤖 Generated with Claude Code