mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Connected watch updates
This commit is contained in:
parent
82f28301ca
commit
704c08803c
2 changed files with 7 additions and 2 deletions
|
|
@ -37,6 +37,12 @@ final class WatchSessionManager: NSObject, ObservableObject {
|
|||
|
||||
// MARK: - Public API
|
||||
|
||||
/// Whether a paired Watch with the Meshtastic app installed is available.
|
||||
var isWatchAvailable: Bool {
|
||||
guard let session, session.activationState == .activated else { return false }
|
||||
return session.isPaired && session.isWatchAppInstalled
|
||||
}
|
||||
|
||||
/// Send a specific node to the Watch as a foxhunt target.
|
||||
/// The Watch will pin this node in its foxhunt list regardless of distance.
|
||||
func sendNodeForFoxhunt(_ nodeNum: Int64) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import WeatherKit
|
|||
import MapKit
|
||||
import CoreLocation
|
||||
import OSLog
|
||||
import WatchConnectivity
|
||||
|
||||
struct NodeDetail: View {
|
||||
private let gridItemLayout = Array(repeating: GridItem(.flexible(), spacing: 10), count: 2)
|
||||
|
|
@ -480,7 +479,7 @@ struct NodeDetail: View {
|
|||
}
|
||||
if node.hasPositions {
|
||||
#if !targetEnvironment(macCatalyst)
|
||||
if node.latestPosition?.isPreciseLocation == true && WCSession.isSupported() && WCSession.default.isPaired && WCSession.default.isWatchAppInstalled {
|
||||
if node.latestPosition?.isPreciseLocation == true && WatchSessionManager.shared.isWatchAvailable {
|
||||
Button {
|
||||
WatchSessionManager.shared.sendNodeForFoxhunt(node.num)
|
||||
} label: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue