Remove and disable elasticity

This commit is contained in:
Anton Tananaev 2025-06-13 14:28:18 -07:00
parent e243aacde7
commit 57a38d964f
2 changed files with 2 additions and 16 deletions

View file

@ -16,7 +16,6 @@ class Preferences {
static const String heartbeat = 'heartbeat';
static const String buffer = 'buffer';
static const String preventSuspend = 'prevent_suspend';
static const String disableElasticity = 'disable_elasticity';
static const String stopDetection = 'stop_detection';
static Future<void> init() async {
@ -26,8 +25,7 @@ class Preferences {
: SharedPreferencesOptions(),
cacheOptions: SharedPreferencesWithCacheOptions(
allowList: {
id, url, accuracy, interval, distance, buffer, heartbeat,
preventSuspend, disableElasticity, stopDetection,
id, url, accuracy, interval, distance, buffer, heartbeat, preventSuspend, stopDetection,
'device_id_preference', 'server_url_preference', 'accuracy_preference',
'frequency_preference', 'distance_preference', 'buffer_preference',
},
@ -78,7 +76,7 @@ class Preferences {
locationTemplate: _locationTemplate(),
showsBackgroundLocationIndicator: false,
preventSuspend: instance.getBool(preventSuspend),
disableElasticity: instance.getBool(disableElasticity),
disableElasticity: true,
disableStopDetection: instance.getBool(stopDetection) == false,
pausesLocationUpdatesAutomatically: instance.getBool(stopDetection) == false,
);

View file

@ -17,7 +17,6 @@ class SettingsScreen extends StatefulWidget {
class _SettingsScreenState extends State<SettingsScreen> {
bool buffering = true;
bool preventSuspend = false;
bool disableElasticity = false;
bool stopDetection = false;
bool advanced = false;
@ -31,7 +30,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() {
buffering = Preferences.instance.getBool(Preferences.buffer) ?? true;
preventSuspend = Preferences.instance.getBool(Preferences.preventSuspend) ?? false;
disableElasticity = Preferences.instance.getBool(Preferences.disableElasticity) ?? false;
stopDetection = Preferences.instance.getBool(Preferences.stopDetection) ?? true;
});
}
@ -160,16 +158,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
setState(() => buffering = value);
},
),
if (advanced)
SwitchListTile(
title: Text(AppLocalizations.of(context)!.disableElasticityLabel),
value: disableElasticity,
onChanged: (value) async {
await Preferences.instance.setBool(Preferences.disableElasticity, value);
await bg.BackgroundGeolocation.setConfig(Preferences.geolocationConfig());
setState(() => disableElasticity = value);
},
),
if (advanced)
SwitchListTile(
title: Text(AppLocalizations.of(context)!.stopDetectionLabel),