diff --git a/app/build.gradle b/app/build.gradle index 4e92df56..1313b45e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,11 +10,12 @@ android { applicationId "com.example.weathermaster" minSdk 22 targetSdk 33 - versionCode 73 - versionName "1.8.1 (W)" + versionCode 74 + versionName "1.8.2 (W)" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + buildTypes { release { minifyEnabled false diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 901543c0..775c11bd 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 73, - "versionName": "1.8.1 (W)", + "versionCode": 74, + "versionName": "1.8.2 (W)", "outputFile": "app-release.apk" } ], diff --git a/app/src/main/assets/app/app.js b/app/src/main/assets/app/app.js index 0cdd9bdd..6dda6de4 100644 --- a/app/src/main/assets/app/app.js +++ b/app/src/main/assets/app/app.js @@ -404,7 +404,20 @@ function loadSavedLocations() { } else if(localStorage.getItem('selectedMainWeatherProvider') === 'Met norway' && !JSON.parse(localStorage.getItem(`WeatherDataMetNorway_${location.locationName}`))){ - + const lastCallTimeKey = `DecodeWeatherLastCallMet_${location.locationName}`; + const currentTime = Date.now(); + const lastCallTime = localStorage.getItem(lastCallTimeKey); + + const timeLimit = 5 * 60 * 1000; + + if (!lastCallTime || currentTime - lastCallTime > timeLimit) { + DecodeWeather(savedLocationItemLat, savedLocationItemLon, location.locationName); + savedLocationsHolder.innerHTML = '' + setTimeout(() => { + loadSavedLocations() + }, 1000) + localStorage.setItem(lastCallTimeKey, currentTime); + } } else if (localStorage.getItem('ApiForAccu') && localStorage.getItem('selectedMainWeatherProvider') === 'Accuweather' && JSON.parse(localStorage.getItem(`WeatherDataAccuCurrent_${location.locationName}`))) { const data = JSON.parse(localStorage.getItem(`WeatherDataAccuCurrent_${location.locationName}`)); @@ -429,9 +442,10 @@ function loadSavedLocations() { if (!lastCallTime || currentTime - lastCallTime > timeLimit) { DecodeWeather(savedLocationItemLat, savedLocationItemLon, location.locationName); + savedLocationsHolder.innerHTML = '' setTimeout(() => { loadSavedLocations() - }, 200) + }, 1000) localStorage.setItem(lastCallTimeKey, currentTime); } @@ -538,7 +552,7 @@ function loadSavedLocations() { const MoreDetailsData = JSON.parse(localStorage.getItem(`MoreDetailsData_${location.locationName}`)); const AstronomyData = JSON.parse(localStorage.getItem(`AstronomyData_${location.locationName}`)) const renderFromSavedDataMetTimstamp = localStorage.getItem(`WeatherDataMetNorwayTimeStamp_${location.locationName}`) - const SavedalertData = JSON.parse(localStorage.getItem(`AlertData_${location.locationName}`)) + const SavedalertData = JSON.parse(localStorage.getItem(`AlertData_${location.locationName}`)) if(SavedalertData){ FetchAlertRender(SavedalertData) @@ -553,8 +567,14 @@ function loadSavedLocations() { const currentData = renderFromSavedDataMet.properties.timeseries[0]; const hourlyData = renderFromSavedDataMet.properties.timeseries.slice(0, 24); - renderCurrentDataMetNorway(currentData, savedLocationItemLat, savedLocationItemLon); - renderHourlyDataMetNorway(hourlyData); + + if(renderFromSavedDataMet){ + renderCurrentDataMetNorway(currentData, savedLocationItemLat, savedLocationItemLon); + renderHourlyDataMetNorway(hourlyData); + } else{ + DecodeWeather(savedLocationItemLat, savedLocationItemLon, location.locationName); + } + createHourlyDataCount(renderFromSavedData) CurrentWeather(renderFromSavedData.current, renderFromSavedData.daily.sunrise[0], renderFromSavedData.daily.sunset[0]) @@ -619,8 +639,12 @@ function loadSavedLocations() { astronomyDataRender(AstronomyData) MoreDetailsRender(MoreDetailsData) + if(data){ DisplayCurrentAccuweatherData(data, savedLocationItemLat, savedLocationItemLon) DisplayHourlyAccuweatherData(dataHourly) + } else{ + DecodeWeather(savedLocationItemLat, savedLocationItemLon, location.locationName); + } const AirQuailityData = JSON.parse(localStorage.getItem(`AirQuality_${location.locationName}`)); @@ -985,7 +1009,7 @@ checkNoInternet(); document.addEventListener('DOMContentLoaded', async function() { - const currentVersion = 'v1.8.1'; + const currentVersion = 'v1.8.2'; const githubRepo = 'PranshulGG/WeatherMaster'; const releasesUrl = `https://api.github.com/repos/${githubRepo}/releases/latest`; diff --git a/app/src/main/assets/pages/AboutPage.html b/app/src/main/assets/pages/AboutPage.html index 676b7867..f8e459bc 100644 --- a/app/src/main/assets/pages/AboutPage.html +++ b/app/src/main/assets/pages/AboutPage.html @@ -204,7 +204,7 @@

Weather
Master

- 1.8.1 (W) + 1.8.2 (W)
@@ -355,7 +355,7 @@ document.getElementById('checkUpdatesBtn').addEventListener('click', async function () { - const currentVersion = 'v1.8.1'; + const currentVersion = 'v1.8.2'; const githubRepo = 'PranshulGG/WeatherMaster'; const releasesUrl = `https://api.github.com/repos/${githubRepo}/releases/latest`;