From 0890ab28bde137d86b1c0f1d3e62f95a87a72fc9 Mon Sep 17 00:00:00 2001 From: Julia Werner Date: Wed, 12 Jun 2024 18:26:02 +0200 Subject: [PATCH] SKYLEX-521-Create-a-complete-iPad-list-compatible-with-Skyle-Eyetracker (#4) * SKLYE-521: Updated iPad Model enum * Value for the iPad model enum copied from Skyle.proto file * Generate protos --------- Co-authored-by: julia --- lib/src/data/models/settings/ipad_model.dart | 191 +++++++++++++++++-- lib/src/generated/Skyle.pbenum.dart | 49 +++++ lib/src/generated/Skyle.pbjson.dart | 34 +++- protos | 2 +- pubspec.yaml | 11 +- 5 files changed, 259 insertions(+), 28 deletions(-) diff --git a/lib/src/data/models/settings/ipad_model.dart b/lib/src/data/models/settings/ipad_model.dart index 958a502..ee2dd52 100644 --- a/lib/src/data/models/settings/ipad_model.dart +++ b/lib/src/data/models/settings/ipad_model.dart @@ -7,27 +7,88 @@ import '../../../generated/Skyle.pb.dart'; enum IPadModel { - iPad8_5(0), //iPad Pro (12.9-inch) (3rd generation) - iPad8_6(1), //iPad Pro (12.9-inch) (3rd generation) - iPad8_7(2), //iPad Pro (12.9-inch) (3rd generation) - iPad8_8(3), //iPad Pro (12.9-inch) (3rd generation) - iPad8_11(4), //iPad Pro (12.9-inch) (4th generation) - iPad8_12(5), //iPad Pro (12.9-inch) (4th generation) + /// 2024 + // iPad Pro (11-inch) (M4) + // https://support.apple.com/119892 + iPad16_3(34), + iPad16_4(35), + // iPad Pro (13-inch) (M4) + // https://support.apple.com/119891 + iPad16_5(36), + iPad16_6(37), + // iPad Air (11-inch) (M2) + // https://support.apple.com/119894 + iPad14_8(30), + iPad14_9(31), + // iPad Air (13-inch) (M2) + // https://support.apple.com/119893 + iPad14_10(32), + iPad14_11(33), - iPad13_1(6), //iPad Air (4th generation) - iPad13_2(7), //iPad Air (4th generation) + /// 2022 + // iPad Pro (11-inch) (4th generation) + // https://support.apple.com/111842 + iPad14_3(26), + iPad14_4(27), + // iPad Pro (12.9-inch) (6th generation) + // https://support.apple.com/111841 + iPad14_5(28), + iPad14_6(29), + // iPad Air (5th generation) + // https://support.apple.com/111887 + iPad13_16(12), + iPad13_17(13), - iPad13_8(8), //iPad Pro (12.9-inch) (5th generation) - iPad13_9(9), //iPad Pro (12.9-inch) (5th generation) - iPad13_10(10), //iPad Pro (12.9-inch) (5th generation) - iPad13_11(11), //iPad Pro (12.9-inch) (5th generation) + /// 2021 + // iPad Pro (11-inch) (3rd generation) + // https://support.apple.com/111897 + iPad13_4(20), + iPad13_5(21), + iPad13_6(22), + iPad13_7(23), + // iPad Pro (12.9-inch) (5th generation) + // https://support.apple.com/111896 + iPad13_8(8), + iPad13_9(9), + iPad13_10(10), + iPad13_11(11), + // iPad mini (6th generation) + // https://support.apple.com/111886 + iPad14_1(24), + iPad14_2(25), - iPad13_16(12), //iPad Air (5th generation) - iPad13_17(13); //iPad Air (5th generation) + /// 2020 + // iPad Pro (11-inch) (2nd generation) + // https://support.apple.com/118452 + iPad8_9(18), + iPad8_10(19), + // iPad Pro (12.9-inch) (4th generation) + // https://support.apple.com/111977 + iPad8_11(4), + iPad8_12(5), + // iPad Air (4th generation) + // https://support.apple.com/111905 + iPad13_1(6), + iPad13_2(7), + + /// 2018 + // iPad Pro (11-inch) (1st generation) + // https://support.apple.com/111974 + iPad8_1(14), + iPad8_2(15), + iPad8_3(16), + iPad8_4(17), + // iPad Pro (12.9-inch) (3rd generation) + // https://support.apple.com/111979 + iPad8_5(0), + iPad8_6(1), + iPad8_7(2), + iPad8_8(3); - final int value; const IPadModel(this.value); + final int value; + static IPadModel fromIPadOptionsIPadModel(IPadOptions_iPadModel iPadModel) { return IPadModel.values.firstWhere((element) => element.value == iPadModel.value, orElse: () => IPadModel.iPad13_10); } @@ -35,4 +96,104 @@ enum IPadModel { IPadOptions_iPadModel toIPadOptionsIPadModel() { return IPadOptions_iPadModel.values.firstWhere((element) => element.value == value, orElse: () => IPadOptions_iPadModel.IPad13_10); } + + (double, double) get screenSizeMM { + final width = _pixelToMm(pixel: screenSizePixel.$1, ppi: pixelPerInch); + final height = _pixelToMm(pixel: screenSizePixel.$2, ppi: pixelPerInch); + return (width, height); + } + + (double, double) get screenSizeMMLargerText { + final width = _pixelToMm(pixel: screenSizePixelLargerText.$1, ppi: pixelPerInch); + final height = _pixelToMm(pixel: screenSizePixelLargerText.$2, ppi: pixelPerInch); + return (width, height); + } + + (double, double) get screenSizeMMMoreSpace { + final width = _pixelToMm(pixel: screenSizePixelMoreSpace.$1, ppi: pixelPerInch); + final height = _pixelToMm(pixel: screenSizePixelMoreSpace.$2, ppi: pixelPerInch); + return (width, height); + } + + double _pixelToMm({required double pixel, required int ppi}) { + const inchToMm = 25.4; // 1 Zoll = 25,4 mm + return pixel * (inchToMm / ppi); + } + + /// Physical Pixels - Display Zoom: Default + (double, double) get screenSizePixel { + // width: MediaQuery.of(context).size.width * MediaQuery.of(context).devicePixelRatio; + // height: MediaQuery.of(context).size.height * MediaQuery.of(context).devicePixelRatio; + return switch (this) { + iPad16_5 || iPad16_6 => const (2752, 2064), + iPad16_3 || iPad16_4 => const (2420, 1668), + iPad14_3 || iPad14_4 || iPad13_4 || iPad13_5 || iPad13_6 || iPad13_7 => const (2388, 1668), + iPad8_1 || iPad8_2 || iPad8_3 || iPad8_4 || iPad8_9 || iPad8_10 => const (2388, 1668), + iPad14_8 || iPad14_9 || iPad13_16 || iPad13_17 || iPad13_1 || iPad13_2 => const (2360, 1640), + iPad14_1 || iPad14_2 => const (2266, 1488), + _ => const (2732, 2048), + }; + } + + /// Physical Pixels - Display Zoom: Larger Text + (double, double) get screenSizePixelLargerText { + return switch (this) { + iPad16_5 || iPad16_6 => const (2064, 1548), + // No display zoom available -> same as default size + iPad16_3 || iPad16_4 => screenSizePixel, + iPad14_3 || iPad14_4 || iPad13_4 || iPad13_5 || iPad13_6 || iPad13_7 => screenSizePixel, + iPad8_1 || iPad8_2 || iPad8_3 || iPad8_4 || iPad8_9 || iPad8_10 => screenSizePixel, + iPad14_8 || iPad14_9 || iPad13_16 || iPad13_17 || iPad13_1 || iPad13_2 => screenSizePixel, + iPad14_1 || iPad14_2 => screenSizePixel, + // --- + _ => const (2048, 1536), + }; + } + + /// Physical Pixels - Display Zoom: More Space + (double, double) get screenSizePixelMoreSpace { + return switch (this) { + iPad16_5 || iPad16_6 => const (3200, 2400), + iPad16_3 || iPad16_4 => const (2816, 1940), + iPad14_3 || iPad14_4 || iPad13_4 || iPad13_5 || iPad13_6 || iPad13_7 => const (2778, 1940), + iPad8_1 || iPad8_2 || iPad8_3 || iPad8_4 || iPad8_9 || iPad8_10 => const (2778, 1940), + iPad14_8 || iPad14_9 || iPad13_16 || iPad13_17 || iPad13_1 || iPad13_2 => const (2746, 1908), + // No display zoom available -> same as default size + iPad14_1 || iPad14_2 => screenSizePixel, + // --- + _ => const (3180, 2384), + }; + } + + int get pixelPerInch { + return switch (this) { iPad14_1 || iPad14_2 => 326, _ => 264 }; + } + + bool get hasLargerTextAsDisplayZoom { + return screenSizePixelLargerText != screenSizePixel; + } + + bool get hasMoreSpaceAsDisplayZoom { + return screenSizePixelMoreSpace != screenSizePixel; + } + + String get label { + return switch (this) { + IPadModel.iPad16_3 || IPadModel.iPad16_4 => 'iPad Pro 11-inch (M4)', + IPadModel.iPad16_5 || IPadModel.iPad16_6 => 'iPad Pro 13-inch (M4)', + IPadModel.iPad14_8 || IPadModel.iPad14_9 => 'iPad Air 11-inch (M2)', + IPadModel.iPad14_10 || IPadModel.iPad14_11 => 'iPad Air 13-inch (M2)', + IPadModel.iPad14_3 || IPadModel.iPad14_4 => 'iPad Pro (11-inch) (4th generation)', + IPadModel.iPad14_5 || IPadModel.iPad14_6 => 'iPad Pro (12.9-inch) (6th generation)', + IPadModel.iPad13_16 || IPadModel.iPad13_17 => 'iPad Air (5th generation)', + IPadModel.iPad13_4 || IPadModel.iPad13_5 || IPadModel.iPad13_6 || IPadModel.iPad13_7 => 'iPad Pro (11-inch) (3rd generation)', + IPadModel.iPad13_8 || IPadModel.iPad13_9 || IPadModel.iPad13_10 || IPadModel.iPad13_11 => 'iPad Pro (12.9-inch) (5th generation)', + IPadModel.iPad14_1 || IPadModel.iPad14_2 => 'iPad mini (6th generation)', + IPadModel.iPad8_9 || IPadModel.iPad8_10 => 'iPad Pro (11-inch) (2nd generation)', + IPadModel.iPad8_11 || IPadModel.iPad8_12 => 'iPad Pro (12.9-inch) (4th generation)', + IPadModel.iPad13_1 || IPadModel.iPad13_2 => 'iPad Air (4th generation)', + IPadModel.iPad8_1 || IPadModel.iPad8_2 || IPadModel.iPad8_3 || IPadModel.iPad8_4 => 'iPad Pro (11-inch) (1st generation)', + IPadModel.iPad8_5 || IPadModel.iPad8_6 || IPadModel.iPad8_7 || IPadModel.iPad8_8 => 'iPad Pro (12.9-inch) (3rd generation)', + }; + } } diff --git a/lib/src/generated/Skyle.pbenum.dart b/lib/src/generated/Skyle.pbenum.dart index a4a7ce8..8580372 100644 --- a/lib/src/generated/Skyle.pbenum.dart +++ b/lib/src/generated/Skyle.pbenum.dart @@ -47,6 +47,7 @@ class Options_eyeUse extends $pb.ProtobufEnum { const Options_eyeUse._($core.int v, $core.String n) : super(v, n); } +/// Set this to the iPad model you are using. If the device isn't an iPad, this value will be ignored. class IPadOptions_iPadModel extends $pb.ProtobufEnum { static const IPadOptions_iPadModel IPad8_5 = IPadOptions_iPadModel._(0, _omitEnumNames ? '' : 'IPad8_5'); static const IPadOptions_iPadModel IPad8_6 = IPadOptions_iPadModel._(1, _omitEnumNames ? '' : 'IPad8_6'); @@ -62,6 +63,30 @@ class IPadOptions_iPadModel extends $pb.ProtobufEnum { static const IPadOptions_iPadModel IPad13_11 = IPadOptions_iPadModel._(11, _omitEnumNames ? '' : 'IPad13_11'); static const IPadOptions_iPadModel IPad13_16 = IPadOptions_iPadModel._(12, _omitEnumNames ? '' : 'IPad13_16'); static const IPadOptions_iPadModel IPad13_17 = IPadOptions_iPadModel._(13, _omitEnumNames ? '' : 'IPad13_17'); + static const IPadOptions_iPadModel IPad8_1 = IPadOptions_iPadModel._(14, _omitEnumNames ? '' : 'IPad8_1'); + static const IPadOptions_iPadModel IPad8_2 = IPadOptions_iPadModel._(15, _omitEnumNames ? '' : 'IPad8_2'); + static const IPadOptions_iPadModel IPad8_3 = IPadOptions_iPadModel._(16, _omitEnumNames ? '' : 'IPad8_3'); + static const IPadOptions_iPadModel IPad8_4 = IPadOptions_iPadModel._(17, _omitEnumNames ? '' : 'IPad8_4'); + static const IPadOptions_iPadModel IPad8_9 = IPadOptions_iPadModel._(18, _omitEnumNames ? '' : 'IPad8_9'); + static const IPadOptions_iPadModel IPad8_10 = IPadOptions_iPadModel._(19, _omitEnumNames ? '' : 'IPad8_10'); + static const IPadOptions_iPadModel IPad13_4 = IPadOptions_iPadModel._(20, _omitEnumNames ? '' : 'IPad13_4'); + static const IPadOptions_iPadModel IPad13_5 = IPadOptions_iPadModel._(21, _omitEnumNames ? '' : 'IPad13_5'); + static const IPadOptions_iPadModel IPad13_6 = IPadOptions_iPadModel._(22, _omitEnumNames ? '' : 'IPad13_6'); + static const IPadOptions_iPadModel IPad13_7 = IPadOptions_iPadModel._(23, _omitEnumNames ? '' : 'IPad13_7'); + static const IPadOptions_iPadModel IPad14_1 = IPadOptions_iPadModel._(24, _omitEnumNames ? '' : 'IPad14_1'); + static const IPadOptions_iPadModel IPad14_2 = IPadOptions_iPadModel._(25, _omitEnumNames ? '' : 'IPad14_2'); + static const IPadOptions_iPadModel IPad14_3 = IPadOptions_iPadModel._(26, _omitEnumNames ? '' : 'IPad14_3'); + static const IPadOptions_iPadModel IPad14_4 = IPadOptions_iPadModel._(27, _omitEnumNames ? '' : 'IPad14_4'); + static const IPadOptions_iPadModel IPad14_5 = IPadOptions_iPadModel._(28, _omitEnumNames ? '' : 'IPad14_5'); + static const IPadOptions_iPadModel IPad14_6 = IPadOptions_iPadModel._(29, _omitEnumNames ? '' : 'IPad14_6'); + static const IPadOptions_iPadModel IPad14_8 = IPadOptions_iPadModel._(30, _omitEnumNames ? '' : 'IPad14_8'); + static const IPadOptions_iPadModel IPad14_9 = IPadOptions_iPadModel._(31, _omitEnumNames ? '' : 'IPad14_9'); + static const IPadOptions_iPadModel IPad14_10 = IPadOptions_iPadModel._(32, _omitEnumNames ? '' : 'IPad14_10'); + static const IPadOptions_iPadModel IPad14_11 = IPadOptions_iPadModel._(33, _omitEnumNames ? '' : 'IPad14_11'); + static const IPadOptions_iPadModel IPad16_3 = IPadOptions_iPadModel._(34, _omitEnumNames ? '' : 'IPad16_3'); + static const IPadOptions_iPadModel IPad16_4 = IPadOptions_iPadModel._(35, _omitEnumNames ? '' : 'IPad16_4'); + static const IPadOptions_iPadModel IPad16_5 = IPadOptions_iPadModel._(36, _omitEnumNames ? '' : 'IPad16_5'); + static const IPadOptions_iPadModel IPad16_6 = IPadOptions_iPadModel._(37, _omitEnumNames ? '' : 'IPad16_6'); static const $core.List values = [ IPad8_5, @@ -78,6 +103,30 @@ class IPadOptions_iPadModel extends $pb.ProtobufEnum { IPad13_11, IPad13_16, IPad13_17, + IPad8_1, + IPad8_2, + IPad8_3, + IPad8_4, + IPad8_9, + IPad8_10, + IPad13_4, + IPad13_5, + IPad13_6, + IPad13_7, + IPad14_1, + IPad14_2, + IPad14_3, + IPad14_4, + IPad14_5, + IPad14_6, + IPad14_8, + IPad14_9, + IPad14_10, + IPad14_11, + IPad16_3, + IPad16_4, + IPad16_5, + IPad16_6, ]; static final $core.Map<$core.int, IPadOptions_iPadModel> _byValue = $pb.ProtobufEnum.initByValue(values); diff --git a/lib/src/generated/Skyle.pbjson.dart b/lib/src/generated/Skyle.pbjson.dart index 50ed79b..740c486 100644 --- a/lib/src/generated/Skyle.pbjson.dart +++ b/lib/src/generated/Skyle.pbjson.dart @@ -387,6 +387,30 @@ const IPadOptions_iPadModel$json = { {'1': 'IPad13_11', '2': 11}, {'1': 'IPad13_16', '2': 12}, {'1': 'IPad13_17', '2': 13}, + {'1': 'IPad8_1', '2': 14}, + {'1': 'IPad8_2', '2': 15}, + {'1': 'IPad8_3', '2': 16}, + {'1': 'IPad8_4', '2': 17}, + {'1': 'IPad8_9', '2': 18}, + {'1': 'IPad8_10', '2': 19}, + {'1': 'IPad13_4', '2': 20}, + {'1': 'IPad13_5', '2': 21}, + {'1': 'IPad13_6', '2': 22}, + {'1': 'IPad13_7', '2': 23}, + {'1': 'IPad14_1', '2': 24}, + {'1': 'IPad14_2', '2': 25}, + {'1': 'IPad14_3', '2': 26}, + {'1': 'IPad14_4', '2': 27}, + {'1': 'IPad14_5', '2': 28}, + {'1': 'IPad14_6', '2': 29}, + {'1': 'IPad14_8', '2': 30}, + {'1': 'IPad14_9', '2': 31}, + {'1': 'IPad14_10', '2': 32}, + {'1': 'IPad14_11', '2': 33}, + {'1': 'IPad16_3', '2': 34}, + {'1': 'IPad16_4', '2': 35}, + {'1': 'IPad16_5', '2': 36}, + {'1': 'IPad16_6', '2': 37}, ], }; @@ -394,11 +418,17 @@ const IPadOptions_iPadModel$json = { final $typed_data.Uint8List iPadOptionsDescriptor = $convert.base64Decode( 'CgtJUGFkT3B0aW9ucxIaCghpc09sZGlPUxgBIAEoCFIIaXNPbGRpT1MSIAoLaXNOb3Rab29tZW' 'QYAiABKAhSC2lzTm90Wm9vbWVkEjQKBW1vZGVsGAMgASgOMhwuU2t5bGUuSVBhZE9wdGlvbnMu' - 'aVBhZE1vZGVsSABSBW1vZGVsIs8BCglpUGFkTW9kZWwSCwoHSVBhZDhfNRAAEgsKB0lQYWQ4Xz' + 'aVBhZE1vZGVsSABSBW1vZGVsIpwECglpUGFkTW9kZWwSCwoHSVBhZDhfNRAAEgsKB0lQYWQ4Xz' 'YQARILCgdJUGFkOF83EAISCwoHSVBhZDhfOBADEgwKCElQYWQ4XzExEAQSDAoISVBhZDhfMTIQ' 'BRIMCghJUGFkMTNfMRAGEgwKCElQYWQxM18yEAcSDAoISVBhZDEzXzgQCBIMCghJUGFkMTNfOR' 'AJEg0KCUlQYWQxM18xMBAKEg0KCUlQYWQxM18xMRALEg0KCUlQYWQxM18xNhAMEg0KCUlQYWQx' - 'M18xNxANQhAKDm9wdGlvbmFsX21vZGVs'); + 'M18xNxANEgsKB0lQYWQ4XzEQDhILCgdJUGFkOF8yEA8SCwoHSVBhZDhfMxAQEgsKB0lQYWQ4Xz' + 'QQERILCgdJUGFkOF85EBISDAoISVBhZDhfMTAQExIMCghJUGFkMTNfNBAUEgwKCElQYWQxM181' + 'EBUSDAoISVBhZDEzXzYQFhIMCghJUGFkMTNfNxAXEgwKCElQYWQxNF8xEBgSDAoISVBhZDE0Xz' + 'IQGRIMCghJUGFkMTRfMxAaEgwKCElQYWQxNF80EBsSDAoISVBhZDE0XzUQHBIMCghJUGFkMTRf' + 'NhAdEgwKCElQYWQxNF84EB4SDAoISVBhZDE0XzkQHxINCglJUGFkMTRfMTAQIBINCglJUGFkMT' + 'RfMTEQIRIMCghJUGFkMTZfMxAiEgwKCElQYWQxNl80ECMSDAoISVBhZDE2XzUQJBIMCghJUGFk' + 'MTZfNhAlQhAKDm9wdGlvbmFsX21vZGVs'); @$core.Deprecated('Use deviceVersionsDescriptor instead') const DeviceVersions$json = { diff --git a/protos b/protos index 5adf65f..cbea494 160000 --- a/protos +++ b/protos @@ -1 +1 @@ -Subproject commit 5adf65f89e42333744967acfdacb836cd32d19a0 +Subproject commit cbea4945396c887be498de1e68bf9ac7762b7181 diff --git a/pubspec.yaml b/pubspec.yaml index 1c758a5..afd3c3e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,27 +4,18 @@ version: 0.0.1 homepage: environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: collection: ^1.17.0 - freezed_annotation: ^2.2.0 - grpc: ^3.1.0 - http: ^1.1.0 - json_annotation: ^4.8.0 - logger: ^2.0.1 - path: ^1.8.2 - protobuf: ^3.1.0 - retry: ^3.1.1 - universal_platform: ^1.0.0+1 dev_dependencies: