From 9ff57db2275e9ca7367a5831fa4b8be02dfa8ab2 Mon Sep 17 00:00:00 2001 From: liamcharger Date: Thu, 2 May 2024 10:19:53 -0400 Subject: [PATCH] Fix weather not fetching --- InfiniLink/BLE/BLEUpdateHandler.swift | 4 +--- InfiniLink/Core/Weather/WeatherController.swift | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/InfiniLink/BLE/BLEUpdateHandler.swift b/InfiniLink/BLE/BLEUpdateHandler.swift index 26058d3..90a9745 100644 --- a/InfiniLink/BLE/BLEUpdateHandler.swift +++ b/InfiniLink/BLE/BLEUpdateHandler.swift @@ -36,9 +36,7 @@ struct BLEUpdatedCharacteristicHandler { } func handleUpdates(characteristic: CBCharacteristic, peripheral: CBPeripheral) { - if NetworkManager.shared.getNetworkState() { - weatherController.updateWeatherData(ignoreTimeLimits: false) - } + weatherController.updateWeatherData(ignoreTimeLimits: false) switch characteristic.uuid { case bleManagerVal.cbuuidList.musicControl: diff --git a/InfiniLink/Core/Weather/WeatherController.swift b/InfiniLink/Core/Weather/WeatherController.swift index 9e2cc9d..b6a9a82 100644 --- a/InfiniLink/Core/Weather/WeatherController.swift +++ b/InfiniLink/Core/Weather/WeatherController.swift @@ -11,7 +11,7 @@ import SwiftyJSON import SwiftUI class WeatherController: NSObject, ObservableObject, CLLocationManagerDelegate { - @AppStorage("weatherData") var weatherData: Bool = false + @AppStorage("weatherData") var weatherData: Bool = true @AppStorage("useCurrentLocation") var useCurrentLocation: Bool = false @AppStorage("setLocation") var setLocation : String = "Cupertino" @AppStorage("lastLocation") var lastLocation : String = "Cupertino" @@ -521,7 +521,7 @@ class WeatherController: NSObject, ObservableObject, CLLocationManagerDelegate { } func updateWeatherData(ignoreTimeLimits: Bool) { - if !weatherData {return} + if !weatherData, !NetworkManager.shared.getNetworkState() { return } var canUpdateNWS = true var canUpdateWAPI = true