Formatting Location
This commit is contained in:
parent
f398f27741
commit
091d7bf5a3
1 changed files with 5 additions and 14 deletions
|
|
@ -77,12 +77,8 @@ Singleton {
|
||||||
console.warn("[Location] Why is my latitude empty")
|
console.warn("[Location] Why is my latitude empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if ((data.weatherLastFetch === "") || (data.weather === null) || (data.latitude === "") || (data.longitude === "")
|
||||||
(data.weatherLastFetch === "") ||
|
|| (data.name !== Settings.data.location.name)
|
||||||
(data.weather === null) ||
|
|
||||||
(data.latitude === "") ||
|
|
||||||
(data.longitude === "") ||
|
|
||||||
(data.name !== Settings.data.location.name)
|
|
||||||
|| (Time.timestamp >= data.weatherLastFetch + weatherUpdateFrequency)) {
|
|| (Time.timestamp >= data.weatherLastFetch + weatherUpdateFrequency)) {
|
||||||
getFreshWeather()
|
getFreshWeather()
|
||||||
}
|
}
|
||||||
|
|
@ -91,10 +87,7 @@ Singleton {
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
function getFreshWeather() {
|
function getFreshWeather() {
|
||||||
isFetchingWeather = true
|
isFetchingWeather = true
|
||||||
if (
|
if ((data.latitude === "") || (data.longitude === "") || (data.name !== Settings.data.location.name)) {
|
||||||
(data.latitude === "") ||
|
|
||||||
(data.longitude === "") ||
|
|
||||||
(data.name !== Settings.data.location.name)) {
|
|
||||||
|
|
||||||
_geocodeLocation(Settings.data.location.name, function (latitude, longitude) {
|
_geocodeLocation(Settings.data.location.name, function (latitude, longitude) {
|
||||||
console.log("[Location] Geocoded " + Settings.data.location.name + " to: " + latitude + " / " + longitude)
|
console.log("[Location] Geocoded " + Settings.data.location.name + " to: " + latitude + " / " + longitude)
|
||||||
|
|
@ -106,8 +99,6 @@ Singleton {
|
||||||
data.latitude = latitude.toString()
|
data.latitude = latitude.toString()
|
||||||
data.longitude = longitude.toString()
|
data.longitude = longitude.toString()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_fetchWeather(latitude, longitude, errorCallback)
|
_fetchWeather(latitude, longitude, errorCallback)
|
||||||
}, errorCallback)
|
}, errorCallback)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue