From 18194ccc677503bf52fa52bebd8b983c1c708827 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 4 Jan 2026 13:47:50 -0800 Subject: [PATCH 1/4] Don't add new BLE devices to the device list in the backgournd --- .../Accessory Manager/AccessoryManager+Discovery.swift | 8 ++++++-- .../Accessory/Accessory Manager/AccessoryManager.swift | 1 + Meshtastic/MeshtasticApp.swift | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Meshtastic/Accessory/Accessory Manager/AccessoryManager+Discovery.swift b/Meshtastic/Accessory/Accessory Manager/AccessoryManager+Discovery.swift index 831ffe309..266b69459 100644 --- a/Meshtastic/Accessory/Accessory Manager/AccessoryManager+Discovery.swift +++ b/Meshtastic/Accessory/Accessory Manager/AccessoryManager+Discovery.swift @@ -52,8 +52,12 @@ extension AccessoryManager { existing.rssi = newDevice.rssi self.devices[index] = existing } else { - // This is a new device, add it to our list - self.devices.append(newDevice) + // This is a new device, add it to our list if we are in the foreground + if !(self.isInBackground) { + self.devices.append(newDevice) + } else { + Logger.transport.debug("🔎 [Discovery] Found a new device but not in the foreground, not adding to our list: peripheral \(newDevice.name)") + } } if self.shouldAutomaticallyConnectToPreferredPeripheral, diff --git a/Meshtastic/Accessory/Accessory Manager/AccessoryManager.swift b/Meshtastic/Accessory/Accessory Manager/AccessoryManager.swift index 075138666..94bd1cff3 100644 --- a/Meshtastic/Accessory/Accessory Manager/AccessoryManager.swift +++ b/Meshtastic/Accessory/Accessory Manager/AccessoryManager.swift @@ -135,6 +135,7 @@ class AccessoryManager: ObservableObject, MqttClientProxyManagerDelegate { @Published var lastConnectionError: Error? @Published var isConnected: Bool = false @Published var isConnecting: Bool = false + @Published var isInBackground: Bool = false var activeConnection: (device: Device, connection: any Connection)? diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index d60ed940e..8e35ae4c9 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -193,6 +193,8 @@ struct MeshtasticAppleApp: App { } } .onChange(of: scenePhase) { (_, newScenePhase) in + + accessoryManager.isInBackground = (newScenePhase != .active) switch newScenePhase { case .background: Logger.services.info("🎬 [App] Scene is in the background") From 8643632240ae6c349d8ba7fa52153bbeadccd478 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 4 Jan 2026 13:48:54 -0800 Subject: [PATCH 2/4] Bump version --- Meshtastic.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index b87ce5f2c..cd52c4967 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -2102,7 +2102,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.6; - MARKETING_VERSION = 2.7.6; + MARKETING_VERSION = 2.7.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -2137,7 +2137,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.6; - MARKETING_VERSION = 2.7.6; + MARKETING_VERSION = 2.7.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -2169,7 +2169,7 @@ "@executable_path/../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.6; - MARKETING_VERSION = 2.7.6; + MARKETING_VERSION = 2.7.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2202,7 +2202,7 @@ "@executable_path/../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.6; - MARKETING_VERSION = 2.7.6; + MARKETING_VERSION = 2.7.7; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; From 09f6d9f3a23d77f33e8c9fc4053e629440398ddb Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 4 Jan 2026 20:14:08 -0800 Subject: [PATCH 3/4] Update Meshtastic/MeshtasticApp.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Meshtastic/MeshtasticApp.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index 8e35ae4c9..7abea6fa0 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -194,7 +194,7 @@ struct MeshtasticAppleApp: App { } .onChange(of: scenePhase) { (_, newScenePhase) in - accessoryManager.isInBackground = (newScenePhase != .active) + accessoryManager.isInBackground = (newScenePhase == .background) switch newScenePhase { case .background: Logger.services.info("🎬 [App] Scene is in the background") From 37edc142dd3214ea7a89c22361ef1a8c5621e5a2 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 4 Jan 2026 20:14:16 -0800 Subject: [PATCH 4/4] Update Meshtastic/MeshtasticApp.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Meshtastic/MeshtasticApp.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index 7abea6fa0..5c42dd22c 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -193,7 +193,6 @@ struct MeshtasticAppleApp: App { } } .onChange(of: scenePhase) { (_, newScenePhase) in - accessoryManager.isInBackground = (newScenePhase == .background) switch newScenePhase { case .background: