mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
await
This commit is contained in:
parent
f65489c922
commit
8627280186
1 changed files with 9 additions and 7 deletions
|
@ -26,10 +26,14 @@ class UserPreferencesService {
|
||||||
final SharedPreferences _sharedPreferences;
|
final SharedPreferences _sharedPreferences;
|
||||||
|
|
||||||
UserPreferencesService(this._sharedPreferences) {
|
UserPreferencesService(this._sharedPreferences) {
|
||||||
|
_migrateOldKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _migrateOldKeys() async {
|
||||||
final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex");
|
final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex");
|
||||||
if (legacyIsoIndex != null) {
|
if (legacyIsoIndex != null) {
|
||||||
iso = isoValues[legacyIsoIndex];
|
iso = isoValues[legacyIsoIndex];
|
||||||
_sharedPreferences.remove("curIsoIndex");
|
await _sharedPreferences.remove("curIsoIndex");
|
||||||
}
|
}
|
||||||
|
|
||||||
final legacyNdIndex = _sharedPreferences.getInt("curndIndex");
|
final legacyNdIndex = _sharedPreferences.getInt("curndIndex");
|
||||||
|
@ -38,28 +42,26 @@ class UserPreferencesService {
|
||||||
if (legacyNdIndex < ndValues.length) {
|
if (legacyNdIndex < ndValues.length) {
|
||||||
ndFilter = ndValues[legacyNdIndex];
|
ndFilter = ndValues[legacyNdIndex];
|
||||||
}
|
}
|
||||||
_sharedPreferences.remove("curndIndex");
|
await _sharedPreferences.remove("curndIndex");
|
||||||
}
|
}
|
||||||
|
|
||||||
final legacyCameraCalibration = _sharedPreferences.getDouble("cameraCalibr");
|
final legacyCameraCalibration = _sharedPreferences.getDouble("cameraCalibr");
|
||||||
if (legacyCameraCalibration != null) {
|
if (legacyCameraCalibration != null) {
|
||||||
cameraEvCalibration = legacyCameraCalibration;
|
cameraEvCalibration = legacyCameraCalibration;
|
||||||
_sharedPreferences.remove("cameraCalibr");
|
await _sharedPreferences.remove("cameraCalibr");
|
||||||
}
|
}
|
||||||
|
|
||||||
final legacyLightSensorCalibration = _sharedPreferences.getDouble("sensorCalibr");
|
final legacyLightSensorCalibration = _sharedPreferences.getDouble("sensorCalibr");
|
||||||
if (legacyLightSensorCalibration != null) {
|
if (legacyLightSensorCalibration != null) {
|
||||||
lightSensorEvCalibration = legacyLightSensorCalibration;
|
lightSensorEvCalibration = legacyLightSensorCalibration;
|
||||||
_sharedPreferences.remove("sensorCalibr");
|
await _sharedPreferences.remove("sensorCalibr");
|
||||||
}
|
}
|
||||||
|
|
||||||
final legacyHaptics = _sharedPreferences.getBool("vibrate");
|
final legacyHaptics = _sharedPreferences.getBool("vibrate");
|
||||||
if (legacyHaptics != null) {
|
if (legacyHaptics != null) {
|
||||||
haptics = legacyHaptics;
|
haptics = legacyHaptics;
|
||||||
_sharedPreferences.remove("vibrate");
|
await _sharedPreferences.remove("vibrate");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove all unused keys
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IsoValue get iso => isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100));
|
IsoValue get iso => isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100));
|
||||||
|
|
Loading…
Reference in a new issue