1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-09 23:15:38 -05:00

weather auto location option

This commit is contained in:
bbedward
2025-08-05 07:34:46 -04:00
parent 4bf525ce0d
commit 54d8ca450f
3 changed files with 46 additions and 1 deletions

View File

@@ -92,9 +92,15 @@ Singleton {
}
function getWeatherUrl() {
if (Prefs.useAutoLocation) {
const url = "wttr.in/?format=j1"
console.log("Using auto location, URL:", url)
return url
}
const location = Prefs.weatherCoordinates || "40.7128,-74.0060"
const url = `wttr.in/${encodeURIComponent(location)}?format=j1`
console.log("Using location:", location, "URL:", url)
console.log("Using manual location:", location, "URL:", url)
return url
}
@@ -310,5 +316,25 @@ Singleton {
const currentWeather = Object.assign({}, root.weather)
root.weather = currentWeather
})
Prefs.useAutoLocationChanged.connect(() => {
console.log("Auto location setting changed, force refreshing weather")
root.weather = {
available: false,
loading: true,
temp: 0,
tempF: 0,
city: "",
wCode: "113",
humidity: 0,
wind: "",
sunrise: "06:00",
sunset: "18:00",
uv: 0,
pressure: 0
}
root.lastFetchTime = 0
root.forceRefresh()
})
}
}