From d16268c34f15e4ae830de364b40ba82c9343ad42 Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Fri, 9 Jan 2026 19:43:12 -0500 Subject: [PATCH] general: remove debug logs --- Gaze/AppDelegate.swift | 3 --- Gaze/GazeApp.swift | 2 -- Gaze/Services/TimerEngine.swift | 22 ---------------------- Gaze/Views/SettingsWindowView.swift | 7 ------- 4 files changed, 34 deletions(-) diff --git a/Gaze/AppDelegate.swift b/Gaze/AppDelegate.swift index d2a8138..419ba10 100644 --- a/Gaze/AppDelegate.swift +++ b/Gaze/AppDelegate.swift @@ -49,12 +49,9 @@ class AppDelegate: NSObject, NSApplicationDelegate { private func observeSettingsChanges() { settingsManager?.$settings .sink { [weak self] settings in - print("📢 [AppDelegate] Settings changed!") if settings.hasCompletedOnboarding && self?.hasStartedTimers == false { - print("📢 [AppDelegate] Starting timers for first time") self?.startTimers() } else if self?.hasStartedTimers == true { - print("📢 [AppDelegate] Restarting timers with new config") // Defer timer restart to next runloop to ensure settings are fully propagated DispatchQueue.main.async { self?.timerEngine?.start() diff --git a/Gaze/GazeApp.swift b/Gaze/GazeApp.swift index 316298a..2359fe5 100644 --- a/Gaze/GazeApp.swift +++ b/Gaze/GazeApp.swift @@ -41,7 +41,6 @@ struct GazeApp: App { // Menu bar extra (always present once onboarding is complete) MenuBarExtra("Gaze", systemImage: "eye.fill") { if let timerEngine = appDelegate.timerEngine { - let _ = print("🔵 [GazeApp] MenuBarExtra body evaluated, refreshID: \(menuBarRefreshID)") MenuBarContentView( timerEngine: timerEngine, settingsManager: settingsManager, @@ -55,7 +54,6 @@ struct GazeApp: App { .menuBarExtraStyle(.window) .onChange(of: settingsManager.settings) { _ in menuBarRefreshID += 1 - print("🔵 [GazeApp] Settings changed, refreshID now: \(menuBarRefreshID)") } } diff --git a/Gaze/Services/TimerEngine.swift b/Gaze/Services/TimerEngine.swift index 35ec1cb..5b3cea4 100644 --- a/Gaze/Services/TimerEngine.swift +++ b/Gaze/Services/TimerEngine.swift @@ -24,17 +24,12 @@ class TimerEngine: ObservableObject { } func start() { - print("🎯 [TimerEngine] start() called, subscription exists: \(timerSubscription != nil)") - // If timers are already running, just update configurations without resetting if timerSubscription != nil { - print("🎯 [TimerEngine] Updating existing configurations") updateConfigurations() return } - print("🎯 [TimerEngine] Initial start - creating all timer states") - // Initial start - create all timer states stop() @@ -49,13 +44,11 @@ class TimerEngine: ObservableObject { isPaused: false, isActive: true ) - print("🎯 [TimerEngine] Created state for \(timerType.displayName): \(config.intervalSeconds)s") } } // Assign the entire dictionary at once to trigger @Published timerStates = newStates - print("🎯 [TimerEngine] Assigned \(newStates.count) timer states") // Start user timers for userTimer in settingsManager.settings.userTimers { @@ -72,21 +65,16 @@ class TimerEngine: ObservableObject { } private func updateConfigurations() { - print("🔄 [TimerEngine] updateConfigurations() called") - print("🔄 [TimerEngine] Current timerStates keys: \(timerStates.keys.map { $0.displayName })") var newStates: [TimerType: TimerState] = [:] for timerType in TimerType.allCases { let config = settingsManager.timerConfiguration(for: timerType) - print("🔄 [TimerEngine] Processing \(timerType.displayName): enabled=\(config.enabled), intervalSeconds=\(config.intervalSeconds)") if config.enabled { if let existingState = timerStates[timerType] { // Timer exists - check if interval changed - print("🔄 [TimerEngine] \(timerType.displayName) exists in current states") if existingState.originalIntervalSeconds != config.intervalSeconds { // Interval changed - reset with new interval - print("🔄 [TimerEngine] \(timerType.displayName) interval changed: \(existingState.originalIntervalSeconds)s -> \(config.intervalSeconds)s, resetting") newStates[timerType] = TimerState( type: timerType, intervalSeconds: config.intervalSeconds, @@ -95,12 +83,10 @@ class TimerEngine: ObservableObject { ) } else { // Interval unchanged - keep existing state - print("🔄 [TimerEngine] \(timerType.displayName) unchanged, keeping state (remaining: \(existingState.remainingSeconds)s)") newStates[timerType] = existingState } } else { // Timer was just enabled - create new state - print("🔄 [TimerEngine] \(timerType.displayName) NOT in current states, newly enabled, creating state") newStates[timerType] = TimerState( type: timerType, intervalSeconds: config.intervalSeconds, @@ -108,18 +94,10 @@ class TimerEngine: ObservableObject { isActive: true ) } - } else { - if timerStates[timerType] != nil { - print("🔄 [TimerEngine] \(timerType.displayName) disabled, removing state") - } else { - print("🔄 [TimerEngine] \(timerType.displayName) disabled and not in current states") - } } // If config.enabled is false and timer exists, it will be removed } - print("🔄 [TimerEngine] New states keys: \(newStates.keys.map { $0.displayName })") - print("🔄 [TimerEngine] Assigning \(newStates.count) timer states (was \(timerStates.count))") // Assign the entire dictionary at once to trigger @Published timerStates = newStates diff --git a/Gaze/Views/SettingsWindowView.swift b/Gaze/Views/SettingsWindowView.swift index cc7ce11..a9e131f 100644 --- a/Gaze/Views/SettingsWindowView.swift +++ b/Gaze/Views/SettingsWindowView.swift @@ -120,8 +120,6 @@ struct SettingsWindowView: View { } private func applySettings() { - print("🔧 [SettingsWindow] Applying settings...") - // Create a new AppSettings object with updated values // This triggers the didSet observer in SettingsManager let updatedSettings = AppSettings( @@ -145,13 +143,8 @@ struct SettingsWindowView: View { playSounds: settingsManager.settings.playSounds ) - print("🔧 [SettingsWindow] Old settings - Blink: \(settingsManager.settings.blinkTimer.enabled), interval: \(settingsManager.settings.blinkTimer.intervalSeconds)") - print("🔧 [SettingsWindow] New settings - Blink: \(updatedSettings.blinkTimer.enabled), interval: \(updatedSettings.blinkTimer.intervalSeconds)") - // Assign the entire settings object to trigger didSet and observers settingsManager.settings = updatedSettings - - print("🔧 [SettingsWindow] Settings assigned to manager") do { if launchAtLogin {