@@ -25,6 +25,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager
25
25
import androidx.work.*
26
26
import com.google.android.gms.location.*
27
27
import com.thewizrd.shared_resources.AppState
28
+ import com.thewizrd.shared_resources.locationdata.LocationData
28
29
import com.thewizrd.shared_resources.remoteconfig.RemoteConfig
29
30
import com.thewizrd.shared_resources.tzdb.TZDBCache
30
31
import com.thewizrd.shared_resources.utils.*
@@ -455,7 +456,8 @@ class WeatherUpdaterWorker(context: Context, workerParams: WorkerParameters) : C
455
456
val lastGPSLocData = settingsManager.getLastGPSLocData()
456
457
457
458
// Check previous location difference
458
- if (lastGPSLocData?.query != null && ConversionMethods .calculateHaversine(lastGPSLocData.latitude, lastGPSLocData.longitude, location.latitude, location.longitude).absoluteValue < 1600 ) {
459
+ if (lastGPSLocData?.query != null && ConversionMethods .calculateHaversine(
460
+ lastGPSLocData.latitude, lastGPSLocData.longitude, location.latitude, location.longitude).absoluteValue < 1600 ) {
459
461
return @withContext false
460
462
}
461
463
@@ -480,8 +482,7 @@ class WeatherUpdaterWorker(context: Context, workerParams: WorkerParameters) : C
480
482
}
481
483
482
484
// Save location as last known
483
- lastGPSLocData!! .setData(query_vm, location)
484
- settingsManager.saveLastGPSLocData(lastGPSLocData)
485
+ settingsManager.saveLastGPSLocData(LocationData (query_vm, location))
485
486
return @withContext true
486
487
}
487
488
}
0 commit comments