mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
Per Vitor's review of #3221: wake-detection is platform-specific UX, not NostrClient's job. Quartz already exposes `reconnect(onlyIfChanged = false, ignoreRetryDelays = true)` which does the full disconnect + connect — the app layer just needs to call it when it detects a wake. - Revert the keep-alive heuristic in NostrClient.kt; the loop is back to the conservative `reconnectIfNeedsTo` path it had before. - Add `runSleepResumeMonitor` (desktopApp/network/SleepResumeMonitor.kt): a 60s tick that watches for wall-clock overshoot and calls the supplied `onWake` lambda. No native deps. - Wire it in `Main.kt` next to the metrics LaunchedEffect: on >5x overshoot call `relayManager.client.reconnect(onlyIfChanged = false, ignoreRetryDelays = true)`. Real OS sleep events (NSWorkspace on macOS, D-Bus PrepareForSleep on Linux, WM_POWERBROADCAST on Windows) can be layered in later as platform improvements without touching Quartz again.