From 3172ac2c71630fae69f66328a6748fc9cab5624c Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Tue, 1 Jul 2025 13:33:38 +1000 Subject: [PATCH] feat: send push notifications on VPN failures --- Coder-Desktop/Coder-Desktop/VPN/VPNService.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Coder-Desktop/Coder-Desktop/VPN/VPNService.swift b/Coder-Desktop/Coder-Desktop/VPN/VPNService.swift index 224174ae..3addcd4b 100644 --- a/Coder-Desktop/Coder-Desktop/VPN/VPNService.swift +++ b/Coder-Desktop/Coder-Desktop/VPN/VPNService.swift @@ -61,6 +61,15 @@ final class CoderVPNService: NSObject, VPNService { if tunnelState == .connecting { progress = .init(stage: .initial, downloadProgress: nil) } + if case let .failed(tunnelError) = tunnelState, tunnelState != oldValue { + Task { + do { + try await sendNotification(title: "Coder Connect has failed!", body: tunnelError.description) + } catch let notifError { + logger.error("Failed to send notification (\(tunnelError.description)): \(notifError)") + } + } + } } }