Explorar el Código

make BLE manager optional

polscm32 hace 1 año
padre
commit
b2205060ed

+ 2 - 2
Trio/Sources/Modules/Home/View/Header/CurrentGlucoseView.swift

@@ -11,7 +11,7 @@ struct CurrentGlucoseView: View {
     var currentGlucoseTarget: Decimal
     let glucoseColorScheme: GlucoseColorScheme
     let glucose: [GlucoseStored] // This contains the last two glucose values, no matter if its manual or a cgm reading
-    let bluetoothManager: BluetoothStateManager
+    let bluetoothManager: BluetoothStateManager?
     @State private var rotationDegrees: Double = 0.0
     @State private var angularGradient = AngularGradient(colors: [
         Color(red: 0.7215686275, green: 0.3411764706, blue: 1),
@@ -42,7 +42,7 @@ struct CurrentGlucoseView: View {
     var body: some View {
         let triangleColor = Color(red: 0.262745098, green: 0.7333333333, blue: 0.9137254902)
 
-        if bluetoothManager.bluetoothAuthorization != .authorized {
+        if let bluetoothManager = bluetoothManager, bluetoothManager.bluetoothAuthorization != .authorized {
             VStack(alignment: .center, spacing: 12) {
                 HStack {
                     Image(systemName: "exclamationmark.triangle.fill")

+ 2 - 2
Trio/Sources/Modules/Home/View/Header/PumpView.swift

@@ -8,7 +8,7 @@ struct PumpView: View {
     let timerDate: Date
     let pumpStatusHighlightMessage: String?
     let battery: [OpenAPS_Battery]
-    let bluetoothManager: BluetoothStateManager
+    let bluetoothManager: BluetoothStateManager?
     @Environment(\.colorScheme) var colorScheme
 
     private var batteryFormatter: NumberFormatter {
@@ -18,7 +18,7 @@ struct PumpView: View {
     }
 
     var body: some View {
-        if bluetoothManager.bluetoothAuthorization != .authorized {
+        if let bluetoothManager = bluetoothManager, bluetoothManager.bluetoothAuthorization != .authorized {
             VStack(alignment: .center, spacing: 12) {
                 HStack {
                     Image(systemName: "exclamationmark.triangle.fill")