From 4457b463ee20e57082fedd43353d34baf63f95c3 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 19 Mar 2023 16:12:45 -0700 Subject: [PATCH] Fix double weather loading --- Meshtastic/Views/Nodes/NodeDetail.swift | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/Meshtastic/Views/Nodes/NodeDetail.swift b/Meshtastic/Views/Nodes/NodeDetail.swift index c5cafe02..7f2d8a32 100644 --- a/Meshtastic/Views/Nodes/NodeDetail.swift +++ b/Meshtastic/Views/Nodes/NodeDetail.swift @@ -486,29 +486,6 @@ struct NodeDetail: View { mapType = .hybridFlyover } } - .task(id: node.num) { - do { - - if node.positions?.count ?? 0 > 0 { - - let mostRecent = node.positions?.lastObject as? PositionEntity - - let weather = try await WeatherService.shared.weather(for: mostRecent?.nodeLocation ?? CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)) - condition = weather.currentWeather.condition - temperature = weather.currentWeather.temperature - humidity = Int(weather.currentWeather.humidity * 100) - symbolName = weather.currentWeather.symbolName - - let attribution = try await WeatherService.shared.attribution - attributionLink = attribution.legalPageURL - attributionLogo = colorScheme == .light ? attribution.combinedMarkLightURL : attribution.combinedMarkDarkURL - } - } catch { - print("Could not gather weather information...", error.localizedDescription) - condition = .clear - symbolName = "cloud.fill" - } - } } } }