Conversation
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR modernizes and cleans up a broad set of SwiftUI screens while introducing new progress/HealthKit capabilities and bumping the marketing version to 0.21.
Changes:
- Add a new
ContentServiceHandlerlayer (plus extensions) for meal plan, exercises, and progress (steps/breathing/exercise completion), including HealthKit authorization and step-count background observation. - Update UI surfaces to consume new progress/nutrition inputs (e.g., dashboard diet card now supports “recommended” goal + experimental UI flag).
- Large-scale formatting/style normalization (guards, imports, blank lines), plus removal of several DebugMenu components and related plumbing.
Reviewed changes
Copilot reviewed 150 out of 150 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| MomCare+/TriTrack Glance/Views/MediumWidgetView.swift | Formatting cleanup (blank line removal). |
| MomCare+/TriTrack Glance/Views/LargeWidgetView.swift | Guard formatting + minor layout whitespace cleanup. |
| MomCare+/TriTrack Glance/TriTrack_Glance.swift | Formatting cleanup (blank line removal). |
| MomCare+/MomCare+/Views/TriTrackScreens/TriTrackView.swift | Formatting + shared calendar expansion state usage. |
| MomCare+/MomCare+/Views/TriTrackScreens/TriTrackSymptomsSheetView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/TriTrackSymptomsContentView.swift | Guard formatting + whitespace cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/TriTrackSymptomDetailView.swift | Layout refactor/line splitting. |
| MomCare+/MomCare+/Views/TriTrackScreens/TriTrackCalendarItemContentView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/TriTrackAddEditSymptomSheetView.swift | Guard formatting + whitespace cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/TriTrackAddCalendarItemSheetView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/MapPickerView.swift | Import ordering + whitespace cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/EKReminderView.swift | Import ordering + minor control-flow formatting. |
| MomCare+/MomCare+/Views/TriTrackScreens/EKEventView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackRowLegendView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackReminderRow.swift | Guard formatting + minor style cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackReminderDetailsContextView.swift | Guard formatting + import ordering. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackEventRow.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackEventDetailsContextView.swift | Import ordering + whitespace cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackAllSymptomsView.swift | Guard formatting + whitespace cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackAllRemindersView.swift | Guard formatting + switch expression style cleanup. |
| MomCare+/MomCare+/Views/TriTrackScreens/Components/TriTrackAllCalendarItemView.swift | Guard formatting + whitespace cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/ProfileView.swift | Pass additional measurements into personal info view. |
| MomCare+/MomCare+/Views/ProfileScreens/ProfilePersonalInfoView.swift | Personal info refactor: measurement fields + name parsing improvements. |
| MomCare+/MomCare+/Views/ProfileScreens/ProfileNotificationsView.swift | Guard formatting + minor cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/ProfileMomCareWatchView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/ProfileHealthInfoView.swift | Due date initialization + footer text; remove derived progress rows. |
| MomCare+/MomCare+/Views/ProfileScreens/ProfileAccountSecurityView.swift | Apple identifier handling + security section restructuring. |
| MomCare+/MomCare+/Views/ProfileScreens/ProfileAccountManagementView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/Legal&Compliance/TermsOfServiceView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/Legal&Compliance/PrivacyPolicyView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/Legal&Compliance/GlobalRightsView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/AboutMomCare+/CreditsView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/ProfileScreens/AboutMomCare+/AboutUsView.swift | Minor view-chain formatting. |
| MomCare+/MomCare+/Views/ProfileScreens/AboutMomCare+/AboutMomCareView.swift | Import ordering + formatting cleanup. |
| MomCare+/MomCare+/Views/OnboardingScreens/SignUp/PreferencesSignUpView.swift | Minor whitespace/guard formatting. |
| MomCare+/MomCare+/Views/OnboardingScreens/SignUp/HealthMetricsSignUpView.swift | Guard formatting + missing selections formatting. |
| MomCare+/MomCare+/Views/OnboardingScreens/SignUp/BaseSignUpView.swift | Conditional formatting + missing fields formatting. |
| MomCare+/MomCare+/Views/OnboardingScreens/SignInView.swift | Conditional formatting cleanup. |
| MomCare+/MomCare+/Views/OnboardingScreens/OTPScreenView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/OnboardingScreens/OnboardingView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/MyPlanView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/MyPlanFoodItemSearchView.swift | Guard formatting + minor conditional formatting. |
| MomCare+/MomCare+/Views/MyPlanScreens/MyPlanExercisePlanView.swift | Refresh layout change + steps fetch onAppear. |
| MomCare+/MomCare+/Views/MyPlanScreens/MyPlanDietPlanView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/WaterIntake/WaterLogView.swift | Guard formatting + minor UI cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/WaterIntake/WaterLogListView.swift | Minor layout formatting + cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/WaterIntake/WaterLogEntry.swift | Import ordering + guard formatting + small refactors. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/WaterIntake/WaterAnimationView.swift | Guard formatting + whitespace cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/WeeklyProgressCardView.swift | Guard formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/WalkingHistoryView.swift | Use shared calendar expansion state + add toolbar actions. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/WalkingCardView.swift | Minor whitespace cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/MyPlanExerciseHelpView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/ExerciseInfoSheet.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/ExerciseHistory.swift | Use shared calendar expansion state + add toolbar actions. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/ExerciseCardView.swift | Guard formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/BreathingExerciseView.swift | Guard formatting + small string literal style change. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/ExercisePlan/BreathingCardView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/DietPlan/VitalHistoryStore.swift | Import ordering + switch-expression refactors. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/DietPlan/VitalDetailView.swift | Minor computed property formatting + formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/DietPlan/NutritionProgressCardHelpView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/DietPlan/NutritionGraphRootView.swift | Import ordering + switch-expression refactors. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/DietPlan/MealTimelineCardView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MyPlanScreens/Components/DietPlan/DietPlanHistory.swift | Use shared calendar expansion state + add toolbar actions. |
| MomCare+/MomCare+/Views/MoodNestScreens/PlaylistCards.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MoodNestScreens/MusicPlayerView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MoodNestScreens/MoodNestView.swift | Minor view-chain formatting. |
| MomCare+/MomCare+/Views/MoodNestScreens/MoodNestSongsView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MoodNestScreens/MoodNestPlaylistsView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/MoodNestScreens/MoodAnimation/SemiCircleAnimationView.swift | Guard formatting cleanup. |
| MomCare+/MomCare+/Views/DebugScreens/PermissionsStatusView.swift | Import ordering + switch-expression refactors. |
| MomCare+/MomCare+/Views/DebugScreens/OSLogView.swift | Import ordering + switch-expression refactors. |
| MomCare+/MomCare+/Views/DebugScreens/NotificationTesterView.swift | Switch-expression refactors. |
| MomCare+/MomCare+/Views/DebugScreens/LogsConsoleView.swift | File contents removed (debug console functionality removed). |
| MomCare+/MomCare+/Views/DebugScreens/JSONTreeRow.swift | JSON parsing refactor + guard formatting. |
| MomCare+/MomCare+/Views/DebugScreens/FeatureFlagsView.swift | Introduce experimentalUI flag + new FeatureFlagState enum location. |
| MomCare+/MomCare+/Views/DebugScreens/DeviceInfoView.swift | Import ordering + guard formatting. |
| MomCare+/MomCare+/Views/DebugScreens/DebugMenuView.swift | Remove some debug sections/destinations. |
| MomCare+/MomCare+/Views/DebugScreens/DebugMenuStore.swift | File contents removed (debug store functionality removed). |
| MomCare+/MomCare+/Views/DebugScreens/DataInspectorView.swift | Guard formatting cleanup. |
| MomCare+/MomCare+/Views/DebugScreens/CrashSimulatorView.swift | Remove debug logger usage + formatting cleanup. |
| MomCare+/MomCare+/Views/DebugScreens/AccessibilityInspectorView.swift | Import ordering + formatting cleanup. |
| MomCare+/MomCare+/Views/DashboardScreens/DashboardView.swift | Feed “recommended” nutrition goal + fetch steps onAppear. |
| MomCare+/MomCare+/Views/DashboardScreens/DashboardSnippets/DashboardWeekCardView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/DashboardScreens/DashboardSnippets/DashboardInsightCardView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/DashboardScreens/DashboardSnippets/DashboardExerciseCardView.swift | Remove unused accessibility env vars + formatting cleanup. |
| MomCare+/MomCare+/Views/DashboardScreens/DashboardSnippets/DashboardEventCardView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Views/DashboardScreens/DashboardSnippets/DashboardDietCardView.swift | Support experimental UI and “recommended” goal display/progress. |
| MomCare+/MomCare+/Views/AppCore/MomCareRootView.swift | Remove unused env var + formatting cleanup. |
| MomCare+/MomCare+/Views/AppCore/MomCareMainTabView.swift | Import ordering + error struct formatting + remove unused env object. |
| MomCare+/MomCare+/Views/AppCore/MomCareApp.swift | Remove debug menu store injection + formatting cleanup. |
| MomCare+/MomCare+/Views/AppCore/Components/ReAuthenticationSheetView.swift | Implement Apple re-auth flow + improved error handling. |
| MomCare+/MomCare+/View+UIKit/AppDelegate.swift | Remove debug store wiring + formatting cleanup. |
| MomCare+/MomCare+/MomCare+.entitlements | Enable HealthKit background delivery entitlement. |
| MomCare+/MomCare+/Handlers/MusicPlayerHandler.swift | Guard formatting + minor refactor. |
| MomCare+/MomCare+/Handlers/EventKitHandler.swift | Remove unused params/cancellables + formatting cleanup. |
| MomCare+/MomCare+/Handlers/ContentServiceHandler/StepDataPoint.swift | New step history data type. |
| MomCare+/MomCare+/Handlers/ContentServiceHandler/ContentServiceHandler+Progress.swift | New progress helpers (steps, breathing, weekly progress). |
| MomCare+/MomCare+/Handlers/ContentServiceHandler/ContentServiceHandler+MealPlan.swift | New meal plan + HealthKit nutrition write helpers. |
| MomCare+/MomCare+/Handlers/ContentServiceHandler/ContentServiceHandler+HealthKit.swift | New HealthKit auth + step observation/background delivery logic. |
| MomCare+/MomCare+/Handlers/ContentServiceHandler/ContentServiceHandler+Exercises.swift | New exercise fetch/meta/update helpers. |
| MomCare+/MomCare+/Handlers/ContentServiceHandler/ContentServiceHandler.swift | New content service observable state container. |
| MomCare+/MomCare+/Extensions/UserExerciseModel+ContentService.swift | Guard formatting in async computed property. |
| MomCare+/MomCare+/Extensions/UIScreen+current.swift | Guard formatting cleanup. |
| MomCare+/MomCare+/Extensions/Calendar+CompactCalendarView.swift | Formatting cleanup. |
| MomCare+/Common/Utils.swift | Change week range start day (firstWeekday) behavior. |
| MomCare+/Common/Static/TriTrackData.swift | Guard formatting cleanup. |
| MomCare+/Common/Static/PregnancySymptoms.swift | Formatting cleanup. |
| MomCare+/Common/Static/ModelSpecific/DietaryPreferenceData.swift | Raw value simplification for vegan. |
| MomCare+/Common/Static/IndianStateData.swift | Formatting cleanup. |
| MomCare+/Common/Models/UserModel.swift | Conditional formatting cleanup. |
| MomCare+/Common/Models/SongModel.swift | Guard formatting cleanup. |
| MomCare+/Common/Models/MealPlanModel.swift | Remove redundant returns in computed/switch. |
| MomCare+/Common/KeychainHelper.swift | Guard formatting cleanup. |
| MomCare+/Common/Extensions/URL+Normalization.swift | Minor whitespace formatting. |
| MomCare+/Common/Extensions/Color+Hex.swift | Split multi-declaration for clarity. |
| MomCare+/Common/Extensions/Array+Subscript.swift | Minor whitespace formatting. |
| MomCare+/Common/Database.swift | Add regex-based find helper + import ordering + guard formatting. |
| .swiftformat | Expand enabled SwiftFormat rule set. |
| MomCare+/MomCare.xcodeproj/xcshareddata/xcschemes/TriTrack GlanceExtension.xcscheme | Scheme option update (askForAppToLaunch). |
| MomCare+/MomCare.xcodeproj/project.pbxproj | Bump MARKETING_VERSION to 0.21. |
| MomCare+/MomCare+/DataHandlers/NetworkManager.swift | Remove debug menu plumbing + small refactors. |
| MomCare+/MomCare+/DataHandlers/NetworkLocalizedError.swift | Switch-expression refactors + formatting cleanup. |
| MomCare+/MomCare+/DataHandlers/HTTPErrorResponse.swift | Formatting cleanup + switch-expression refactors. |
| MomCare+/MomCare+/DataHandlers/Endpoint.swift | Formatting cleanup. |
| MomCare+/MomCare+/DataHandlers/ContentRepository+Update.swift | Minor whitespace formatting. |
| MomCare+/MomCare+/DataHandlers/ContentRepository.swift | Remove redundant returns. |
| MomCare+/MomCare+/DataHandlers/AuthenticationService.swift | Ensure credentials fetched after auth ops + fix credentials assignment bug. |
| MomCare+/MomCare+/Components/RingShape.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/ReusableWrappers.swift | Guard formatting cleanup. |
| MomCare+/MomCare+/Components/Onboarding/PickerViews/ValuePickerSheet.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/Onboarding/PickerViews/StatePickerView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/Onboarding/PickerViews/MultiSelectPickerView.swift | Guard formatting cleanup. |
| MomCare+/MomCare+/Components/Onboarding/PickerViews/CountryPickerView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/MultiPlatform/WatchConnector.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/MoodNest/MoodResultViewModel.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/LogSymptomIntent.swift | Remove redundant return. |
| MomCare+/MomCare+/Components/LocationManager.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/HapticsHandler.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/ErrorAlertModifier.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/ControlState.swift | Formatting cleanup (constructor whitespace). |
| MomCare+/MomCare+/Components/Calendar/WeekStripView.swift | Formatting cleanup. |
| MomCare+/MomCare+/Components/Calendar/MonthGridView.swift | Guard/conditional formatting cleanup. |
| MomCare+/MomCare+/Components/Calendar/DayCell.swift | Accessibility label formatting cleanup. |
| MomCare+/MomCare+/Components/Calendar/CompactCalendarView.swift | Guard/conditional formatting cleanup. |
| nonisolated func startStepCountObservation() async throws { | ||
| guard let stepType = HKQuantityType.quantityType(forIdentifier: .stepCount) else { | ||
| fatalError() | ||
| } | ||
|
|
||
| let now = Date() | ||
| let startOfDate = Calendar.current.startOfDay(for: now) | ||
| let predicate = HKQuery.predicateForSamples(withStart: startOfDate, end: now, options: .strictStartDate) | ||
|
|
||
| let query = HKObserverQuery(sampleType: stepType, predicate: predicate) { _, _, error in | ||
| if error != nil { | ||
| return | ||
| } | ||
| self.fetchTodaySteps() | ||
| } | ||
| healthStore.execute(query) | ||
| try await healthStore.enableBackgroundDelivery(for: stepType, frequency: .immediate) | ||
|
|
There was a problem hiding this comment.
startStepCountObservation() sets up an HKObserverQuery but the update handler ignores the provided HKObserverQueryCompletionHandler (it must be called after processing). Without calling it, HealthKit may throttle/stop background deliveries. Also, fatalError() on missing .stepCount type will crash the app; return/throw an error instead.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
MomCare+/MomCare+/Handlers/ContentServiceHandler/ContentServiceHandler.swift
Show resolved
Hide resolved
| func markFoodsAs(consumed: Bool, mealType: MealType) async throws { | ||
| for foodReference in myPlanModel?[mealType] ?? [] { | ||
| Task { | ||
| try await markFoodAs(consumed: consumed, in: mealType, foodReference: foodReference) | ||
| } | ||
| } |
There was a problem hiding this comment.
markFoodsAs(consumed:mealType:) starts a new Task per item but never awaits them, so the function can return before any updates complete and any thrown errors are silently lost. This can also create a burst of concurrent HealthKit writes/network calls and races updating myPlanModel/meta. Prefer awaiting sequentially or using a withThrowingTaskGroup and awaiting completion before returning.
| var shortLabel: String { | ||
| let fmt = DateFormatter() | ||
| fmt.dateFormat = "EEE" | ||
| return fmt.string(from: date) | ||
| } |
There was a problem hiding this comment.
shortLabel creates a new DateFormatter every access. DateFormatters are relatively expensive and this will run for every point render. Consider using Date.FormatStyle or a cached/static formatter (and set locale/timeZone explicitly if needed).
| ToolbarItem(placement: .topBarTrailing) { | ||
| Button { | ||
| selectedDate = Date() | ||
| } label: { | ||
| Image(systemName: "\(Calendar.current.component(.day, from: Date())).calendar") | ||
| .font(.body) | ||
| .foregroundColor(Color.CustomColors.mutedRaspberry) | ||
| } | ||
| .accessibilityLabel(controlState.showingExpandedCalendar ? "Collapse calendar" : "Expand calendar") | ||
| .accessibilityIdentifier("expandCalendarButton") | ||
| } |
There was a problem hiding this comment.
The "jump to today" toolbar button reuses the calendar expand/collapse accessibility label and identifier (expandCalendarButton), which is misleading for VoiceOver and can break UI tests due to duplicate identifiers. Give this button its own label (e.g. "Jump to today") and a distinct identifier.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| ToolbarItem(placement: .topBarTrailing) { | ||
| Button { | ||
| selectedDate = Date() | ||
| } label: { | ||
| Image(systemName: "\(Calendar.current.component(.day, from: Date())).calendar") | ||
| .font(.body) | ||
| .foregroundColor(Color.CustomColors.mutedRaspberry) | ||
| } | ||
| .accessibilityLabel(controlState.showingExpandedCalendar ? "Collapse calendar" : "Expand calendar") | ||
| .accessibilityIdentifier("expandCalendarButton") | ||
| } |
There was a problem hiding this comment.
The "jump to today" toolbar button reuses the calendar expand/collapse accessibility label and identifier (expandCalendarButton). This is misleading for VoiceOver and duplicates identifiers in the toolbar. Use a distinct label/identifier for the today button.
| ToolbarItem(placement: .topBarTrailing) { | ||
| Button { | ||
| selectedDate = Date() | ||
| } label: { | ||
| Image(systemName: "\(Calendar.current.component(.day, from: Date())).calendar") | ||
| .font(.body) | ||
| .foregroundColor(Color.CustomColors.mutedRaspberry) | ||
| } | ||
| .accessibilityLabel(controlState.showingExpandedCalendar ? "Collapse calendar" : "Expand calendar") | ||
| .accessibilityIdentifier("expandCalendarButton") | ||
| } |
There was a problem hiding this comment.
The "jump to today" toolbar button reuses the calendar expand/collapse accessibility label and identifier (expandCalendarButton). This is misleading for VoiceOver and duplicates identifiers in the toolbar. Use a distinct label/identifier for the today button.
MomCare+/MomCare+/Views/AppCore/Components/ReAuthenticationSheetView.swift
Outdated
Show resolved
Hide resolved
…309) * Initial plan * Fix: only dismiss re-authentication sheet on successful Apple login Co-authored-by: rtk-rnjn <37435729+rtk-rnjn@users.noreply.github.com> Agent-Logs-Url: https://github.com/rtk-rnjn/MomCare/sessions/47be7b1c-95f1-44bd-abed-f1357e87713c --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rtk-rnjn <37435729+rtk-rnjn@users.noreply.github.com>
* Initial plan * Fix accessibility label and identifier for jump-to-today button in WalkingHistoryView Co-authored-by: rtk-rnjn <37435729+rtk-rnjn@users.noreply.github.com> Agent-Logs-Url: https://github.com/rtk-rnjn/MomCare/sessions/20d46af5-8203-47ab-b8f9-5518d9d62bde --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rtk-rnjn <37435729+rtk-rnjn@users.noreply.github.com>
… in startStepCountObservation (#307) * Initial plan * Fix startStepCountObservation: call completionHandler and use OSLog instead of fatalError Co-authored-by: rtk-rnjn <37435729+rtk-rnjn@users.noreply.github.com> Agent-Logs-Url: https://github.com/rtk-rnjn/MomCare/sessions/d3252df0-6cec-42e5-8aca-a5fdf8f9a061 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rtk-rnjn <37435729+rtk-rnjn@users.noreply.github.com>
| ) async throws { | ||
| guard let quantityType = HKQuantityType.quantityType(forIdentifier: quantityTypeIdentifier) else { | ||
| return | ||
| } | ||
|
|
||
| let calendar = Calendar.current | ||
| let start = calendar.startOfDay(for: Date()) |
There was a problem hiding this comment.
writeHealthData saves HKQuantitySample entries spanning the entire day (startOfDay → startOfDay+1day). For incremental writes (e.g., logging food/water), this can distort time-based views and makes samples appear at midnight rather than when the user acted. Consider using Date() (or a passed-in timestamp) for start/end so samples reflect the actual event time.
| static func weekRange(containing date: Date) -> [Date] { | ||
| var calendar = Calendar.current | ||
| calendar.firstWeekday = 2 | ||
| calendar.firstWeekday = 1 |
There was a problem hiding this comment.
weekRange(containing:) hard-codes calendar.firstWeekday = 1, which forces a Sunday-based week regardless of the user’s locale/calendar settings. This can make “weekly” charts/calculations misaligned for users whose week starts on Monday (or other days). Prefer respecting Calendar.current.firstWeekday (i.e., don’t override it) unless there’s a strict product requirement.
| calendar.firstWeekday = 1 |
| if let index = self.myPlanModel?[mealType].firstIndex(where: { $0.foodId == foodReference.foodId }) { | ||
| self.myPlanModel?[mealType][index].toggleConsume() | ||
| } | ||
|
|
||
| if let food = await foodReference.food { | ||
| try await consumeFoodInHealthKit(food, consume: consumed) | ||
| } | ||
|
|
||
| await fetchMyPlanMeta() | ||
|
|
||
| _ = try await ContentRepository.shared.markFoodAs(consumed: consumed, planId: myPlanModel._id, meal: mealType, foodId: foodReference.foodId) | ||
| } |
There was a problem hiding this comment.
markFoodAs(consumed:in:foodReference:) mutates local state and writes to HealthKit before the server call. If ContentRepository.shared.markFoodAs(...) fails, the method throws but the UI/HealthKit state has already been updated, leaving the app inconsistent with the backend. Consider either calling the server first, or adding a rollback/retry strategy when the network update fails.
| final class ContentServiceHandler: ObservableObject { | ||
| // MARK: Lifecycle | ||
|
|
There was a problem hiding this comment.
ContentServiceHandler isn’t @MainActor, but many of its async methods assign to @Published properties (e.g., weeklyProgress, nutritionGoalTotals, todayFocusText). These functions can run off the main thread, which can trigger SwiftUI runtime warnings (“Publishing changes from background threads is not allowed”) and lead to racey UI updates. Consider marking the class (or mutation methods) as @MainActor, or wrapping @Published mutations in await MainActor.run { ... }.
| "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; | ||
| MACOSX_DEPLOYMENT_TARGET = 15.0; | ||
| MARKETING_VERSION = 0.20; | ||
| MARKETING_VERSION = 0.21; | ||
| PRODUCT_BUNDLE_IDENTIFIER = com.Team05.MomCare; | ||
| PRODUCT_NAME = "$(TARGET_NAME)"; |
There was a problem hiding this comment.
PR title suggests a “Minor Bug Fix”, but the diff includes broad refactors/feature work (new ContentServiceHandler, HealthKit integration, debug menu removals, extensive formatting churn) in addition to the version bump. Consider updating the PR title/description to reflect the actual scope so reviewers know what to focus on and risk is communicated accurately.
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
Co-Authored-By: Ritik Ranjan <37435729+rtk-rnjn@users.noreply.github.com>
No description provided.