From e4b664c0bdb694f9ff1dca1dc0a217b4fa2085d6 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 13 Dec 2024 09:57:09 -0800 Subject: [PATCH] Exclude live activity code from Mac better --- Meshtastic/Helpers/MeshPackets.swift | 4 +++- Meshtastic/Views/Bluetooth/Connect.swift | 7 ++++--- Widgets/MeshActivityAttributes.swift | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Meshtastic/Helpers/MeshPackets.swift b/Meshtastic/Helpers/MeshPackets.swift index 04088e69..b2f59586 100644 --- a/Meshtastic/Helpers/MeshPackets.swift +++ b/Meshtastic/Helpers/MeshPackets.swift @@ -772,7 +772,8 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage } } } else if telemetry.metricsType == 4 { - // Update our live activity if there is one running, not available on mac iOS >= 16.2 + // Update our live activity if there is one running, not available on mac +#if !targetEnvironment(macCatalyst) #if canImport(ActivityKit) let fifteenMinutesLater = Calendar.current.date(byAdding: .minute, value: (Int(15) ), to: Date())! @@ -801,6 +802,7 @@ func telemetryPacket(packet: MeshPacket, connectedNode: Int64, context: NSManage Logger.services.debug("Updated live activity.") } } +#endif #endif } } catch { diff --git a/Meshtastic/Views/Bluetooth/Connect.swift b/Meshtastic/Views/Bluetooth/Connect.swift index be466530..a424cbf0 100644 --- a/Meshtastic/Views/Bluetooth/Connect.swift +++ b/Meshtastic/Views/Bluetooth/Connect.swift @@ -324,7 +324,8 @@ struct Connect: View { } } } - #if canImport(ActivityKit) +#if !targetEnvironment(macCatalyst) +#if canImport(ActivityKit) func startNodeActivity() { liveActivityStarted = true // 15 Minutes Local Stats Interval @@ -367,8 +368,8 @@ struct Connect: View { } } } - #endif - +#endif +#endif func didDismissSheet() { bleManager.disconnectPeripheral(reconnect: false) } diff --git a/Widgets/MeshActivityAttributes.swift b/Widgets/MeshActivityAttributes.swift index 876b75de..37376531 100644 --- a/Widgets/MeshActivityAttributes.swift +++ b/Widgets/MeshActivityAttributes.swift @@ -4,7 +4,7 @@ // // Created by Garth Vander Houwen on 3/1/23. // - +#if !targetEnvironment(macCatalyst) #if canImport(ActivityKit) import ActivityKit @@ -36,3 +36,4 @@ struct MeshActivityAttributes: ActivityAttributes { var name: String } #endif +#endif