diff --git a/.github/workflows/cd_dev.yml b/.github/workflows/cd_dev.yml index 60f19e3..95ee345 100644 --- a/.github/workflows/cd_dev.yml +++ b/.github/workflows/cd_dev.yml @@ -3,13 +3,19 @@ # separate terms of service, privacy policy, and support # documentation. -name: Build Dev APK +name: Build APK on: - push: - tags: - - "v*.*.*" workflow_dispatch: + inputs: + flavor: + description: 'Flavor' + type: choice + required: true + options: + - dev + - prod + default: 'dev' jobs: build: @@ -47,9 +53,12 @@ jobs: flutter pub run intl_utils:generate - name: Build Apk - run: flutter build apk --release --flavor dev --dart-define cameraPreviewAspectRatio=2/3 -t lib/main_dev.dart + env: + FLAVOR: ${{ github.event.inputs.flavor }} + run: flutter build apk --release --flavor $FLAVOR --dart-define cameraPreviewAspectRatio=2/3 -t lib/main_$FLAVOR.dart - - uses: actions/upload-artifact@v3 + - name: Upload artifact + uses: actions/upload-artifact@v3 with: - name: m3_lightmeter.apk - path: build/app/outputs/flutter-apk/app-dev-release.apk + name: m3_lightmeter_${{ github.event.inputs.flavor }} + path: build/app/outputs/flutter-apk/app-${{ github.event.inputs.flavor }}-release.apk 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..6c76e76 100644 --- a/lib/data/shared_prefs_service.dart +++ b/lib/data/shared_prefs_service.dart @@ -25,7 +25,44 @@ class UserPreferencesService { final SharedPreferences _sharedPreferences; - UserPreferencesService(this._sharedPreferences); + UserPreferencesService(this._sharedPreferences) { + _migrateOldKeys(); + } + + Future _migrateOldKeys() async { + final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex"); + if (legacyIsoIndex != null) { + iso = isoValues[legacyIsoIndex]; + await _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]; + } + await _sharedPreferences.remove("curndIndex"); + } + + final legacyCameraCalibration = _sharedPreferences.getDouble("cameraCalibr"); + if (legacyCameraCalibration != null) { + cameraEvCalibration = legacyCameraCalibration; + await _sharedPreferences.remove("cameraCalibr"); + } + + final legacyLightSensorCalibration = _sharedPreferences.getDouble("sensorCalibr"); + if (legacyLightSensorCalibration != null) { + lightSensorEvCalibration = legacyLightSensorCalibration; + await _sharedPreferences.remove("sensorCalibr"); + } + + final legacyHaptics = _sharedPreferences.getBool("vibrate"); + if (legacyHaptics != null) { + haptics = legacyHaptics; + await _sharedPreferences.remove("vibrate"); + } + } IsoValue get iso => isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100)); set iso(IsoValue value) => _sharedPreferences.setInt(_isoKey, value.value);