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();
|
final lastLocation = LocationCache.get();
|
||||||
if (lastLocation == null) return false;
|
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 duration = DateTime.parse(location.timestamp).difference(DateTime.parse(lastLocation.timestamp)).inSeconds;
|
||||||
|
|
||||||
final fastestInterval = Preferences.instance.getInt(Preferences.fastestInterval);
|
if (!isHighestAccuracy) {
|
||||||
if (fastestInterval != null && duration < fastestInterval) return true;
|
final fastestInterval = Preferences.instance.getInt(Preferences.fastestInterval);
|
||||||
|
if (fastestInterval != null && duration < fastestInterval) return true;
|
||||||
|
}
|
||||||
|
|
||||||
final distance = _distance(lastLocation, location);
|
final distance = _distance(lastLocation, location);
|
||||||
|
|
||||||
final distanceFilter = Preferences.instance.getInt(Preferences.distance) ?? 0;
|
final distanceFilter = Preferences.instance.getInt(Preferences.distance) ?? 0;
|
||||||
if (distanceFilter > 0 && distance >= distanceFilter) return false;
|
if (distanceFilter > 0 && distance >= distanceFilter) return false;
|
||||||
|
|
||||||
final isHighestAccuracy = Preferences.instance.getString(Preferences.accuracy) == 'highest';
|
|
||||||
|
|
||||||
if (distanceFilter == 0 || isHighestAccuracy) {
|
if (distanceFilter == 0 || isHighestAccuracy) {
|
||||||
final intervalFilter = Preferences.instance.getInt(Preferences.interval) ?? 0;
|
final intervalFilter = Preferences.instance.getInt(Preferences.interval) ?? 0;
|
||||||
if (intervalFilter > 0 && duration >= intervalFilter) return false;
|
if (intervalFilter > 0 && duration >= intervalFilter) return false;
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ class Preferences {
|
||||||
disableElasticity: true,
|
disableElasticity: true,
|
||||||
disableStopDetection: instance.getBool(stopDetection) == false,
|
disableStopDetection: instance.getBool(stopDetection) == false,
|
||||||
pausesLocationUpdatesAutomatically: instance.getBool(stopDetection) == false,
|
pausesLocationUpdatesAutomatically: instance.getBool(stopDetection) == false,
|
||||||
fastestLocationUpdateInterval: fastestLocationUpdateInterval > 0 ? fastestLocationUpdateInterval : null,
|
fastestLocationUpdateInterval: isHighestAccuracy ? 0 : fastestLocationUpdateInterval,
|
||||||
backgroundPermissionRationale: bg.PermissionRationale(
|
backgroundPermissionRationale: bg.PermissionRationale(
|
||||||
title: 'Allow {applicationName} to access this device\'s location in the background',
|
title: 'Allow {applicationName} to access this device\'s location in the background',
|
||||||
message: 'For reliable tracking, please enable {backgroundPermissionOptionLabel} location access.',
|
message: 'For reliable tracking, please enable {backgroundPermissionOptionLabel} location access.',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue