No min interval on highest
This commit is contained in:
parent
8a36922c78
commit
dc6be06738
2 changed files with 6 additions and 5 deletions
|
|
@ -62,18 +62,19 @@ class GeolocationService {
|
|||
final lastLocation = LocationCache.get();
|
||||
if (lastLocation == null) return false;
|
||||
|
||||
final isHighestAccuracy = Preferences.instance.getString(Preferences.accuracy) == 'highest';
|
||||
final duration = DateTime.parse(location.timestamp).difference(DateTime.parse(lastLocation.timestamp)).inSeconds;
|
||||
|
||||
final fastestInterval = Preferences.instance.getInt(Preferences.fastestInterval);
|
||||
if (fastestInterval != null && duration < fastestInterval) return true;
|
||||
if (!isHighestAccuracy) {
|
||||
final fastestInterval = Preferences.instance.getInt(Preferences.fastestInterval);
|
||||
if (fastestInterval != null && duration < fastestInterval) return true;
|
||||
}
|
||||
|
||||
final distance = _distance(lastLocation, location);
|
||||
|
||||
final distanceFilter = Preferences.instance.getInt(Preferences.distance) ?? 0;
|
||||
if (distanceFilter > 0 && distance >= distanceFilter) return false;
|
||||
|
||||
final isHighestAccuracy = Preferences.instance.getString(Preferences.accuracy) == 'highest';
|
||||
|
||||
if (distanceFilter == 0 || isHighestAccuracy) {
|
||||
final intervalFilter = Preferences.instance.getInt(Preferences.interval) ?? 0;
|
||||
if (intervalFilter > 0 && duration >= intervalFilter) return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue