diff --git a/MealMood/Services/CalendarService.swift b/MealMood/Services/CalendarService.swift index d4c8629..139f979 100644 --- a/MealMood/Services/CalendarService.swift +++ b/MealMood/Services/CalendarService.swift @@ -12,6 +12,7 @@ final class CalendarService { do { return try await eventStore.requestFullAccessToEvents() } catch { + CrashlyticsService.record(error, context: "calendar_access") print("Calendar access error: \(error)") return false } @@ -55,6 +56,7 @@ final class CalendarService { try eventStore.save(event, span: .thisEvent) return event.eventIdentifier } catch { + CrashlyticsService.record(error, context: "calendar_create") print("Error saving event: \(error)") return nil } @@ -99,6 +101,7 @@ final class CalendarService { try eventStore.save(event, span: .thisEvent) return event.eventIdentifier } catch { + CrashlyticsService.record(error, context: "calendar_update") print("Error updating event: \(error)") return nil } @@ -109,6 +112,7 @@ final class CalendarService { do { try eventStore.remove(event, span: .thisEvent) } catch { + CrashlyticsService.record(error, context: "calendar_delete") print("Error deleting event: \(error)") } } diff --git a/MealMood/Services/StoreManager.swift b/MealMood/Services/StoreManager.swift index 7b53dd6..644c268 100644 --- a/MealMood/Services/StoreManager.swift +++ b/MealMood/Services/StoreManager.swift @@ -65,6 +65,7 @@ final class StoreManager: ObservableObject { productLoadState = .timedOut } else { productLoadState = .failed + CrashlyticsService.record(error, context: "load_products") } print("Failed to load products: \(error)") } @@ -93,6 +94,7 @@ final class StoreManager: ObservableObject { return .failed } } catch { + CrashlyticsService.record(error, context: "purchase") print("Purchase failed: \(error)") return .failed } @@ -110,6 +112,7 @@ final class StoreManager: ObservableObject { AnalyticsService.logPremiumRestored() } } catch { + CrashlyticsService.record(error, context: "restore") print("Restore failed: \(error)") } } diff --git a/MealMood/ViewModels/OnboardingViewModel.swift b/MealMood/ViewModels/OnboardingViewModel.swift index e59610c..40b4354 100644 --- a/MealMood/ViewModels/OnboardingViewModel.swift +++ b/MealMood/ViewModels/OnboardingViewModel.swift @@ -172,6 +172,7 @@ final class OnboardingViewModel: ObservableObject { UserDefaults.standard.set(true, forKey: Self.pendingPremiumPromptKey) return true } catch { + CrashlyticsService.record(error, context: "onboarding_save") print("Onboarding save failed: \(error)") return false } diff --git a/MealMood/ViewModels/SettingsViewModel.swift b/MealMood/ViewModels/SettingsViewModel.swift index 0c0729d..63a0048 100644 --- a/MealMood/ViewModels/SettingsViewModel.swift +++ b/MealMood/ViewModels/SettingsViewModel.swift @@ -97,12 +97,14 @@ final class SettingsViewModel: ObservableObject { UserDefaults.standard.set(false, forKey: OnboardingViewModel.pendingPremiumPromptKey) try context.save() } catch { + CrashlyticsService.record(error, context: "reset_all_data") #if DEBUG print("Failed to complete reset all data: \(error)") #endif } } } catch { + CrashlyticsService.record(error, context: "reset_all_data_start") #if DEBUG print("Failed to start reset all data: \(error)") #endif