expo-device 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,21 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 4.1.0 — 2021-12-03
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Changed naming format of `modelName` to be more consistent ([#14670](https://github.com/expo/expo/pull/14670) by [@EvanBacon](https://github.com/EvanBacon))
18
+
19
+ ### 🎉 New features
20
+
21
+ - Added support for iOS 15.0 devices ([#14640](https://github.com/expo/expo/pull/14640) by [@EvanBacon](https://github.com/EvanBacon))
22
+ - Moved `modelName` implementation to native ([#14670](https://github.com/expo/expo/pull/14670) by [@EvanBacon](https://github.com/EvanBacon))
23
+
24
+ ## 4.0.1 — 2021-10-01
25
+
26
+ _This version does not introduce any user-facing changes._
27
+
13
28
  ## 4.0.0 — 2021-09-28
14
29
 
15
30
  ### 🛠 Breaking changes
package/README.md CHANGED
@@ -13,7 +13,7 @@ For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-
13
13
 
14
14
  # Installation in bare React Native projects
15
15
 
16
- For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/expo/expo/tree/master/packages/react-native-unimodules) before continuing.
16
+ For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
17
17
 
18
18
  ### Add the package to your npm dependencies
19
19
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '4.0.0'
6
+ version = '4.1.0'
7
7
 
8
8
  buildscript {
9
9
  // Simple helper that allows the root project to override versions declared by this library.
@@ -61,7 +61,7 @@ android {
61
61
  minSdkVersion safeExtGet("minSdkVersion", 21)
62
62
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
63
63
  versionCode 12
64
- versionName '4.0.0'
64
+ versionName '4.1.0'
65
65
  }
66
66
  lintOptions {
67
67
  abortOnError false
package/build/Device.js CHANGED
@@ -1,17 +1,12 @@
1
- import { Platform, UnavailabilityError } from 'expo-modules-core';
1
+ import { UnavailabilityError } from 'expo-modules-core';
2
2
  import { DeviceType } from './Device.types';
3
3
  import ExpoDevice from './ExpoDevice';
4
- import { getIosModelName } from './ModelNames';
5
4
  export { DeviceType };
6
5
  export const isDevice = ExpoDevice ? ExpoDevice.isDevice : true;
7
6
  export const brand = ExpoDevice ? ExpoDevice.brand : null;
8
7
  export const manufacturer = ExpoDevice ? ExpoDevice.manufacturer : null;
9
8
  export const modelId = ExpoDevice ? ExpoDevice.modelId || null : null;
10
- export const modelName = ExpoDevice
11
- ? Platform.OS === 'ios' && ExpoDevice.modelId
12
- ? getIosModelName(ExpoDevice.modelId)
13
- : ExpoDevice.modelName
14
- : null;
9
+ export const modelName = ExpoDevice ? ExpoDevice.modelName : null;
15
10
  export const designName = ExpoDevice ? ExpoDevice.designName || null : null;
16
11
  export const productName = ExpoDevice ? ExpoDevice.productName || null : null;
17
12
  export const deviceYearClass = ExpoDevice ? ExpoDevice.deviceYearClass : null;
@@ -1 +1 @@
1
- {"version":3,"file":"Device.js","sourceRoot":"","sources":["../src/Device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,CAAC,MAAM,QAAQ,GAAY,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AACzE,MAAM,CAAC,MAAM,KAAK,GAAkB,UAAU,CAAC,CAAC,CAAC,UAA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AC;KACnE;IACD,IAAI,SAAS,GAAG,MAAM,UAAU,CAAC,iBAAiB,EAAE,CAAC;IACrD,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE;QACpB,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;KACrC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,IAAI,CAAC,UAAU,CAAC,yBAAyB,EAAE;QACzC,MAAM,IAAI,mBAAmB,CAAC,aAAa,EAAE,2BAA2B,CAAC,CAAC;KAC3E;IACD,OAAO,MAAM,UAAU,CAAC,yBAAyB,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,IAAI,CAAC,UAAU,CAAC,yBAAyB,EAAE;QACzC,MAAM,IAAI,mBAAmB,CAAC,aAAa,EAAE,2BAA2B,CAAC,CAAC;KAC3E;IACD,OAAO,MAAM,UAAU,CAAC,yBAAyB,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,IAAI,CAAC,UAAU,CAAC,wBAAwB,EAAE;QACxC,OAAO,EAAE,CAAC;KACX;IACD,OAAO,MAAM,UAAU,CAAC,wBAAwB,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAAe;IAC3D,IAAI,CAAC,UAAU,CAAC,uBAAuB,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IACD,OAAO,MAAM,UAAU,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport { DeviceType } from './Device.types';\nimport ExpoDevice from './ExpoDevice';\nimport { getIosModelName } from './ModelNames';\n\nexport { DeviceType };\n\nexport const isDevice: boolean = ExpoDevice ? ExpoDevice.isDevice : true;\nexport const brand: string | null = ExpoDevice ? ExpoDevice.brand : null;\nexport const manufacturer: string | null = ExpoDevice ? ExpoDevice.manufacturer : null;\nexport const modelId = ExpoDevice ? ExpoDevice.modelId || null : null;\nexport const modelName: string | null = ExpoDevice\n ? Platform.OS === 'ios' && ExpoDevice.modelId\n ? getIosModelName(ExpoDevice.modelId)\n : ExpoDevice.modelName\n : null;\nexport const designName: string | null = ExpoDevice ? ExpoDevice.designName || null : null;\nexport const productName: string | null = ExpoDevice ? ExpoDevice.productName || null : null;\nexport const deviceYearClass: number | null = ExpoDevice ? ExpoDevice.deviceYearClass : null;\nexport const totalMemory: number | null = ExpoDevice ? ExpoDevice.totalMemory : null;\nexport const supportedCpuArchitectures: string[] | null = ExpoDevice\n ? ExpoDevice.supportedCpuArchitectures\n : null;\nexport const osName: string | null = ExpoDevice ? ExpoDevice.osName : null;\nexport const osVersion: string | null = ExpoDevice ? ExpoDevice.osVersion : null;\nexport const osBuildId: string | null = ExpoDevice ? ExpoDevice.osBuildId : null;\nexport const osInternalBuildId: string | null = ExpoDevice ? ExpoDevice.osInternalBuildId : null;\nexport const osBuildFingerprint: string | null = ExpoDevice\n ? ExpoDevice.osBuildFingerprint || null\n : null;\nexport const platformApiLevel: number | null = ExpoDevice\n ? ExpoDevice.platformApiLevel || null\n : null;\nexport const deviceName: string | null = ExpoDevice ? ExpoDevice.deviceName : null;\n\nexport async function getDeviceTypeAsync(): Promise<DeviceType> {\n if (!ExpoDevice.getDeviceTypeAsync) {\n throw new UnavailabilityError('expo-device', 'getDeviceTypeAsync');\n }\n return await ExpoDevice.getDeviceTypeAsync();\n}\n\nexport async function getUptimeAsync(): Promise<number> {\n if (!ExpoDevice.getUptimeAsync) {\n throw new UnavailabilityError('expo-device', 'getUptimeAsync');\n }\n return await ExpoDevice.getUptimeAsync();\n}\n\nexport async function getMaxMemoryAsync(): Promise<number> {\n if (!ExpoDevice.getMaxMemoryAsync) {\n throw new UnavailabilityError('expo-device', 'getMaxMemoryAsync');\n }\n let maxMemory = await ExpoDevice.getMaxMemoryAsync();\n if (maxMemory === -1) {\n maxMemory = Number.MAX_SAFE_INTEGER;\n }\n return maxMemory;\n}\n\nexport async function isRootedExperimentalAsync(): Promise<boolean> {\n if (!ExpoDevice.isRootedExperimentalAsync) {\n throw new UnavailabilityError('expo-device', 'isRootedExperimentalAsync');\n }\n return await ExpoDevice.isRootedExperimentalAsync();\n}\n\nexport async function isSideLoadingEnabledAsync(): Promise<boolean> {\n if (!ExpoDevice.isSideLoadingEnabledAsync) {\n throw new UnavailabilityError('expo-device', 'isSideLoadingEnabledAsync');\n }\n return await ExpoDevice.isSideLoadingEnabledAsync();\n}\n\nexport async function getPlatformFeaturesAsync(): Promise<string[]> {\n if (!ExpoDevice.getPlatformFeaturesAsync) {\n return [];\n }\n return await ExpoDevice.getPlatformFeaturesAsync();\n}\n\nexport async function hasPlatformFeatureAsync(feature: string): Promise<boolean> {\n if (!ExpoDevice.hasPlatformFeatureAsync) {\n return false;\n }\n return await ExpoDevice.hasPlatformFeatureAsync(feature);\n}\n"]}
1
+ {"version":3,"file":"Device.js","sourceRoot":"","sources":["../src/Device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,CAAC,MAAM,QAAQ,GAAY,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AACzE,MAAM,CAAC,MAAM,KAAK,GAAkB,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACzE,MAAM,CAAC,MAAM,YAAY,GAAkB,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AACvF,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,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A2B,CAAC,CAAC;KAC3E;IACD,OAAO,MAAM,UAAU,CAAC,yBAAyB,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,IAAI,CAAC,UAAU,CAAC,yBAAyB,EAAE;QACzC,MAAM,IAAI,mBAAmB,CAAC,aAAa,EAAE,2BAA2B,CAAC,CAAC;KAC3E;IACD,OAAO,MAAM,UAAU,CAAC,yBAAyB,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,IAAI,CAAC,UAAU,CAAC,wBAAwB,EAAE;QACxC,OAAO,EAAE,CAAC;KACX;IACD,OAAO,MAAM,UAAU,CAAC,wBAAwB,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAAe;IAC3D,IAAI,CAAC,UAAU,CAAC,uBAAuB,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IACD,OAAO,MAAM,UAAU,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport { DeviceType } from './Device.types';\nimport ExpoDevice from './ExpoDevice';\n\nexport { DeviceType };\n\nexport const isDevice: boolean = ExpoDevice ? ExpoDevice.isDevice : true;\nexport const brand: string | null = ExpoDevice ? ExpoDevice.brand : null;\nexport const manufacturer: string | null = ExpoDevice ? ExpoDevice.manufacturer : null;\nexport const modelId = ExpoDevice ? ExpoDevice.modelId || null : null;\nexport const modelName: string | null = ExpoDevice ? ExpoDevice.modelName : null;\nexport const designName: string | null = ExpoDevice ? ExpoDevice.designName || null : null;\nexport const productName: string | null = ExpoDevice ? ExpoDevice.productName || null : null;\nexport const deviceYearClass: number | null = ExpoDevice ? ExpoDevice.deviceYearClass : null;\nexport const totalMemory: number | null = ExpoDevice ? ExpoDevice.totalMemory : null;\nexport const supportedCpuArchitectures: string[] | null = ExpoDevice\n ? ExpoDevice.supportedCpuArchitectures\n : null;\nexport const osName: string | null = ExpoDevice ? ExpoDevice.osName : null;\nexport const osVersion: string | null = ExpoDevice ? ExpoDevice.osVersion : null;\nexport const osBuildId: string | null = ExpoDevice ? ExpoDevice.osBuildId : null;\nexport const osInternalBuildId: string | null = ExpoDevice ? ExpoDevice.osInternalBuildId : null;\nexport const osBuildFingerprint: string | null = ExpoDevice\n ? ExpoDevice.osBuildFingerprint || null\n : null;\nexport const platformApiLevel: number | null = ExpoDevice\n ? ExpoDevice.platformApiLevel || null\n : null;\nexport const deviceName: string | null = ExpoDevice ? ExpoDevice.deviceName : null;\n\nexport async function getDeviceTypeAsync(): Promise<DeviceType> {\n if (!ExpoDevice.getDeviceTypeAsync) {\n throw new UnavailabilityError('expo-device', 'getDeviceTypeAsync');\n }\n return await ExpoDevice.getDeviceTypeAsync();\n}\n\nexport async function getUptimeAsync(): Promise<number> {\n if (!ExpoDevice.getUptimeAsync) {\n throw new UnavailabilityError('expo-device', 'getUptimeAsync');\n }\n return await ExpoDevice.getUptimeAsync();\n}\n\nexport async function getMaxMemoryAsync(): Promise<number> {\n if (!ExpoDevice.getMaxMemoryAsync) {\n throw new UnavailabilityError('expo-device', 'getMaxMemoryAsync');\n }\n let maxMemory = await ExpoDevice.getMaxMemoryAsync();\n if (maxMemory === -1) {\n maxMemory = Number.MAX_SAFE_INTEGER;\n }\n return maxMemory;\n}\n\nexport async function isRootedExperimentalAsync(): Promise<boolean> {\n if (!ExpoDevice.isRootedExperimentalAsync) {\n throw new UnavailabilityError('expo-device', 'isRootedExperimentalAsync');\n }\n return await ExpoDevice.isRootedExperimentalAsync();\n}\n\nexport async function isSideLoadingEnabledAsync(): Promise<boolean> {\n if (!ExpoDevice.isSideLoadingEnabledAsync) {\n throw new UnavailabilityError('expo-device', 'isSideLoadingEnabledAsync');\n }\n return await ExpoDevice.isSideLoadingEnabledAsync();\n}\n\nexport async function getPlatformFeaturesAsync(): Promise<string[]> {\n if (!ExpoDevice.getPlatformFeaturesAsync) {\n return [];\n }\n return await ExpoDevice.getPlatformFeaturesAsync();\n}\n\nexport async function hasPlatformFeatureAsync(feature: string): Promise<boolean> {\n if (!ExpoDevice.hasPlatformFeatureAsync) {\n return false;\n }\n return await ExpoDevice.hasPlatformFeatureAsync(feature);\n}\n"]}
@@ -39,6 +39,7 @@ EX_EXPORT_MODULE(ExpoDevice);
39
39
  @"brand": @"Apple",
40
40
  @"manufacturer": @"Apple",
41
41
  @"modelId": EXNullIfNil([[self class] modelId]),
42
+ @"modelName": [[self class] modelName],
42
43
  @"deviceYearClass": [[self class] deviceYear],
43
44
  @"totalMemory": @(NSProcessInfo.processInfo.physicalMemory),
44
45
  @"supportedCpuArchitectures": EXNullIfNil([[self class] cpuArchitectures]),
@@ -201,148 +202,163 @@ EX_EXPORT_METHOD_AS(isRootedExperimentalAsync,
201
202
  #endif
202
203
  }
203
204
 
204
- + (NSNumber *)deviceYear
205
+ + (NSDictionary *)getDeviceMap
205
206
  {
206
- NSString *platform = [self devicePlatform];
207
-
208
- // TODO: Apple TV and Apple watch
209
- NSDictionary *mapping = @{
210
- // iPhone 1
211
- @"iPhone1,1": @2007,
212
-
213
- // iPhone 3G
214
- @"iPhone1,2": @2008,
215
-
216
- // iPhone 3GS
217
- @"iPhone2,1": @2009,
218
-
219
- // iPhone 4
220
- @"iPhone3,1": @2010,
221
- @"iPhone3,2": @2010,
222
- @"iPhone3,3": @2010,
223
-
224
- // iPhone 4S
225
- @"iPhone4,1": @2011,
226
-
227
- // iPhone 5
228
- @"iPhone5,1": @2012,
229
- @"iPhone5,2": @2012,
230
-
231
- // iPhone 5S and 5C
232
- @"iPhone5,3": @2013,
233
- @"iPhone5,4": @2013,
234
- @"iPhone6,1": @2013,
235
- @"iPhone6,2": @2013,
236
-
237
- @"iPhone7,1": @2014, // iPhone 6 Plus
238
- @"iPhone7,2": @2014, // iPhone 6
239
- @"iPhone8,1": @2015, // iPhone 6S
240
- @"iPhone8,2": @2015, // iPhone 6S Plus
241
- @"iPhone8,4": @2016, // iPhone SE
242
- @"iPhone9,1": @2016, // iPhone 7
243
- @"iPhone9,3": @2016, // iPhone 7 Plus
244
- @"iPhone9,2": @2016, // iPhone 7
245
- @"iPhone9,4": @2016, // iPhone 7 Plus
246
- @"iPhone10,1": @2017, // iPhone 8
247
- @"iPhone10,2": @2017, // iPhone 8 Plus
248
- @"iPhone10,3": @2017, // iPhone X Global
249
- @"iPhone10,4": @2017, // iPhone 8
250
- @"iPhone10,5": @2017, // iPhone 8 Plus
251
- @"iPhone10,6": @2017, // iPhone X GSM
252
- @"iPhone11,2": @2018, // iPhone Xs
253
- @"iPhone11,4": @2018, // iPhone Xs Max
254
- @"iPhone11,6": @2018, // iPhone Xs Max Global
255
- @"iPhone11,8": @2018, // iPhone Xr
256
- @"iPhone12,1": @2019, // iPhone 11
257
- @"iPhone12,3": @2019, // iPhone 11 Pro
258
- @"iPhone12,5": @2019, // iPhone 11 Pro Max
259
- @"iPhone12,8": @2020, // iPhone SE 2nd Gen
260
- @"iPhone13,1": @2020, // iPhone 12 mini
261
- @"iPhone13,2": @2020, // iPhone 12
262
- @"iPhone13,3": @2020, // iPhone 12 Pro
263
- @"iPhone13,4": @2020, // iPhone 12 Pro Max
264
-
207
+ return @{
265
208
  // iPod
266
- @"iPod1,1": @2007,
267
- @"iPod2,1": @2008,
268
- @"iPod3,1": @2009,
269
- @"iPod4,1": @2010,
270
- @"iPod5,1": @2012,
271
- @"iPod7,1": @2015, // iPod 6th Gen
272
- @"iPod9,1": @2019, // iPod 7th Gen
273
-
274
- // iPad
275
- @"iPad1,1": @2010,
276
- @"iPad2,1": @2011,
277
- @"iPad2,2": @2011,
278
- @"iPad2,3": @2011,
279
- @"iPad2,4": @2011,
280
- @"iPad2,5": @2012, // iPad Mini (WiFi)
281
- @"iPad2,6": @2012, // iPad Mini (GSM+LTE)
282
- @"iPad2,7": @2012, // iPad Mini (CDMA+LTE)
283
- @"iPad3,1": @2012,
284
- @"iPad3,2": @2012,
285
- @"iPad3,3": @2012,
286
- @"iPad3,4": @2013,
287
- @"iPad3,5": @2013,
288
- @"iPad3,6": @2013,
289
- @"iPad4,1": @2013,
290
- @"iPad4,2": @2013,
291
- @"iPad4,3": @2013,
292
- @"iPad4,4": @2013, // iPad Mini Retina (WiFi)
293
- @"iPad4,5": @2013, // iPad Mini Retina (GSM+CDMA)
294
- @"iPad4,6": @2013, // iPad Mini Retina (China)
295
- @"iPad4,7": @2014, // iPad Mini 3 (WiFi)
296
- @"iPad4,8": @2014, // iPad Mini 3 (GSM+CDMA)
297
- @"iPad4,9": @2014, // iPad Mini 3 (China)
298
- @"iPad5,1": @2015, // iPad Mini 4 (WiFi)
299
- @"iPad5,2": @2015, // iPad Mini 4 (WiFi+Cellular)
300
- @"iPad5,3": @2014,
301
- @"iPad5,4": @2014,
302
- @"iPad6,7": @2015,
303
- @"iPad6,8": @2015,
304
- @"iPad6,3": @2016,
305
- @"iPad6,4": @2016,
306
- @"iPad6,11": @2017, // iPad 5th Gen (WiFi)
307
- @"iPad6,12": @2017, // iPad 5th Gen (WiFi+Cellular)
308
- @"iPad7,1": @2017, // iPad Pro 2nd Gen (WiFi)
309
- @"iPad7,2": @2017, // iPad Pro 2nd Gen (WiFi+Cellular)
310
- @"iPad7,3": @2017, // iPad Pro 10.5-inch
311
- @"iPad7,4": @2017, // iPad Pro 10.5-inch
312
- @"iPad7,5": @2018, // iPad 6th Gen (WiFi)
313
- @"iPad7,6": @2018, // iPad 6th Gen (WiFi+Cellular)
314
- @"iPad7,11": @2019, // iPad 7th Gen 10.2-inch (WiFi)
315
- @"iPad7,12": @2019, // iPad 7th Gen 10.2-inch (WiFi+Cellular)
316
- @"iPad8,1": @2018, // iPad Pro 3rd Gen (11 inch, WiFi)
317
- @"iPad8,2": @2018, // iPad Pro 3rd Gen (11 inch, 1TB, WiFi)
318
- @"iPad8,3": @2018, // iPad Pro 3rd Gen (11 inch, WiFi+Cellular)
319
- @"iPad8,4": @2018, // iPad Pro 3rd Gen (11 inch, 1TB, WiFi+Cellular)
320
- @"iPad8,5": @2018, // iPad Pro 3rd Gen (12.9 inch, WiFi)
321
- @"iPad8,6": @2018, // iPad Pro 3rd Gen (12.9 inch, 1TB, WiFi)
322
- @"iPad8,7": @2018, // iPad Pro 3rd Gen (12.9 inch, WiFi+Cellular)
323
- @"iPad8,8": @2018, // iPad Pro 3rd Gen (12.9 inch, 1TB, WiFi+Cellular)
324
- @"iPad11,1": @2019, // iPad Mini 5th Gen (WiFi)
325
- @"iPad11,2": @2019, // iPad Mini 5th Gen
326
- @"iPad11,3": @2019, // iPad Air 3rd Gen (WiFi)
327
- @"iPad11,4": @2019, // iPad Air 3rd Gen
328
- @"iPad11,6": @2020, // iPad 8th Gen
329
- @"iPad11,7": @2020, // iPad 8th Gen
330
- @"iPad13,1": @2020, // iPad Air 4th Gen (WiFi)
331
- @"iPad13,2": @2020, // iPad Air 4th Gen (WiFi+Cellular)
332
- @"iPad13,4": @2021, // iPad Pro 11-inch 3rd Gen
333
- @"iPad13,5": @2021, // iPad Pro 11-inch 3rd Gen
334
- @"iPad13,6": @2021, // iPad Pro 11-inch 3rd Gen
335
- @"iPad13,7": @2021, // iPad Pro 11-inch 3rd Gen
336
- @"iPad13,8": @2021, // iPad Pro 12.9-inch 5th Gen
337
- @"iPad13,9": @2021, // iPad Pro 12.9-inch 5th Gen
338
- @"iPad13,10": @2021, // iPad Pro 12.9-inch 5th Gen
339
- @"iPad13,11": @2021, // iPad Pro 12.9-inch 5th Gen
209
+ // -- 12 Start --
210
+ @"iPod7,1": @{ @"name": @"iPod Touch (6th generation)", @"year": @2015 }, // (Sixth Generation)
211
+ // -- 12 End --
212
+ @"iPod9,1": @{ @"name": @"iPod Touch (7th generation)", @"year": @2019 }, // (Seventh Generation)
213
+
214
+ // iPhone
215
+ // -- 12 Start --
216
+ @"iPhone6,1": @{ @"name": @"iPhone 5s", @"year": @2013 }, // (model A1433, A1533 | GSM)
217
+ @"iPhone6,2": @{ @"name": @"iPhone 5s", @"year": @2013 }, // (model A1457, A1518, A1528 (China), A1530 | Global)
218
+ @"iPhone7,1": @{ @"name": @"iPhone 6 Plus", @"year": @2014 }, //
219
+ @"iPhone7,2": @{ @"name": @"iPhone 6", @"year": @2014 }, //
220
+ // -- 12 End --
221
+ @"iPhone8,1": @{ @"name": @"iPhone 6s", @"year": @2015 }, //
222
+ @"iPhone8,2": @{ @"name": @"iPhone 6s Plus", @"year": @2015 }, //
223
+ @"iPhone8,4": @{ @"name": @"iPhone SE", @"year": @2016 }, //
224
+ @"iPhone9,1": @{ @"name": @"iPhone 7", @"year": @2016 }, // (model A1660 | CDMA)
225
+ @"iPhone9,3": @{ @"name": @"iPhone 7", @"year": @2016 }, // (model A1778 | Global)
226
+ @"iPhone9,2": @{ @"name": @"iPhone 7 Plus", @"year": @2016 }, // (model A1661 | CDMA)
227
+ @"iPhone9,4": @{ @"name": @"iPhone 7 Plus", @"year": @2016 }, // (model A1784 | Global)
228
+ @"iPhone10,1": @{ @"name": @"iPhone 8", @"year": @2017 }, // (model A1863, A1906, A1907)
229
+ @"iPhone10,2": @{ @"name": @"iPhone 8 Plus", @"year": @2017 }, // (model A1864, A1898, A1899)
230
+ @"iPhone10,3": @{ @"name": @"iPhone X", @"year": @2017 }, // (model A1865, A1902)
231
+ @"iPhone10,4": @{ @"name": @"iPhone 8", @"year": @2017 }, // (model A1905)
232
+ @"iPhone10,5": @{ @"name": @"iPhone 8 Plus", @"year": @2017 }, // (model A1897)
233
+ @"iPhone10,6": @{ @"name": @"iPhone X", @"year": @2017 }, // (model A1901)
234
+ @"iPhone11,2": @{ @"name": @"iPhone XS", @"year": @2018 }, // (model A2097, A2098)
235
+ @"iPhone11,4": @{ @"name": @"iPhone XS Max", @"year": @2018 }, // (model A1921, A2103)
236
+ @"iPhone11,6": @{ @"name": @"iPhone XS Max", @"year": @2018 }, // (model A2104)
237
+ @"iPhone11,8": @{ @"name": @"iPhone XR", @"year": @2018 }, // (model A1882, A1719, A2105)
238
+ @"iPhone12,1": @{ @"name": @"iPhone 11", @"year": @2019 },
239
+ @"iPhone12,3": @{ @"name": @"iPhone 11 Pro", @"year": @2019 },
240
+ @"iPhone12,5": @{ @"name": @"iPhone 11 Pro Max", @"year": @2019 },
241
+ @"iPhone12,8": @{ @"name": @"iPhone SE 2", @"year": @2020 },
242
+ @"iPhone13,1": @{ @"name": @"iPhone 12 mini", @"year": @2020 },
243
+ @"iPhone13,2": @{ @"name": @"iPhone 12", @"year": @2020 },
244
+ @"iPhone13,3": @{ @"name": @"iPhone 12 Pro", @"year": @2020 },
245
+ @"iPhone13,4": @{ @"name": @"iPhone 12 Pro Max", @"year": @2020 },
246
+ @"iPhone14,2": @{ @"name": @"iPhone 13 Pro", @"year": @2021 },
247
+ @"iPhone14,3": @{ @"name": @"iPhone 13 Pro Max", @"year": @2021 },
248
+ @"iPhone14,4": @{ @"name": @"iPhone 13 Mini", @"year": @2021 },
249
+ @"iPhone14,5": @{ @"name": @"iPhone 13", @"year": @2021 },
250
+
251
+ // -- 12 Start --
252
+ @"iPad4,1": @{ @"name": @"iPad Air (5th generation)", @"year": @2017 }, // Wifi
253
+ @"iPad4,2": @{ @"name": @"iPad Air (5th generation)", @"year": @2017 }, // Cellular
254
+ @"iPad4,3": @{ @"name": @"iPad Air (5th generation)", @"year": @2017 },
255
+ @"iPad4,4": @{ @"name": @"iPad mini (2nd generation)", @"year": @2013 }, // Wifi
256
+ @"iPad4,5": @{ @"name": @"iPad mini (2nd generation)", @"year": @2013 }, // Cellular
257
+ @"iPad4,6": @{ @"name": @"iPad mini (2nd generation)", @"year": @2013 }, // China
258
+ @"iPad4,7": @{ @"name": @"iPad mini (3rd generation)", @"year": @2014 },
259
+ @"iPad4,8": @{ @"name": @"iPad mini (3rd generation)", @"year": @2014 },
260
+ @"iPad4,9": @{ @"name": @"iPad mini (3rd generation)", @"year": @2014 }, // China
261
+ // -- 12 End --
262
+ @"iPad5,1": @{ @"name": @"iPad mini (4th generation)", @"year": @2015 },
263
+ @"iPad5,2": @{ @"name": @"iPad mini (4th generation)", @"year": @2015 },
264
+ @"iPad5,3": @{ @"name": @"iPad Air 2 (6th generation)", @"year": @2014 },
265
+ @"iPad5,4": @{ @"name": @"iPad Air 2 (6th generation)", @"year": @2014 },
266
+ @"iPad6,3": @{ @"name": @"iPad Pro 9.7-inch", @"year": @2016 },
267
+ @"iPad6,4": @{ @"name": @"iPad Pro 9.7-inch", @"year": @2016 },
268
+ @"iPad6,7": @{ @"name": @"iPad Pro 12.9-inch", @"year": @2015 },
269
+ @"iPad6,8": @{ @"name": @"iPad Pro 12.9-inch", @"year": @2015 },
270
+ @"iPad7,1": @{ @"name": @"iPad Pro 12.9-inch (2nd generation)", @"year": @2017 }, // Wifi
271
+ @"iPad7,2": @{ @"name": @"iPad Pro 12.9-inch (2nd generation)", @"year": @2017 }, // Cellular
272
+ @"iPad7,3": @{ @"name": @"iPad Pro 10.5-inch", @"year": @2017 }, // Wifi
273
+ @"iPad7,4": @{ @"name": @"iPad Pro 10.5-inch", @"year": @2017 }, // Cellular
274
+ @"iPad7,5": @{ @"name": @"iPad (6th generation)", @"year": @2018 }, // Wifi
275
+ @"iPad7,6": @{ @"name": @"iPad (6th generation)", @"year": @2018 }, // Cellular
276
+ @"iPad7,11": @{ @"name": @"iPad (7th generation)", @"year": @2019 }, // WiFi
277
+ @"iPad7,12": @{ @"name": @"iPad (7th generation)", @"year": @2019 }, // WiFi + cellular
278
+ @"iPad8,1": @{ @"name": @"iPad Pro 11-inch (3rd generation)", @"year": @2018 }, // Wifi
279
+ @"iPad8,2": @{ @"name": @"iPad Pro 11-inch (3rd generation)", @"year": @2018 }, // 1TB - Wifi
280
+ @"iPad8,3": @{ @"name": @"iPad Pro 11-inch (3rd generation)", @"year": @2018 }, // Wifi + cellular
281
+ @"iPad8,4": @{ @"name": @"iPad Pro 11-inch (3rd generation)", @"year": @2018 }, // 1TB - Wifi + cellular
282
+ @"iPad8,5": @{ @"name": @"iPad Pro 12.9-inch (3rd generation)", @"year": @2018 }, // Wifi
283
+ @"iPad8,6": @{ @"name": @"iPad Pro 12.9-inch (3rd generation)", @"year": @2018 }, // 1TB - Wifi
284
+ @"iPad8,7": @{ @"name": @"iPad Pro 12.9-inch (3rd generation)", @"year": @2018 }, // Wifi + cellular
285
+ @"iPad8,8": @{ @"name": @"iPad Pro 12.9-inch (3rd generation)", @"year": @2018 }, // 1TB - Wifi + cellular
286
+
287
+ @"iPad8,9": @{ @"name": @"iPad Pro 11-inch (4th generation)", @"year": @2020 }, // Wifi
288
+ @"iPad8,10": @{ @"name": @"iPad Pro 11-inch (4th generation)", @"year": @2020 }, // Wifi + cellular
289
+ @"iPad8,11": @{ @"name": @"iPad Pro 12.9-inch (4th generation)", @"year": @2020 }, // Wifi
290
+ @"iPad8,12": @{ @"name": @"iPad Pro 12.9-inch (4th generation)", @"year": @2020 }, // Wifi + cellular
291
+ @"iPad11,1": @{ @"name": @"iPad mini (5th generation)", @"year": @2019 }, // WiFi
292
+ @"iPad11,2": @{ @"name": @"iPad mini (5th generation)", @"year": @2019 }, // WiFi + cellular
293
+ @"iPad11,3": @{ @"name": @"iPad Air (3rd generation)", @"year": @2019 }, // WiFi
294
+ @"iPad11,4": @{ @"name": @"iPad Air (3rd generation)", @"year": @2019 }, // WiFi + cellular
295
+ @"iPad11,6": @{ @"name": @"iPad (8th generation)", @"year": @2020 }, // WiFi
296
+ @"iPad11,7": @{ @"name": @"iPad (8th generation)", @"year": @2020 }, // WiFi + cellular
297
+ @"iPad13,1": @{ @"name": @"iPad Air (4th generation)", @"year": @2020 }, // WiFi
298
+ @"iPad13,2": @{ @"name": @"iPad Air (4th generation)", @"year": @2020 }, // WiFi + cellular
299
+ @"iPad13,4": @{ @"name": @"iPad Pro 11-inch 3", @"year": @2021 }, // WiFi
300
+ @"iPad13,5": @{ @"name": @"iPad Pro 11-inch 3", @"year": @2021 }, // WiFi
301
+ @"iPad13,6": @{ @"name": @"iPad Pro 11-inch 3", @"year": @2021 }, // WiFi + cellular
302
+ @"iPad13,7": @{ @"name": @"iPad Pro 11-inch 3", @"year": @2021 }, // WiFi + cellular
303
+ @"iPad13,8": @{ @"name": @"iPad Pro 12.9-inch 5", @"year": @2021 }, // WiFi
304
+ @"iPad13,9": @{ @"name": @"iPad Pro 12.9-inch 5", @"year": @2021 }, // WiFi
305
+ @"iPad13,10": @{ @"name": @"iPad Pro 12.9-inch 5", @"year": @2021 }, // WiFi + cellular
306
+ @"iPad13,11": @{ @"name": @"iPad Pro 12.9-inch 5", @"year": @2021 }, // WiFi + cellular
307
+ @"iPad14,1": @{ @"name": @"iPad mini 6", @"year": @2021 }, // WiFi
308
+ @"iPad14,2": @{ @"name": @"iPad mini 6", @"year": @2021 }, // WiFi + cellular
309
+
310
+ @"AppleTV2,1": @{ @"name": @"Apple TV (2nd generation)", @"year": @2010 },
311
+ @"AppleTV3,1": @{ @"name": @"Apple TV (3rd generation)", @"year": @2012 },
312
+ @"AppleTV3,2": @{ @"name": @"Apple TV (3rd generation - Rev A)", @"year": @2013 },
313
+ @"AppleTV5,3": @{ @"name": @"Apple TV (4th generation)", @"year": @2015 },
314
+ @"AppleTV6,2": @{ @"name": @"Apple TV 4K", @"year": @2021 }
340
315
  };
316
+ }
317
+
318
+ + (nullable NSString *)modelName
319
+ {
320
+ NSString *platform = [self modelId];
321
+
322
+ if (platform == nil) {
323
+ return [NSNull null];
324
+ }
341
325
 
342
- NSNumber *deviceYear = mapping[platform];
326
+ NSDictionary *mapping = [self getDeviceMap];
327
+
328
+ if (mapping[platform]) {
329
+ return mapping[platform][@"name"];
330
+ }
331
+
332
+ // Infer the main type of model from the ID
333
+ if ([platform hasPrefix:@"iPod"]) {
334
+ return @"iPod Touch";
335
+ }
336
+
337
+ if ([platform hasPrefix:@"iPad"]) {
338
+ return @"iPad";
339
+ }
340
+
341
+ if ([platform hasPrefix:@"iPhone"]) {
342
+ return @"iPhone";
343
+ }
344
+
345
+ if ([platform hasPrefix:@"AppleTV"]) {
346
+ return @"Apple TV";
347
+ }
348
+
349
+ return [NSNull null];
350
+ }
351
+
352
+ + (NSNumber *)deviceYear
353
+ {
354
+ NSString *platform = [self modelId];
343
355
 
344
- if (deviceYear) {
345
- return deviceYear;
356
+ if (platform != nil) {
357
+ NSDictionary *mapping = [self getDeviceMap];
358
+
359
+ if (mapping[platform]) {
360
+ return mapping[platform][@"year"];
361
+ }
346
362
  }
347
363
 
348
364
  // Simulator or unknown - assume this is the newest device
@@ -353,19 +369,6 @@ EX_EXPORT_METHOD_AS(isRootedExperimentalAsync,
353
369
  return @([yearString intValue]);
354
370
  }
355
371
 
356
- + (NSString *)devicePlatform
357
- {
358
- // https://gist.github.com/Jaybles/1323251
359
- // https://www.theiphonewiki.com/wiki/Models
360
- size_t size;
361
- sysctlbyname("hw.machine", NULL, &size, NULL, 0);
362
- char *machine = malloc(size);
363
- sysctlbyname("hw.machine", machine, &size, NULL, 0);
364
- NSString *platform = [NSString stringWithUTF8String:machine];
365
- free(machine);
366
- return platform;
367
- }
368
-
369
372
  @end
370
373
 
371
374
  NS_ASSUME_NONNULL_END
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-device",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "A universal module that gets physical information about the device running the application",
5
5
  "main": "build/Device.js",
6
6
  "types": "build/Device.d.ts",
@@ -33,11 +33,13 @@
33
33
  "license": "MIT",
34
34
  "homepage": "https://docs.expo.dev/versions/latest/sdk/device/",
35
35
  "dependencies": {
36
- "expo-modules-core": "~0.4.0",
37
36
  "ua-parser-js": "^0.7.19"
38
37
  },
39
38
  "devDependencies": {
40
39
  "expo-module-scripts": "^2.0.0"
41
40
  },
42
- "gitHead": "1fffde73411ee7a642b98f1506a8de921805d52b"
41
+ "peerDependencies": {
42
+ "expo": "*"
43
+ },
44
+ "gitHead": "2e5c6983b86d5ecfca028ba64002897d8adc2cc4"
43
45
  }
package/src/Device.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { Platform, UnavailabilityError } from 'expo-modules-core';
1
+ import { UnavailabilityError } from 'expo-modules-core';
2
2
 
3
3
  import { DeviceType } from './Device.types';
4
4
  import ExpoDevice from './ExpoDevice';
5
- import { getIosModelName } from './ModelNames';
6
5
 
7
6
  export { DeviceType };
8
7
 
@@ -10,11 +9,7 @@ export const isDevice: boolean = ExpoDevice ? ExpoDevice.isDevice : true;
10
9
  export const brand: string | null = ExpoDevice ? ExpoDevice.brand : null;
11
10
  export const manufacturer: string | null = ExpoDevice ? ExpoDevice.manufacturer : null;
12
11
  export const modelId = ExpoDevice ? ExpoDevice.modelId || null : null;
13
- export const modelName: string | null = ExpoDevice
14
- ? Platform.OS === 'ios' && ExpoDevice.modelId
15
- ? getIosModelName(ExpoDevice.modelId)
16
- : ExpoDevice.modelName
17
- : null;
12
+ export const modelName: string | null = ExpoDevice ? ExpoDevice.modelName : null;
18
13
  export const designName: string | null = ExpoDevice ? ExpoDevice.designName || null : null;
19
14
  export const productName: string | null = ExpoDevice ? ExpoDevice.productName || null : null;
20
15
  export const deviceYearClass: number | null = ExpoDevice ? ExpoDevice.deviceYearClass : null;
@@ -1,121 +0,0 @@
1
- export declare function getIosModelName(modelId: string): string | null;
2
- export declare const iosModelNames: {
3
- 'iPod1,1': string;
4
- 'iPod2,1': string;
5
- 'iPod3,1': string;
6
- 'iPod4,1': string;
7
- 'iPod5,1': string;
8
- 'iPod7,1': string;
9
- 'iPhone1,1': string;
10
- 'iPhone1,2': string;
11
- 'iPhone2,1': string;
12
- 'iPad1,1': string;
13
- 'iPad2,1': string;
14
- 'iPad2,2': string;
15
- 'iPad2,3': string;
16
- 'iPad2,4': string;
17
- 'iPad3,1': string;
18
- 'iPad3,2': string;
19
- 'iPad3,3': string;
20
- 'iPhone3,1': string;
21
- 'iPhone3,2': string;
22
- 'iPhone3,3': string;
23
- 'iPhone4,1': string;
24
- 'iPhone5,1': string;
25
- 'iPhone5,2': string;
26
- 'iPad3,4': string;
27
- 'iPad3,5': string;
28
- 'iPad3,6': string;
29
- 'iPad2,5': string;
30
- 'iPad2,6': string;
31
- 'iPad2,7': string;
32
- 'iPhone5,3': string;
33
- 'iPhone5,4': string;
34
- 'iPhone6,1': string;
35
- 'iPhone6,2': string;
36
- 'iPhone7,1': string;
37
- 'iPhone7,2': string;
38
- 'iPhone8,1': string;
39
- 'iPhone8,2': string;
40
- 'iPhone8,4': string;
41
- 'iPhone9,1': string;
42
- 'iPhone9,3': string;
43
- 'iPhone9,2': string;
44
- 'iPhone9,4': string;
45
- 'iPhone10,3': string;
46
- 'iPhone10,6': string;
47
- 'iPhone10,1': string;
48
- 'iPhone10,4': string;
49
- 'iPhone10,2': string;
50
- 'iPhone10,5': string;
51
- 'iPhone11,2': string;
52
- 'iPhone11,4': string;
53
- 'iPhone11,6': string;
54
- 'iPhone11,8': string;
55
- 'iPhone12,1': string;
56
- 'iPhone12,3': string;
57
- 'iPhone12,5': string;
58
- 'iPhone12,8': string;
59
- 'iPhone13,1': string;
60
- 'iPhone13,2': string;
61
- 'iPhone13,3': string;
62
- 'iPhone13,4': string;
63
- 'iPad4,1': string;
64
- 'iPad4,2': string;
65
- 'iPad4,3': string;
66
- 'iPad4,4': string;
67
- 'iPad4,5': string;
68
- 'iPad4,6': string;
69
- 'iPad4,7': string;
70
- 'iPad4,8': string;
71
- 'iPad4,9': string;
72
- 'iPad5,1': string;
73
- 'iPad5,2': string;
74
- 'iPad5,3': string;
75
- 'iPad5,4': string;
76
- 'iPad6,3': string;
77
- 'iPad6,4': string;
78
- 'iPad6,7': string;
79
- 'iPad6,8': string;
80
- 'iPad7,1': string;
81
- 'iPad7,2': string;
82
- 'iPad7,3': string;
83
- 'iPad7,4': string;
84
- 'iPad7,5': string;
85
- 'iPad7,6': string;
86
- 'iPad7,11': string;
87
- 'iPad7,12': string;
88
- 'iPad8,1': string;
89
- 'iPad8,2': string;
90
- 'iPad8,3': string;
91
- 'iPad8,4': string;
92
- 'iPad8,5': string;
93
- 'iPad8,6': string;
94
- 'iPad8,7': string;
95
- 'iPad8,8': string;
96
- 'iPad8,9': string;
97
- 'iPad8,10': string;
98
- 'iPad8,11': string;
99
- 'iPad8,12': string;
100
- 'iPad11,1': string;
101
- 'iPad11,2': string;
102
- 'iPad11,3': string;
103
- 'iPad11,4': string;
104
- 'iPad11,6': string;
105
- 'iPad11,7': string;
106
- 'iPad13,1': string;
107
- 'iPad13,2': string;
108
- 'iPad13,4': string;
109
- 'iPad13,5': string;
110
- 'iPad13,6': string;
111
- 'iPad13,7': string;
112
- 'iPad13,8': string;
113
- 'iPad13,9': string;
114
- 'iPad13,10': string;
115
- 'iPad13,11': string;
116
- 'AppleTV2,1': string;
117
- 'AppleTV3,1': string;
118
- 'AppleTV3,2': string;
119
- 'AppleTV5,3': string;
120
- 'AppleTV6,2': string;
121
- };
@@ -1,141 +0,0 @@
1
- export function getIosModelName(modelId) {
2
- const knownModelName = iosModelNames[modelId];
3
- if (knownModelName) {
4
- return knownModelName;
5
- }
6
- // Infer the main type of model from the ID
7
- if (modelId.startsWith('iPod')) {
8
- return 'iPod Touch';
9
- }
10
- if (modelId.startsWith('iPad')) {
11
- return 'iPad';
12
- }
13
- if (modelId.startsWith('iPhone')) {
14
- return 'iPhone';
15
- }
16
- if (modelId.startsWith('AppleTV')) {
17
- return 'Apple TV';
18
- }
19
- return null;
20
- }
21
- export const iosModelNames = {
22
- 'iPod1,1': 'iPod Touch',
23
- 'iPod2,1': 'iPod Touch',
24
- 'iPod3,1': 'iPod Touch',
25
- 'iPod4,1': 'iPod Touch',
26
- 'iPod5,1': 'iPod Touch',
27
- 'iPod7,1': 'iPod Touch',
28
- 'iPhone1,1': 'iPhone',
29
- 'iPhone1,2': 'iPhone 3G',
30
- 'iPhone2,1': 'iPhone 3GS',
31
- 'iPad1,1': 'iPad',
32
- 'iPad2,1': 'iPad 2',
33
- 'iPad2,2': 'iPad 2',
34
- 'iPad2,3': 'iPad 2',
35
- 'iPad2,4': 'iPad 2',
36
- 'iPad3,1': 'iPad',
37
- 'iPad3,2': 'iPad',
38
- 'iPad3,3': 'iPad',
39
- 'iPhone3,1': 'iPhone 4',
40
- 'iPhone3,2': 'iPhone 4',
41
- 'iPhone3,3': 'iPhone 4',
42
- 'iPhone4,1': 'iPhone 4S',
43
- 'iPhone5,1': 'iPhone 5',
44
- 'iPhone5,2': 'iPhone 5',
45
- 'iPad3,4': 'iPad',
46
- 'iPad3,5': 'iPad',
47
- 'iPad3,6': 'iPad',
48
- 'iPad2,5': 'iPad mini',
49
- 'iPad2,6': 'iPad mini',
50
- 'iPad2,7': 'iPad mini',
51
- 'iPhone5,3': 'iPhone 5c',
52
- 'iPhone5,4': 'iPhone 5c',
53
- 'iPhone6,1': 'iPhone 5s',
54
- 'iPhone6,2': 'iPhone 5s',
55
- 'iPhone7,1': 'iPhone 6 Plus',
56
- 'iPhone7,2': 'iPhone 6',
57
- 'iPhone8,1': 'iPhone 6s',
58
- 'iPhone8,2': 'iPhone 6s Plus',
59
- 'iPhone8,4': 'iPhone SE',
60
- 'iPhone9,1': 'iPhone 7',
61
- 'iPhone9,3': 'iPhone 7',
62
- 'iPhone9,2': 'iPhone 7 Plus',
63
- 'iPhone9,4': 'iPhone 7 Plus',
64
- 'iPhone10,3': 'iPhone X',
65
- 'iPhone10,6': 'iPhone X',
66
- 'iPhone10,1': 'iPhone 8',
67
- 'iPhone10,4': 'iPhone 8',
68
- 'iPhone10,2': 'iPhone 8 Plus',
69
- 'iPhone10,5': 'iPhone 8 Plus',
70
- 'iPhone11,2': 'iPhone XS',
71
- 'iPhone11,4': 'iPhone XS Max',
72
- 'iPhone11,6': 'iPhone XS Max',
73
- 'iPhone11,8': 'iPhone XR',
74
- 'iPhone12,1': 'iPhone 11',
75
- 'iPhone12,3': 'iPhone 11 Pro',
76
- 'iPhone12,5': 'iPhone 11 Pro Max',
77
- 'iPhone12,8': 'iPhone SE (2nd generation)',
78
- 'iPhone13,1': 'iPhone 12 mini',
79
- 'iPhone13,2': 'iPhone 12',
80
- 'iPhone13,3': 'iPhone 12 Pro',
81
- 'iPhone13,4': 'iPhone 12 Pro Max',
82
- 'iPad4,1': 'iPad Air',
83
- 'iPad4,2': 'iPad Air',
84
- 'iPad4,3': 'iPad Air',
85
- 'iPad4,4': 'iPad mini (2nd generation)',
86
- 'iPad4,5': 'iPad mini (2nd generation)',
87
- 'iPad4,6': 'iPad mini (2nd generation)',
88
- 'iPad4,7': 'iPad mini 3',
89
- 'iPad4,8': 'iPad mini 3',
90
- 'iPad4,9': 'iPad mini 3',
91
- 'iPad5,1': 'iPad mini 4',
92
- 'iPad5,2': 'iPad mini 4',
93
- 'iPad5,3': 'iPad Air 2',
94
- 'iPad5,4': 'iPad Air 2',
95
- 'iPad6,3': 'iPad Pro 9.7-inch',
96
- 'iPad6,4': 'iPad Pro 9.7-inch',
97
- 'iPad6,7': 'iPad Pro 12.9-inch',
98
- 'iPad6,8': 'iPad Pro 12.9-inch',
99
- 'iPad7,1': 'iPad Pro 12.9-inch',
100
- 'iPad7,2': 'iPad Pro 12.9-inch',
101
- 'iPad7,3': 'iPad Pro 10.5-inch',
102
- 'iPad7,4': 'iPad Pro 10.5-inch',
103
- 'iPad7,5': 'iPad (6th generation)',
104
- 'iPad7,6': 'iPad (6th generation)',
105
- 'iPad7,11': 'iPad (7th generation)',
106
- 'iPad7,12': 'iPad (7th generation)',
107
- 'iPad8,1': 'iPad Pro 11-inch (3rd generation)',
108
- 'iPad8,2': 'iPad Pro 11-inch (3rd generation)',
109
- 'iPad8,3': 'iPad Pro 11-inch (3rd generation)',
110
- 'iPad8,4': 'iPad Pro 11-inch (3rd generation)',
111
- 'iPad8,5': 'iPad Pro 12.9-inch (3rd generation)',
112
- 'iPad8,6': 'iPad Pro 12.9-inch (3rd generation)',
113
- 'iPad8,7': 'iPad Pro 12.9-inch (3rd generation)',
114
- 'iPad8,8': 'iPad Pro 12.9-inch (3rd generation)',
115
- 'iPad8,9': 'iPad Pro 11-inch (4th generation)',
116
- 'iPad8,10': 'iPad Pro 11-inch (4th generation)',
117
- 'iPad8,11': 'iPad Pro 12.9-inch (4th generation)',
118
- 'iPad8,12': 'iPad Pro 12.9-inch (4th generation)',
119
- 'iPad11,1': 'iPad mini (5th generation)',
120
- 'iPad11,2': 'iPad mini (5th generation)',
121
- 'iPad11,3': 'iPad Air (3rd generation)',
122
- 'iPad11,4': 'iPad Air (3rd generation)',
123
- 'iPad11,6': 'iPad (8th generation)',
124
- 'iPad11,7': 'iPad (8th generation)',
125
- 'iPad13,1': 'iPad Air (4th generation)',
126
- 'iPad13,2': 'iPad Air (4th generation)',
127
- 'iPad13,4': 'iPad Pro 11-inch (3rd generation)',
128
- 'iPad13,5': 'iPad Pro 11-inch (3rd generation)',
129
- 'iPad13,6': 'iPad Pro 11-inch (3rd generation)',
130
- 'iPad13,7': 'iPad Pro 11-inch (3rd generation)',
131
- 'iPad13,8': 'iPad Pro 12.9-inch (5th generation)',
132
- 'iPad13,9': 'iPad Pro 12.9-inch (5th generation)',
133
- 'iPad13,10': 'iPad Pro 12.9-inch (5th generation)',
134
- 'iPad13,11': 'iPad Pro 12.9-inch (5th generation)',
135
- 'AppleTV2,1': 'Apple TV',
136
- 'AppleTV3,1': 'Apple TV',
137
- 'AppleTV3,2': 'Apple TV',
138
- 'AppleTV5,3': 'Apple TV',
139
- 'AppleTV6,2': 'Apple TV 4K', // Apple TV 4K
140
- };
141
- //# sourceMappingURL=ModelNames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModelNames.js","sourceRoot":"","sources":["../src/ModelNames.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,cAAc,EAAE;QAClB,OAAO,cAAc,CAAC;KACvB;IAED,2CAA2C;IAC3C,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,YAAY,CAAC;KACrB;IAED,IAAI,OAAO,CAAC,UAAU,C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AmC;IAC9C,SAAS,EAAE,mCAAmC;IAC9C,SAAS,EAAE,mCAAmC;IAC9C,SAAS,EAAE,qCAAqC;IAChD,SAAS,EAAE,qCAAqC;IAChD,SAAS,EAAE,qCAAqC;IAChD,SAAS,EAAE,qCAAqC;IAChD,SAAS,EAAE,mCAAmC;IAC9C,UAAU,EAAE,mCAAmC;IAC/C,UAAU,EAAE,qCAAqC;IACjD,UAAU,EAAE,qCAAqC;IACjD,UAAU,EAAE,4BAA4B;IACxC,UAAU,EAAE,4BAA4B;IACxC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,uBAAuB;IACnC,UAAU,EAAE,uBAAuB;IACnC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,mCAAmC;IAC/C,UAAU,EAAE,mCAAmC;IAC/C,UAAU,EAAE,mCAAmC;IAC/C,UAAU,EAAE,mCAAmC;IAC/C,UAAU,EAAE,qCAAqC;IACjD,UAAU,EAAE,qCAAqC;IACjD,WAAW,EAAE,qCAAqC;IAClD,WAAW,EAAE,qCAAqC;IAClD,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,aAAa,EAAE,cAAc;CAC5C,CAAC","sourcesContent":["export function getIosModelName(modelId: string): string | null {\n const knownModelName = iosModelNames[modelId];\n if (knownModelName) {\n return knownModelName;\n }\n\n // Infer the main type of model from the ID\n if (modelId.startsWith('iPod')) {\n return 'iPod Touch';\n }\n\n if (modelId.startsWith('iPad')) {\n return 'iPad';\n }\n\n if (modelId.startsWith('iPhone')) {\n return 'iPhone';\n }\n\n if (modelId.startsWith('AppleTV')) {\n return 'Apple TV';\n }\n\n return null;\n}\n\nexport const iosModelNames = {\n 'iPod1,1': 'iPod Touch', // (Original)\n 'iPod2,1': 'iPod Touch', // (Second Generation)\n 'iPod3,1': 'iPod Touch', // (Third Generation)\n 'iPod4,1': 'iPod Touch', // (Fourth Generation)\n 'iPod5,1': 'iPod Touch', // (Fifth Generation)\n 'iPod7,1': 'iPod Touch', // (Sixth Generation)\n 'iPhone1,1': 'iPhone', // (Original)\n 'iPhone1,2': 'iPhone 3G', // (3G)\n 'iPhone2,1': 'iPhone 3GS', // (3GS)\n 'iPad1,1': 'iPad', // (Original)\n 'iPad2,1': 'iPad 2', //\n 'iPad2,2': 'iPad 2', //\n 'iPad2,3': 'iPad 2', //\n 'iPad2,4': 'iPad 2', //\n 'iPad3,1': 'iPad', // (3rd Generation)\n 'iPad3,2': 'iPad', // (3rd Generation)\n 'iPad3,3': 'iPad', // (3rd Generation)\n 'iPhone3,1': 'iPhone 4', // (GSM)\n 'iPhone3,2': 'iPhone 4', // iPhone 4\n 'iPhone3,3': 'iPhone 4', // (CDMA/Verizon/Sprint)\n 'iPhone4,1': 'iPhone 4S', //\n 'iPhone5,1': 'iPhone 5', // (model A1428, AT&T/Canada)\n 'iPhone5,2': 'iPhone 5', // (model A1429, everything else)\n 'iPad3,4': 'iPad', // (4th Generation)\n 'iPad3,5': 'iPad', // (4th Generation)\n 'iPad3,6': 'iPad', // (4th Generation)\n 'iPad2,5': 'iPad mini', // (Original)\n 'iPad2,6': 'iPad mini', // (Original)\n 'iPad2,7': 'iPad mini', // (Original)\n 'iPhone5,3': 'iPhone 5c', // (model A1456, A1532 | GSM)\n 'iPhone5,4': 'iPhone 5c', // (model A1507, A1516, A1526 (China), A1529 | Global)\n 'iPhone6,1': 'iPhone 5s', // (model A1433, A1533 | GSM)\n 'iPhone6,2': 'iPhone 5s', // (model A1457, A1518, A1528 (China), A1530 | Global)\n 'iPhone7,1': 'iPhone 6 Plus', //\n 'iPhone7,2': 'iPhone 6', //\n 'iPhone8,1': 'iPhone 6s', //\n 'iPhone8,2': 'iPhone 6s Plus', //\n 'iPhone8,4': 'iPhone SE', //\n 'iPhone9,1': 'iPhone 7', // (model A1660 | CDMA)\n 'iPhone9,3': 'iPhone 7', // (model A1778 | Global)\n 'iPhone9,2': 'iPhone 7 Plus', // (model A1661 | CDMA)\n 'iPhone9,4': 'iPhone 7 Plus', // (model A1784 | Global)\n 'iPhone10,3': 'iPhone X', // (model A1865, A1902)\n 'iPhone10,6': 'iPhone X', // (model A1901)\n 'iPhone10,1': 'iPhone 8', // (model A1863, A1906, A1907)\n 'iPhone10,4': 'iPhone 8', // (model A1905)\n 'iPhone10,2': 'iPhone 8 Plus', // (model A1864, A1898, A1899)\n 'iPhone10,5': 'iPhone 8 Plus', // (model A1897)\n 'iPhone11,2': 'iPhone XS', // (model A2097, A2098)\n 'iPhone11,4': 'iPhone XS Max', // (model A1921, A2103)\n 'iPhone11,6': 'iPhone XS Max', // (model A2104)\n 'iPhone11,8': 'iPhone XR', // (model A1882, A1719, A2105)\n 'iPhone12,1': 'iPhone 11',\n 'iPhone12,3': 'iPhone 11 Pro',\n 'iPhone12,5': 'iPhone 11 Pro Max',\n 'iPhone12,8': 'iPhone SE (2nd generation)',\n 'iPhone13,1': 'iPhone 12 mini',\n 'iPhone13,2': 'iPhone 12',\n 'iPhone13,3': 'iPhone 12 Pro',\n 'iPhone13,4': 'iPhone 12 Pro Max',\n 'iPad4,1': 'iPad Air', // 5th Generation iPad (iPad Air) - Wifi\n 'iPad4,2': 'iPad Air', // 5th Generation iPad (iPad Air) - Cellular\n 'iPad4,3': 'iPad Air', // 5th Generation iPad (iPad Air)\n 'iPad4,4': 'iPad mini (2nd generation)', // (2nd Generation iPad mini - Wifi)\n 'iPad4,5': 'iPad mini (2nd generation)', // (2nd Generation iPad mini - Cellular)\n 'iPad4,6': 'iPad mini (2nd generation)', // (2nd Generation iPad mini - China)\n 'iPad4,7': 'iPad mini 3', // (3rd Generation iPad mini)\n 'iPad4,8': 'iPad mini 3', // (3rd Generation iPad mini)\n 'iPad4,9': 'iPad mini 3', // (3rd Generation iPad mini - China)\n 'iPad5,1': 'iPad mini 4', // (4th Generation iPad mini)\n 'iPad5,2': 'iPad mini 4', // (4th Generation iPad mini)\n 'iPad5,3': 'iPad Air 2', // 6th Generation iPad (iPad Air 2)\n 'iPad5,4': 'iPad Air 2', // 6th Generation iPad (iPad Air 2)\n 'iPad6,3': 'iPad Pro 9.7-inch', // iPad Pro 9.7-inch\n 'iPad6,4': 'iPad Pro 9.7-inch', // iPad Pro 9.7-inch\n 'iPad6,7': 'iPad Pro 12.9-inch', // iPad Pro 12.9-inch\n 'iPad6,8': 'iPad Pro 12.9-inch', // iPad Pro 12.9-inch\n 'iPad7,1': 'iPad Pro 12.9-inch', // 2nd Generation iPad Pro 12.5-inch - Wifi\n 'iPad7,2': 'iPad Pro 12.9-inch', // 2nd Generation iPad Pro 12.5-inch - Cellular\n 'iPad7,3': 'iPad Pro 10.5-inch', // iPad Pro 10.5-inch - Wifi\n 'iPad7,4': 'iPad Pro 10.5-inch', // iPad Pro 10.5-inch - Cellular\n 'iPad7,5': 'iPad (6th generation)', // iPad (6th generation) - Wifi\n 'iPad7,6': 'iPad (6th generation)', // iPad (6th generation) - Cellular\n 'iPad7,11': 'iPad (7th generation)', // iPad (7th generation) - WiFi\n 'iPad7,12': 'iPad (7th generation)', // iPad (7th generation) - WiFi + cellular\n 'iPad8,1': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - Wifi\n 'iPad8,2': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - 1TB - Wifi\n 'iPad8,3': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - Wifi + cellular\n 'iPad8,4': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - 1TB - Wifi + cellular\n 'iPad8,5': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - Wifi\n 'iPad8,6': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - 1TB - Wifi\n 'iPad8,7': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - Wifi + cellular\n 'iPad8,8': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - 1TB - Wifi + cellular\n 'iPad8,9': 'iPad Pro 11-inch (4th generation)', // iPad Pro 11 inch (4th generation) - Wifi\n 'iPad8,10': 'iPad Pro 11-inch (4th generation)', // iPad Pro 11 inch (4th generation) - Wifi + cellular\n 'iPad8,11': 'iPad Pro 12.9-inch (4th generation)', // iPad Pro 12.9 inch (4th generation) - Wifi\n 'iPad8,12': 'iPad Pro 12.9-inch (4th generation)', // iPad Pro 12.9 inch (4th generation) - Wifi + cellular\n 'iPad11,1': 'iPad mini (5th generation)', // iPad mini (5th generation) - WiFi\n 'iPad11,2': 'iPad mini (5th generation)', // iPad mini (5th generation) - WiFi + cellular\n 'iPad11,3': 'iPad Air (3rd generation)', // iPad Air (3rd generation) - WiFi\n 'iPad11,4': 'iPad Air (3rd generation)', // iPad Air (3rd generation) - WiFi + cellular\n 'iPad11,6': 'iPad (8th generation)', // iPad (8th generation) - WiFi\n 'iPad11,7': 'iPad (8th generation)', // iPad (8th generation) - WiFi + cellular\n 'iPad13,1': 'iPad Air (4th generation)', // iPad Air (4th generation) - WiFi\n 'iPad13,2': 'iPad Air (4th generation)', // iPad Air (4th generation) - WiFi + cellular\n 'iPad13,4': 'iPad Pro 11-inch (3rd generation)', // WiFi\n 'iPad13,5': 'iPad Pro 11-inch (3rd generation)', // WiFi\n 'iPad13,6': 'iPad Pro 11-inch (3rd generation)', // WiFi + cellular\n 'iPad13,7': 'iPad Pro 11-inch (3rd generation)', // WiFi + cellular\n 'iPad13,8': 'iPad Pro 12.9-inch (5th generation)', // WiFi\n 'iPad13,9': 'iPad Pro 12.9-inch (5th generation)', // WiFi\n 'iPad13,10': 'iPad Pro 12.9-inch (5th generation)', // WiFi + cellular\n 'iPad13,11': 'iPad Pro 12.9-inch (5th generation)', // WiFi + cellular\n 'AppleTV2,1': 'Apple TV', // Apple TV (2nd Generation)\n 'AppleTV3,1': 'Apple TV', // Apple TV (3rd Generation)\n 'AppleTV3,2': 'Apple TV', // Apple TV (3rd Generation - Rev A)\n 'AppleTV5,3': 'Apple TV', // Apple TV (4th Generation)\n 'AppleTV6,2': 'Apple TV 4K', // Apple TV 4K\n};\n"]}
package/src/ModelNames.ts DELETED
@@ -1,146 +0,0 @@
1
- export function getIosModelName(modelId: string): string | null {
2
- const knownModelName = iosModelNames[modelId];
3
- if (knownModelName) {
4
- return knownModelName;
5
- }
6
-
7
- // Infer the main type of model from the ID
8
- if (modelId.startsWith('iPod')) {
9
- return 'iPod Touch';
10
- }
11
-
12
- if (modelId.startsWith('iPad')) {
13
- return 'iPad';
14
- }
15
-
16
- if (modelId.startsWith('iPhone')) {
17
- return 'iPhone';
18
- }
19
-
20
- if (modelId.startsWith('AppleTV')) {
21
- return 'Apple TV';
22
- }
23
-
24
- return null;
25
- }
26
-
27
- export const iosModelNames = {
28
- 'iPod1,1': 'iPod Touch', // (Original)
29
- 'iPod2,1': 'iPod Touch', // (Second Generation)
30
- 'iPod3,1': 'iPod Touch', // (Third Generation)
31
- 'iPod4,1': 'iPod Touch', // (Fourth Generation)
32
- 'iPod5,1': 'iPod Touch', // (Fifth Generation)
33
- 'iPod7,1': 'iPod Touch', // (Sixth Generation)
34
- 'iPhone1,1': 'iPhone', // (Original)
35
- 'iPhone1,2': 'iPhone 3G', // (3G)
36
- 'iPhone2,1': 'iPhone 3GS', // (3GS)
37
- 'iPad1,1': 'iPad', // (Original)
38
- 'iPad2,1': 'iPad 2', //
39
- 'iPad2,2': 'iPad 2', //
40
- 'iPad2,3': 'iPad 2', //
41
- 'iPad2,4': 'iPad 2', //
42
- 'iPad3,1': 'iPad', // (3rd Generation)
43
- 'iPad3,2': 'iPad', // (3rd Generation)
44
- 'iPad3,3': 'iPad', // (3rd Generation)
45
- 'iPhone3,1': 'iPhone 4', // (GSM)
46
- 'iPhone3,2': 'iPhone 4', // iPhone 4
47
- 'iPhone3,3': 'iPhone 4', // (CDMA/Verizon/Sprint)
48
- 'iPhone4,1': 'iPhone 4S', //
49
- 'iPhone5,1': 'iPhone 5', // (model A1428, AT&T/Canada)
50
- 'iPhone5,2': 'iPhone 5', // (model A1429, everything else)
51
- 'iPad3,4': 'iPad', // (4th Generation)
52
- 'iPad3,5': 'iPad', // (4th Generation)
53
- 'iPad3,6': 'iPad', // (4th Generation)
54
- 'iPad2,5': 'iPad mini', // (Original)
55
- 'iPad2,6': 'iPad mini', // (Original)
56
- 'iPad2,7': 'iPad mini', // (Original)
57
- 'iPhone5,3': 'iPhone 5c', // (model A1456, A1532 | GSM)
58
- 'iPhone5,4': 'iPhone 5c', // (model A1507, A1516, A1526 (China), A1529 | Global)
59
- 'iPhone6,1': 'iPhone 5s', // (model A1433, A1533 | GSM)
60
- 'iPhone6,2': 'iPhone 5s', // (model A1457, A1518, A1528 (China), A1530 | Global)
61
- 'iPhone7,1': 'iPhone 6 Plus', //
62
- 'iPhone7,2': 'iPhone 6', //
63
- 'iPhone8,1': 'iPhone 6s', //
64
- 'iPhone8,2': 'iPhone 6s Plus', //
65
- 'iPhone8,4': 'iPhone SE', //
66
- 'iPhone9,1': 'iPhone 7', // (model A1660 | CDMA)
67
- 'iPhone9,3': 'iPhone 7', // (model A1778 | Global)
68
- 'iPhone9,2': 'iPhone 7 Plus', // (model A1661 | CDMA)
69
- 'iPhone9,4': 'iPhone 7 Plus', // (model A1784 | Global)
70
- 'iPhone10,3': 'iPhone X', // (model A1865, A1902)
71
- 'iPhone10,6': 'iPhone X', // (model A1901)
72
- 'iPhone10,1': 'iPhone 8', // (model A1863, A1906, A1907)
73
- 'iPhone10,4': 'iPhone 8', // (model A1905)
74
- 'iPhone10,2': 'iPhone 8 Plus', // (model A1864, A1898, A1899)
75
- 'iPhone10,5': 'iPhone 8 Plus', // (model A1897)
76
- 'iPhone11,2': 'iPhone XS', // (model A2097, A2098)
77
- 'iPhone11,4': 'iPhone XS Max', // (model A1921, A2103)
78
- 'iPhone11,6': 'iPhone XS Max', // (model A2104)
79
- 'iPhone11,8': 'iPhone XR', // (model A1882, A1719, A2105)
80
- 'iPhone12,1': 'iPhone 11',
81
- 'iPhone12,3': 'iPhone 11 Pro',
82
- 'iPhone12,5': 'iPhone 11 Pro Max',
83
- 'iPhone12,8': 'iPhone SE (2nd generation)',
84
- 'iPhone13,1': 'iPhone 12 mini',
85
- 'iPhone13,2': 'iPhone 12',
86
- 'iPhone13,3': 'iPhone 12 Pro',
87
- 'iPhone13,4': 'iPhone 12 Pro Max',
88
- 'iPad4,1': 'iPad Air', // 5th Generation iPad (iPad Air) - Wifi
89
- 'iPad4,2': 'iPad Air', // 5th Generation iPad (iPad Air) - Cellular
90
- 'iPad4,3': 'iPad Air', // 5th Generation iPad (iPad Air)
91
- 'iPad4,4': 'iPad mini (2nd generation)', // (2nd Generation iPad mini - Wifi)
92
- 'iPad4,5': 'iPad mini (2nd generation)', // (2nd Generation iPad mini - Cellular)
93
- 'iPad4,6': 'iPad mini (2nd generation)', // (2nd Generation iPad mini - China)
94
- 'iPad4,7': 'iPad mini 3', // (3rd Generation iPad mini)
95
- 'iPad4,8': 'iPad mini 3', // (3rd Generation iPad mini)
96
- 'iPad4,9': 'iPad mini 3', // (3rd Generation iPad mini - China)
97
- 'iPad5,1': 'iPad mini 4', // (4th Generation iPad mini)
98
- 'iPad5,2': 'iPad mini 4', // (4th Generation iPad mini)
99
- 'iPad5,3': 'iPad Air 2', // 6th Generation iPad (iPad Air 2)
100
- 'iPad5,4': 'iPad Air 2', // 6th Generation iPad (iPad Air 2)
101
- 'iPad6,3': 'iPad Pro 9.7-inch', // iPad Pro 9.7-inch
102
- 'iPad6,4': 'iPad Pro 9.7-inch', // iPad Pro 9.7-inch
103
- 'iPad6,7': 'iPad Pro 12.9-inch', // iPad Pro 12.9-inch
104
- 'iPad6,8': 'iPad Pro 12.9-inch', // iPad Pro 12.9-inch
105
- 'iPad7,1': 'iPad Pro 12.9-inch', // 2nd Generation iPad Pro 12.5-inch - Wifi
106
- 'iPad7,2': 'iPad Pro 12.9-inch', // 2nd Generation iPad Pro 12.5-inch - Cellular
107
- 'iPad7,3': 'iPad Pro 10.5-inch', // iPad Pro 10.5-inch - Wifi
108
- 'iPad7,4': 'iPad Pro 10.5-inch', // iPad Pro 10.5-inch - Cellular
109
- 'iPad7,5': 'iPad (6th generation)', // iPad (6th generation) - Wifi
110
- 'iPad7,6': 'iPad (6th generation)', // iPad (6th generation) - Cellular
111
- 'iPad7,11': 'iPad (7th generation)', // iPad (7th generation) - WiFi
112
- 'iPad7,12': 'iPad (7th generation)', // iPad (7th generation) - WiFi + cellular
113
- 'iPad8,1': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - Wifi
114
- 'iPad8,2': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - 1TB - Wifi
115
- 'iPad8,3': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - Wifi + cellular
116
- 'iPad8,4': 'iPad Pro 11-inch (3rd generation)', // iPad Pro 11 inch (3rd generation) - 1TB - Wifi + cellular
117
- 'iPad8,5': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - Wifi
118
- 'iPad8,6': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - 1TB - Wifi
119
- 'iPad8,7': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - Wifi + cellular
120
- 'iPad8,8': 'iPad Pro 12.9-inch (3rd generation)', // iPad Pro 12.9 inch (3rd generation) - 1TB - Wifi + cellular
121
- 'iPad8,9': 'iPad Pro 11-inch (4th generation)', // iPad Pro 11 inch (4th generation) - Wifi
122
- 'iPad8,10': 'iPad Pro 11-inch (4th generation)', // iPad Pro 11 inch (4th generation) - Wifi + cellular
123
- 'iPad8,11': 'iPad Pro 12.9-inch (4th generation)', // iPad Pro 12.9 inch (4th generation) - Wifi
124
- 'iPad8,12': 'iPad Pro 12.9-inch (4th generation)', // iPad Pro 12.9 inch (4th generation) - Wifi + cellular
125
- 'iPad11,1': 'iPad mini (5th generation)', // iPad mini (5th generation) - WiFi
126
- 'iPad11,2': 'iPad mini (5th generation)', // iPad mini (5th generation) - WiFi + cellular
127
- 'iPad11,3': 'iPad Air (3rd generation)', // iPad Air (3rd generation) - WiFi
128
- 'iPad11,4': 'iPad Air (3rd generation)', // iPad Air (3rd generation) - WiFi + cellular
129
- 'iPad11,6': 'iPad (8th generation)', // iPad (8th generation) - WiFi
130
- 'iPad11,7': 'iPad (8th generation)', // iPad (8th generation) - WiFi + cellular
131
- 'iPad13,1': 'iPad Air (4th generation)', // iPad Air (4th generation) - WiFi
132
- 'iPad13,2': 'iPad Air (4th generation)', // iPad Air (4th generation) - WiFi + cellular
133
- 'iPad13,4': 'iPad Pro 11-inch (3rd generation)', // WiFi
134
- 'iPad13,5': 'iPad Pro 11-inch (3rd generation)', // WiFi
135
- 'iPad13,6': 'iPad Pro 11-inch (3rd generation)', // WiFi + cellular
136
- 'iPad13,7': 'iPad Pro 11-inch (3rd generation)', // WiFi + cellular
137
- 'iPad13,8': 'iPad Pro 12.9-inch (5th generation)', // WiFi
138
- 'iPad13,9': 'iPad Pro 12.9-inch (5th generation)', // WiFi
139
- 'iPad13,10': 'iPad Pro 12.9-inch (5th generation)', // WiFi + cellular
140
- 'iPad13,11': 'iPad Pro 12.9-inch (5th generation)', // WiFi + cellular
141
- 'AppleTV2,1': 'Apple TV', // Apple TV (2nd Generation)
142
- 'AppleTV3,1': 'Apple TV', // Apple TV (3rd Generation)
143
- 'AppleTV3,2': 'Apple TV', // Apple TV (3rd Generation - Rev A)
144
- 'AppleTV5,3': 'Apple TV', // Apple TV (4th Generation)
145
- 'AppleTV6,2': 'Apple TV 4K', // Apple TV 4K
146
- };