Skip to content

Commit

Permalink
Fix weather not fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcharger committed May 2, 2024
1 parent da0c986 commit 9ff57db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions InfiniLink/BLE/BLEUpdateHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions InfiniLink/Core/Weather/WeatherController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9ff57db

Please sign in to comment.