diff --git a/lib/data/models/photography_values/nd_value.dart b/lib/data/models/photography_values/nd_value.dart index a30f1e8..6c19f7c 100644 --- a/lib/data/models/photography_values/nd_value.dart +++ b/lib/data/models/photography_values/nd_value.dart @@ -20,12 +20,15 @@ const List ndValues = [ NdValue(16), NdValue(32), NdValue(64), + NdValue(100), NdValue(128), NdValue(256), + NdValue(400), NdValue(512), NdValue(1024), NdValue(2048), NdValue(4096), + NdValue(6310), NdValue(8192), NdValue(10000), ]; diff --git a/lib/data/shared_prefs_service.dart b/lib/data/shared_prefs_service.dart index e243d9b..8495f3d 100644 --- a/lib/data/shared_prefs_service.dart +++ b/lib/data/shared_prefs_service.dart @@ -25,7 +25,42 @@ class UserPreferencesService { final SharedPreferences _sharedPreferences; - UserPreferencesService(this._sharedPreferences); + UserPreferencesService(this._sharedPreferences) { + final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex"); + if (legacyIsoIndex != null) { + iso = isoValues[legacyIsoIndex]; + _sharedPreferences.remove("curIsoIndex"); + } + + final legacyNdIndex = _sharedPreferences.getInt("curndIndex"); + if (legacyNdIndex != null) { + /// Legacy ND list has 1 extra value at the end, so this check is needed + if (legacyNdIndex < ndValues.length) { + ndFilter = ndValues[legacyNdIndex]; + } + _sharedPreferences.remove("curndIndex"); + } + + final legacyCameraCalibration = _sharedPreferences.getDouble("cameraCalibr"); + if (legacyCameraCalibration != null) { + cameraEvCalibration = legacyCameraCalibration; + _sharedPreferences.remove("cameraCalibr"); + } + + final legacyLightSensorCalibration = _sharedPreferences.getDouble("sensorCalibr"); + if (legacyLightSensorCalibration != null) { + lightSensorEvCalibration = legacyLightSensorCalibration; + _sharedPreferences.remove("sensorCalibr"); + } + + final legacyHaptics = _sharedPreferences.getBool("vibrate"); + if (legacyHaptics != null) { + haptics = legacyHaptics; + _sharedPreferences.remove("vibrate"); + } + + // TODO remove all unused keys + } IsoValue get iso => isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100)); set iso(IsoValue value) => _sharedPreferences.setInt(_isoKey, value.value);