#956 fairphone burst pattern

This commit is contained in:
Thibault Deckers 2024-03-23 14:27:38 +01:00
parent 1cda37573d
commit 38d6ee430a
3 changed files with 13 additions and 2 deletions

View file

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## <a id="unreleased"></a>[Unreleased] ## <a id="unreleased"></a>[Unreleased]
### Added
- Collection: support for Fairphone burst pattern
### Changed ### Changed
- upgraded Flutter to stable v3.19.4 - upgraded Flutter to stable v3.19.4

View file

@ -83,7 +83,8 @@ class Settings with ChangeNotifier, SettingsAccess, AppSettings, DisplaySettings
enableBlurEffect = performanceClass >= 29; enableBlurEffect = performanceClass >= 29;
final androidInfo = await DeviceInfoPlugin().androidInfo; final androidInfo = await DeviceInfoPlugin().androidInfo;
final pattern = BurstPatterns.byManufacturer[androidInfo.manufacturer]; final manufacturer = androidInfo.manufacturer.toLowerCase();
final pattern = BurstPatterns.byManufacturer[manufacturer];
collectionBurstPatterns = pattern != null ? [pattern] : []; collectionBurstPatterns = pattern != null ? [pattern] : [];
// availability // availability

View file

@ -1,16 +1,19 @@
class BurstPatterns { class BurstPatterns {
static const _keyGroupName = 'key'; static const _keyGroupName = 'key';
static const fairphone = r'^IMG_(?<key>\d{8}_\d{6})_BURST(\d+)$';
static const samsung = r'^(?<key>\d{8}_\d{6})_(\d+)$'; static const samsung = r'^(?<key>\d{8}_\d{6})_(\d+)$';
static const sony = r'^DSC(PDC)?_\d+_BURST(?<key>\d{17})(_COVER)?$'; static const sony = r'^DSC(PDC)?_\d+_BURST(?<key>\d{17})(_COVER)?$';
static final options = [ static final options = [
BurstPatterns.fairphone,
BurstPatterns.samsung, BurstPatterns.samsung,
BurstPatterns.sony, BurstPatterns.sony,
]; ];
static String getName(String pattern) { static String getName(String pattern) {
return switch (pattern) { return switch (pattern) {
fairphone => 'Fairphone',
samsung => 'Samsung', samsung => 'Samsung',
sony => 'Sony', sony => 'Sony',
_ => pattern, _ => pattern,
@ -19,6 +22,7 @@ class BurstPatterns {
static String getExample(String pattern) { static String getExample(String pattern) {
return switch (pattern) { return switch (pattern) {
fairphone => 'IMG_20151021_072800_BURST007',
samsung => '20151021_072800_007', samsung => '20151021_072800_007',
sony => 'DSC_0007_BURST20151021072800123', sony => 'DSC_0007_BURST20151021072800123',
_ => '?', _ => '?',
@ -26,6 +30,7 @@ class BurstPatterns {
} }
static const byManufacturer = { static const byManufacturer = {
_Manufacturers.fairphone: fairphone,
_Manufacturers.samsung: samsung, _Manufacturers.samsung: samsung,
_Manufacturers.sony: sony, _Manufacturers.sony: sony,
}; };
@ -47,8 +52,9 @@ class BurstPatterns {
} }
} }
// values as returned by `DeviceInfoPlugin().androidInfo` // values as returned by `DeviceInfoPlugin().androidInfo` (lower-cased)
class _Manufacturers { class _Manufacturers {
static const fairphone = 'fairphone';
static const samsung = 'samsung'; static const samsung = 'samsung';
static const sony = 'sony'; static const sony = 'sony';
} }