m3_lightmeter/lib/data/models/metering_screen_layout_config.dart
Vadim 6566108994
ML-129 Spot metering (#136)
* imlemented `CameraSpotDetector`

* separated generic `DialogSwitch`

* added `CameraFeature` model

* added `CameraFeaturesListTile` to metering section

* added features dialog subtitles

* added long press to remove metering spot

* translations

* hide camera features for purchasable status

* hide `CameraHistogram` & `CameraSpotDetector` if purchasable

* bumped iap version

* fixed tests

* removed redundant camera state emission

* tests

* Fixed remote config initalization

* updated pro features description
2023-11-11 21:05:11 +01:00

31 lines
998 B
Dart

enum MeteringScreenLayoutFeature {
extremeExposurePairs, // 0
filmPicker, // 1
equipmentProfiles, // 3
}
typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>;
extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig {
static MeteringScreenLayoutConfig fromJson(Map<String, dynamic> data) {
int? migratedIndex(MeteringScreenLayoutFeature feature) {
switch (feature) {
case MeteringScreenLayoutFeature.extremeExposurePairs:
return 0;
case MeteringScreenLayoutFeature.filmPicker:
return 1;
case MeteringScreenLayoutFeature.equipmentProfiles:
return 3;
default:
return null;
}
}
return <MeteringScreenLayoutFeature, bool>{
for (final f in MeteringScreenLayoutFeature.values)
f: (data[migratedIndex(f).toString()] ?? data[f.name]) as bool? ?? true
};
}
Map<String, dynamic> toJson() => map((key, value) => MapEntry(key.name, value));
}