m3_lightmeter/lib/data/models/camera_feature.dart
Vadim 7c96b5a47d
ML-220 Show focal length when zooming (#233)
* extract focal length from exif

* added focal length section

* wip

* [android] calculate EFL

* split other platform handlers to separate files

* [ios] calculate EFL

* updated translations

* deleted `focalLengthFromTags`

* fixed unit tests

* [ios] link missing files

* updated Pro features screen

* [ios] fixed signing

* fixed screenshot generator

* updated goldens

* [android] updated store screenshots

* wip

* [ios] updated store screenshots

* enable focal length feature by default

* mock camera focal length for integration tests

* cleanup

* added logging to `CameraInfoService`
2025-05-14 10:26:59 +02:00

26 lines
765 B
Dart

enum CameraFeature {
spotMetering,
histogram,
showFocalLength,
}
typedef CameraFeaturesConfig = Map<CameraFeature, bool>;
extension CameraFeaturesConfigJson on CameraFeaturesConfig {
static CameraFeaturesConfig fromJson(Map<String, dynamic> data) {
MapEntry<CameraFeature, bool> valueOrBool(CameraFeature feature, {bool defaultValue = true}) => MapEntry(
feature,
data[feature.name] as bool? ?? defaultValue,
);
return Map.fromEntries(
[
valueOrBool(CameraFeature.spotMetering),
valueOrBool(CameraFeature.histogram, defaultValue: false),
valueOrBool(CameraFeature.showFocalLength),
],
);
}
Map<String, dynamic> toJson() => map((key, value) => MapEntry(key.name, value));
}