diff --git a/LibreTransmitter/LibreTransmitterManager+Transmitters.swift b/LibreTransmitter/LibreTransmitterManager+Transmitters.swift index b8ea2ed..d13e62f 100644 --- a/LibreTransmitter/LibreTransmitterManager+Transmitters.swift +++ b/LibreTransmitter/LibreTransmitterManager+Transmitters.swift @@ -216,14 +216,11 @@ extension LibreTransmitterManagerV3 { self.transmitterInfoObservable.connectionState = self.proxy?.connectionStateString ?? "n/a" self.transmitterInfoObservable.transmitterType = self.proxy?.shortTransmitterName ?? "Unknown" } - switch state { - case .Connected: + + if case .Connected = state { lastConnected = Date() - case .powerOff: - NotificationHelper.sendBluetoothPowerOffNotification() - default: - break } + return } diff --git a/LibreTransmitter/LibreTransmitterManagerV3.swift b/LibreTransmitter/LibreTransmitterManagerV3.swift index de72574..4160932 100644 --- a/LibreTransmitter/LibreTransmitterManagerV3.swift +++ b/LibreTransmitter/LibreTransmitterManagerV3.swift @@ -53,8 +53,8 @@ open class LibreTransmitterManagerV3: CGMManager, LibreTransmitterDelegate { public func libreManagerDidRestoreState(found peripherals: [CBPeripheral], connected to: CBPeripheral?) { let devicename = to?.name ?? "no device" let id = to?.identifier.uuidString ?? "null" - let msg = "Bluetooth State restored (Loop restarted?). Found \(peripherals.count) peripherals, and connected to \(devicename) with identifier \(id)" - NotificationHelper.sendRestoredStateNotification(msg: msg) + + logger.debug("Bluetooth State restored (Loop restarted?). Found \(peripherals.count) peripherals, and connected to \(devicename) with identifier \(id)") } public var batteryLevel: Double? { diff --git a/LibreTransmitter/NotificationHelper.swift b/LibreTransmitter/NotificationHelper.swift index 71389e5..95f74fe 100644 --- a/LibreTransmitter/NotificationHelper.swift +++ b/LibreTransmitter/NotificationHelper.swift @@ -26,10 +26,8 @@ public enum NotificationHelper { case lowBattery = "com.loopkit.libremiaomiao.lowbattery-notification" case sensorExpire = "com.loopkit.libremiaomiao.SensorExpire-notification" case noBridgeSelected = "com.loopkit.libremiaomiao.noBridgeSelected-notification" - case bluetoothPoweredOff = "com.loopkit.libremiaomiao.bluetoothPoweredOff-notification" case invalidChecksum = "com.loopkit.libremiaomiao.invalidChecksum-notification" case calibrationOngoing = "com.loopkit.libremiaomiao.calibration-notification" - case restoredState = "com.loopkit.libremiaomiao.state-notification" case libre2directFinishedSetup = "com.loopkit.libremiaomiao.libre2direct-notification" } @@ -307,29 +305,7 @@ public extension NotificationHelper { // MARK: - Notification sendout public extension NotificationHelper { - static func sendRestoredStateNotification(msg: String) { - ensureCanSendNotification { - logger.debug("\(#function) sending RestoredStateNotification") - - let content = UNMutableNotificationContent() - content.title = "State was restored" - content.body = msg - - addRequest(identifier: .restoredState, content: content, deleteOld: true ) - } - } - - static func sendBluetoothPowerOffNotification() { - ensureCanSendNotification { - logger.debug("\(#function) sending BluetoothPowerOffNotification") - - let content = UNMutableNotificationContent() - content.title = "Bluetooth Power Off" - content.body = "Please turn on Bluetooth" - - addRequest(identifier: .bluetoothPoweredOff, content: content) - } - } + static func sendNoTransmitterSelectedNotification() { ensureCanSendNotification {