Experimental location tracking for every 10 or 5 minutes

This commit is contained in:
Yegor Vialov
2019-11-10 14:41:29 +00:00
parent 2c900333a5
commit 5792652619
2 changed files with 46 additions and 22 deletions

View File

@ -29,6 +29,9 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
setState(() {
_locationTrackingEnabled = prefs.getBool("location-enabled") ?? false;
_locationInterval = prefs.getInt("location-interval") ?? LocationManager().defaultUpdateIntervalMinutes;
if (_locationInterval % 5 != 0) {
_locationInterval = 5 * (_locationInterval ~/ 5);
}
});
});
}
@ -36,15 +39,15 @@ class _IntegrationSettingsPageState extends State<IntegrationSettingsPage> {
void incLocationInterval() {
if (_locationInterval < 720) {
setState(() {
_locationInterval = _locationInterval + 1;
_locationInterval = _locationInterval + 5;
});
}
}
void decLocationInterval() {
if (_locationInterval > 15) {
if (_locationInterval > 5) {
setState(() {
_locationInterval = _locationInterval - 1;
_locationInterval = _locationInterval - 5;
});
}
}