Exclude live activity code from Mac better

This commit is contained in:
Garth Vander Houwen 2024-12-13 09:57:09 -08:00
parent 1e63bfa85f
commit e4b664c0bd
3 changed files with 9 additions and 5 deletions

View file

@ -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 {

View file

@ -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)
}

View file

@ -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