From 45a11bdb9b08d1886148f0d8df2a86972580215f Mon Sep 17 00:00:00 2001 From: Scott Cooper Date: Mon, 17 Apr 2023 10:57:30 -0700 Subject: [PATCH 1/3] deps(ui): Bump ios device list fixes #47453 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e31a89e1dccafe..91826afa1208dc 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "gettext-parser": "1.3.1", "gl-matrix": "^3.4.3", "intersection-observer": "^0.12.2", - "ios-device-list": "^1.1.35", + "ios-device-list": "1.1.37", "jed": "^1.1.0", "js-beautify": "^1.14.4", "js-cookie": "3.0.1", diff --git a/yarn.lock b/yarn.lock index f79a7e3f631070..f4521404dc828c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6709,10 +6709,10 @@ invariant@^2.2.1, invariant@^2.2.4: dependencies: loose-envify "^1.0.0" -ios-device-list@^1.1.35: - version "1.1.35" - resolved "https://registry.yarnpkg.com/ios-device-list/-/ios-device-list-1.1.35.tgz#cddc2ed9634f4f1af1061016caf31ef4f4dc5307" - integrity sha512-ESaQizoD8nGdw8vhkYqab0jbPcSPnpGmqhwd3aqtyan9AZFNnQdj31ic6FdDd+/gUqp5N6RFU/ODxVKGwDhoMw== +ios-device-list@1.1.37: + version "1.1.37" + resolved "https://registry.yarnpkg.com/ios-device-list/-/ios-device-list-1.1.37.tgz#0461dcba91ff824422740cfabc32490bfd95e686" + integrity sha512-0CS8kand3WDF58GtQV7AlFl9mONeHyQDtrypNEVSUyFsxNcbvj/o4gGeS/LNrQAK8V8V4rSIIpxx3hBVDDFwIg== dependencies: lodash.clonedeep "^4.5.0" lodash.flatten "^4.4.0" From a80210e9f5aff65941a373c66cb6f7ea5a931719 Mon Sep 17 00:00:00 2001 From: "getsantry[bot]" <66042841+getsantry[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 18:04:41 +0000 Subject: [PATCH 2/3] style(lint): Auto commit lint changes --- static/app/constants/ios-device-list.tsx | 48 ++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/static/app/constants/ios-device-list.tsx b/static/app/constants/ios-device-list.tsx index f4b4d8b71be574..76556745f71505 100644 --- a/static/app/constants/ios-device-list.tsx +++ b/static/app/constants/ios-device-list.tsx @@ -4,6 +4,7 @@ // and discard the rest of the JSON so we do not end up bloating bundle size. const iOSDeviceMapping: Record = { + '': 'Siri Remote (2nd generation)', 'iPod1,1': 'iPod touch', 'iPod2,1': 'iPod touch (2nd generation)', 'iPod3,1': 'iPod touch (3rd generation)', @@ -41,8 +42,8 @@ const iOSDeviceMapping: Record = { 'iPhone10,6': 'iPhone X', 'iPhone11,8': 'iPhone XR', 'iPhone11,2': 'iPhone XS', - 'iPhone11,4': 'iPhone XS Max', 'iPhone11,6': 'iPhone XS Max', + 'iPhone11,4': 'iPhone XS Max', 'iPhone12,1': 'iPhone 11', 'iPhone12,3': 'iPhone 11 Pro', 'iPhone12,5': 'iPhone 11 Pro Max', @@ -51,6 +52,15 @@ const iOSDeviceMapping: Record = { 'iPhone13,2': 'iPhone 12', 'iPhone13,3': 'iPhone 12 Pro', 'iPhone13,4': 'iPhone 12 Pro Max', + 'iPhone14,4': 'iPhone 13 mini', + 'iPhone14,5': 'iPhone 13', + 'iPhone14,2': 'iPhone 13 Pro', + 'iPhone14,3': 'iPhone 13 Pro Max', + 'iPhone14,6': 'iPhone SE (3rd generation)', + 'iPhone14,7': 'iPhone 14', + 'iPhone14,8': 'iPhone 14 Plus', + 'iPhone15,2': 'iPhone 14 Pro', + 'iPhone15,3': 'iPhone 14 Pro Max', 'iPad6,7': 'iPad Pro (12.9-inch)', 'iPad6,8': 'iPad Pro (12.9-inch)', 'iPad6,3': 'iPad Pro (9.7-inch)', @@ -71,6 +81,14 @@ const iOSDeviceMapping: Record = { 'iPad8,10': 'iPad Pro (11-inch) (2nd generation)', 'iPad8,11': 'iPad Pro (12.9-inch) (4th generation)', 'iPad8,12': 'iPad Pro (12.9-inch) (4th generation)', + 'iPad13,4': 'iPad Pro (11-inch) (3rd generation)', + 'iPad13,5': 'iPad Pro (11-inch) (3rd generation)', + 'iPad13,6': 'iPad Pro (11-inch) (3rd generation)', + 'iPad13,7': 'iPad Pro (11-inch) (3rd generation)', + 'iPad13,8': 'iPad Pro (12.9-inch) (5th generation)', + 'iPad13,9': 'iPad Pro (12.9-inch) (5th generation)', + 'iPad13,10': 'iPad Pro (12.9-inch) (5th generation)', + 'iPad13,11': 'iPad Pro (12.9-inch) (5th generation)', 'iPad2,5': 'iPad mini', 'iPad2,6': 'iPad mini', 'iPad2,7': 'iPad mini', @@ -84,6 +102,8 @@ const iOSDeviceMapping: Record = { 'iPad5,2': 'iPad mini 4', 'iPad11,1': 'iPad mini (5th generation)', 'iPad11,2': 'iPad mini (5th generation)', + 'iPad14,1': 'iPad mini (6th generation)', + 'iPad14,2': 'iPad mini (6th generation)', 'iPad4,1': 'iPad Air', 'iPad4,2': 'iPad Air', 'iPad4,3': 'iPad Air', @@ -93,6 +113,8 @@ const iOSDeviceMapping: Record = { 'iPad11,4': 'iPad Air (3rd generation)', 'iPad13,1': 'iPad Air (4th generation)', 'iPad13,2': 'iPad Air (4th generation)', + 'iPad13,16': 'iPad Air (5th generation)', + 'iPad13,17': 'iPad Air (5th generation)', 'iPad1,1': 'iPad', 'iPad2,1': 'iPad 2', 'iPad2,2': 'iPad 2', @@ -112,6 +134,8 @@ const iOSDeviceMapping: Record = { 'iPad7,12': 'iPad (7th generation)', 'iPad11,6': 'iPad (8th generation)', 'iPad11,7': 'iPad (8th generation)', + 'iPad12,1': 'iPad (9th generation)', + 'iPad12,2': 'iPad (9th generation)', 'AudioAccessory1,1': 'HomePod', 'AudioAccessory1,2': 'HomePod', 'AudioAccessory5,1': 'HomePod mini', @@ -141,15 +165,33 @@ const iOSDeviceMapping: Record = { 'Watch6,2': 'Apple Watch Series 6', 'Watch6,3': 'Apple Watch Series 6', 'Watch6,4': 'Apple Watch Series 6', + 'Watch6,6': 'Apple Watch Series 7', + 'Watch6,7': 'Apple Watch Series 7', + 'Watch6,8': 'Apple Watch Series 7', + 'Watch6,9': 'Apple Watch Series 7', + 'Watch6,10': 'Apple Watch SE (2nd generation)', + 'Watch6,11': 'Apple Watch SE (2nd generation)', + 'Watch6,12': 'Apple Watch SE (2nd generation)', + 'Watch6,13': 'Apple Watch SE (2nd generation)', + 'Watch6,14': 'Apple Watch Series 8', + 'Watch6,15': 'Apple Watch Series 8', + 'Watch6,16': 'Apple Watch Series 8', + 'Watch6,17': 'Apple Watch Series 8', + 'Watch6,18': 'Apple Watch Ultra', 'AppleTV1,1': 'Apple TV (1st generation)', 'AppleTV2,1': 'Apple TV (2nd generation)', 'AppleTV3,1': 'Apple TV (3rd generation)', 'AppleTV3,2': 'Apple TV (3rd generation)', 'AppleTV5,3': 'Apple TV (4th generation)', 'AppleTV6,2': 'Apple TV 4K', + 'AppleTV11,1': 'Apple TV 4K (2nd generation)', + 'AirTag1,1': 'AirTag', 'AirPods1,1': 'AirPods (1st generation)', - 'AirPods2,1': 'AirPods (2nd generation)', - 'iProd8,1': 'AirPods Pro', + 'AirPods2,1,AirPods2,1': 'AirPods (2nd generation)', + 'AirPods1,3,Audio2,1': 'AirPods (3rd generation)', + 'AirPods2,2,AirPodsPro1,1,iProd8,1': 'AirPods Pro', + 'AirPodsPro1,2': 'AirPods Pro (2nd generation)', + 'AirPodsMax1,1,iProd8,6': 'AirPods Max', }; export {iOSDeviceMapping}; From eb9e468ac895ce19556a97e06d079d11e17547e4 Mon Sep 17 00:00:00 2001 From: Scott Cooper Date: Mon, 17 Apr 2023 11:27:10 -0700 Subject: [PATCH 3/3] prevent empty string siri remote --- scripts/extract-ios-device-names.ts | 19 +++++++++++++------ static/app/constants/ios-device-list.tsx | 1 - 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/extract-ios-device-names.ts b/scripts/extract-ios-device-names.ts index ac43a550fc0667..ccc8cc986e31f8 100644 --- a/scripts/extract-ios-device-names.ts +++ b/scripts/extract-ios-device-names.ts @@ -1,10 +1,11 @@ +/* eslint-disable import/no-nodejs-modules */ /* eslint-env node */ -import path from 'path'; import fs from 'fs'; +import path from 'path'; import prettier from 'prettier'; -//joining path of directory +// joining path of directory const tmpOutputPath = path.join( __dirname, '../static/app/constants/ios-device-list.tmp.tsx' @@ -17,9 +18,11 @@ async function getDefinitionFiles(): Promise { const maybeJSONFiles = await fs.readdirSync(directoryPath); - //listing all files using forEach + // listing all files using forEach maybeJSONFiles.forEach(file => { - if (!file.endsWith('.json') || file === 'package.json') return; + if (!file.endsWith('.json') || file === 'package.json') { + return; + } files.push(path.join(path.resolve(directoryPath), file)); }); @@ -32,7 +35,7 @@ type Identifier = string; type Mapping = Record; -async function collectDefinitions(files: string[]): Promise { +function collectDefinitions(files: string[]): Mapping { const definitions: Mapping = {}; const queue = [...files]; @@ -52,6 +55,10 @@ async function collectDefinitions(files: string[]): Promise { } for (let i = 0; i < content.length; i++) { + if (!content[i].Identifier) { + continue; + } + definitions[content[i].Identifier] = content[i].Generation; } } @@ -86,7 +93,7 @@ const formatOutput = async (unformatted: string) => { export async function extractIOSDeviceNames() { const files = await getDefinitionFiles(); - const definitions = await collectDefinitions(files); + const definitions = collectDefinitions(files); const formatted = await formatOutput( template(JSON.stringify(definitions, undefined, 2)) ); diff --git a/static/app/constants/ios-device-list.tsx b/static/app/constants/ios-device-list.tsx index 76556745f71505..2a69652659eea7 100644 --- a/static/app/constants/ios-device-list.tsx +++ b/static/app/constants/ios-device-list.tsx @@ -4,7 +4,6 @@ // and discard the rest of the JSON so we do not end up bloating bundle size. const iOSDeviceMapping: Record = { - '': 'Siri Remote (2nd generation)', 'iPod1,1': 'iPod touch', 'iPod2,1': 'iPod touch (2nd generation)', 'iPod3,1': 'iPod touch (3rd generation)',