expo-device 5.0.0 → 5.2.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 +13 -0
- package/README.md +1 -1
- package/android/build.gradle +4 -4
- package/android/src/main/java/expo/modules/device/DeviceModule.kt +84 -108
- package/build/Device.d.ts +250 -0
- package/build/Device.d.ts.map +1 -1
- package/build/Device.js +250 -0
- package/build/Device.js.map +1 -1
- package/build/Device.types.d.ts +18 -0
- package/build/Device.types.d.ts.map +1 -1
- package/build/Device.types.js +18 -0
- package/build/Device.types.js.map +1 -1
- package/build/ExpoDevice.d.ts +1 -1
- package/build/ExpoDevice.d.ts.map +1 -1
- package/build/ExpoDevice.js +2 -2
- package/build/ExpoDevice.js.map +1 -1
- package/expo-module.config.json +10 -0
- package/ios/DeviceModule.swift +95 -0
- package/ios/{EXDevice.podspec → ExpoDevice.podspec} +10 -3
- package/ios/UIDevice.swift +261 -0
- package/package.json +3 -3
- package/src/Device.ts +266 -0
- package/src/Device.types.ts +18 -0
- package/src/ExpoDevice.ts +2 -2
- package/android/src/main/java/expo/modules/device/DevicePackage.kt +0 -11
- package/ios/EXDevice/EXDevice.h +0 -21
- package/ios/EXDevice/EXDevice.m +0 -374
- package/unimodule.json +0 -4
package/ios/EXDevice/EXDevice.h
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <ExpoModulesCore/EXExportedModule.h>
|
|
4
|
-
#import <Foundation/Foundation.h>
|
|
5
|
-
|
|
6
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
7
|
-
|
|
8
|
-
// Keep this enum in sync with JavaScript
|
|
9
|
-
typedef NS_ENUM(NSInteger, EXDeviceType) {
|
|
10
|
-
EXDeviceTypeUnknown = 0,
|
|
11
|
-
EXDeviceTypePhone,
|
|
12
|
-
EXDeviceTypeTablet,
|
|
13
|
-
EXDeviceTypeDesktop,
|
|
14
|
-
EXDeviceTypeTV,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
@interface EXDevice : EXExportedModule
|
|
18
|
-
|
|
19
|
-
@end
|
|
20
|
-
|
|
21
|
-
NS_ASSUME_NONNULL_END
|
package/ios/EXDevice/EXDevice.m
DELETED
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <EXDevice/EXDevice.h>
|
|
4
|
-
|
|
5
|
-
#import <CoreLocation/CoreLocation.h>
|
|
6
|
-
#import <UIKit/UIKit.h>
|
|
7
|
-
#import <mach-o/arch.h>
|
|
8
|
-
#import <sys/utsname.h>
|
|
9
|
-
|
|
10
|
-
#import <ExpoModulesCore/EXUtilitiesInterface.h>
|
|
11
|
-
#import <ExpoModulesCore/EXUtilities.h>
|
|
12
|
-
|
|
13
|
-
#if !(TARGET_OS_TV)
|
|
14
|
-
@import Darwin.sys.sysctl;
|
|
15
|
-
#endif
|
|
16
|
-
|
|
17
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
18
|
-
|
|
19
|
-
@interface EXDevice()
|
|
20
|
-
|
|
21
|
-
@end
|
|
22
|
-
|
|
23
|
-
@implementation EXDevice
|
|
24
|
-
|
|
25
|
-
EX_EXPORT_MODULE(ExpoDevice);
|
|
26
|
-
|
|
27
|
-
- (dispatch_queue_t)methodQueue
|
|
28
|
-
{
|
|
29
|
-
return dispatch_get_main_queue();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
- (NSDictionary *)constantsToExport
|
|
33
|
-
{
|
|
34
|
-
UIDevice *currentDevice = UIDevice.currentDevice;
|
|
35
|
-
NSString * _Nullable osBuildId = [[self class] osBuildId];
|
|
36
|
-
|
|
37
|
-
return @{
|
|
38
|
-
@"isDevice": @([[self class] isDevice]),
|
|
39
|
-
@"brand": @"Apple",
|
|
40
|
-
@"manufacturer": @"Apple",
|
|
41
|
-
@"modelId": EXNullIfNil([[self class] modelId]),
|
|
42
|
-
@"modelName": [[self class] modelName],
|
|
43
|
-
@"deviceYearClass": [[self class] deviceYear],
|
|
44
|
-
@"totalMemory": @(NSProcessInfo.processInfo.physicalMemory),
|
|
45
|
-
@"supportedCpuArchitectures": EXNullIfNil([[self class] cpuArchitectures]),
|
|
46
|
-
@"osName": currentDevice.systemName,
|
|
47
|
-
@"osVersion": currentDevice.systemVersion,
|
|
48
|
-
@"osBuildId": osBuildId,
|
|
49
|
-
@"osInternalBuildId": osBuildId,
|
|
50
|
-
@"deviceName": currentDevice.name,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
EX_EXPORT_METHOD_AS(getDeviceTypeAsync,
|
|
55
|
-
getDeviceTypeAsyncWithResolver:(EXPromiseResolveBlock)resolve
|
|
56
|
-
rejecter:(EXPromiseRejectBlock)reject)
|
|
57
|
-
{
|
|
58
|
-
resolve(@([[self class] deviceType]));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
EX_EXPORT_METHOD_AS(getUptimeAsync,
|
|
62
|
-
getUptimeAsyncWithResolver:(EXPromiseResolveBlock)resolve
|
|
63
|
-
rejecter:(EXPromiseRejectBlock)reject)
|
|
64
|
-
{
|
|
65
|
-
double uptimeMs = NSProcessInfo.processInfo.systemUptime * 1000;
|
|
66
|
-
resolve(@(uptimeMs));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
EX_EXPORT_METHOD_AS(isRootedExperimentalAsync,
|
|
70
|
-
isRootedExperimentalAsyncWithResolver:(EXPromiseResolveBlock)resolve
|
|
71
|
-
rejecter:(EXPromiseRejectBlock)reject)
|
|
72
|
-
{
|
|
73
|
-
resolve(@([[self class] isRooted]));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
+ (BOOL)isRooted
|
|
77
|
-
{
|
|
78
|
-
#if !(TARGET_IPHONE_SIMULATOR)
|
|
79
|
-
NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
80
|
-
if ([fileManager fileExistsAtPath:@"/Applications/Cydia.app"] ||
|
|
81
|
-
[fileManager fileExistsAtPath:@"/Library/MobileSubstrate/MobileSubstrate.dylib"] ||
|
|
82
|
-
[fileManager fileExistsAtPath:@"/bin/bash"] ||
|
|
83
|
-
[fileManager fileExistsAtPath:@"/usr/sbin/sshd"] ||
|
|
84
|
-
[fileManager fileExistsAtPath:@"/etc/apt"] ||
|
|
85
|
-
[fileManager fileExistsAtPath:@"/usr/bin/ssh"] ||
|
|
86
|
-
[fileManager fileExistsAtPath:@"/private/var/lib/apt/"]) {
|
|
87
|
-
return YES;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
FILE *file = fopen("/Applications/Cydia.app", "r");
|
|
91
|
-
if (file) {
|
|
92
|
-
fclose(file);
|
|
93
|
-
return YES;
|
|
94
|
-
}
|
|
95
|
-
file = fopen("/Library/MobileSubstrate/MobileSubstrate.dylib", "r");
|
|
96
|
-
if (file) {
|
|
97
|
-
fclose(file);
|
|
98
|
-
return YES;
|
|
99
|
-
}
|
|
100
|
-
file = fopen("/bin/bash", "r");
|
|
101
|
-
if (file) {
|
|
102
|
-
fclose(file);
|
|
103
|
-
return YES;
|
|
104
|
-
}
|
|
105
|
-
file = fopen("/usr/sbin/sshd", "r");
|
|
106
|
-
if (file) {
|
|
107
|
-
fclose(file);
|
|
108
|
-
return YES;
|
|
109
|
-
}
|
|
110
|
-
file = fopen("/etc/apt", "r");
|
|
111
|
-
if (file) {
|
|
112
|
-
fclose(file);
|
|
113
|
-
return YES;
|
|
114
|
-
}
|
|
115
|
-
file = fopen("/usr/bin/ssh", "r");
|
|
116
|
-
if (file) {
|
|
117
|
-
fclose(file);
|
|
118
|
-
return YES;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Check if the app can access outside of its sandbox
|
|
122
|
-
NSError *error = nil;
|
|
123
|
-
NSString *string = @".";
|
|
124
|
-
[string writeToFile:@"/private/jailbreak.txt" atomically:YES encoding:NSUTF8StringEncoding error:&error];
|
|
125
|
-
if (!error) {
|
|
126
|
-
[fileManager removeItemAtPath:@"/private/jailbreak.txt" error:nil];
|
|
127
|
-
return YES;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Check if the app can open a Cydia's URL scheme
|
|
131
|
-
if ([UIApplication.sharedApplication canOpenURL:[NSURL URLWithString:@"cydia://package/com.example.package"]]) {
|
|
132
|
-
return YES;
|
|
133
|
-
}
|
|
134
|
-
#endif
|
|
135
|
-
return NO;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
+ (NSString *)modelId
|
|
139
|
-
{
|
|
140
|
-
struct utsname systemInfo;
|
|
141
|
-
|
|
142
|
-
uname(&systemInfo);
|
|
143
|
-
|
|
144
|
-
NSString *modelId = [NSString stringWithCString:systemInfo.machine
|
|
145
|
-
encoding:NSUTF8StringEncoding];
|
|
146
|
-
|
|
147
|
-
if ([modelId isEqualToString:@"i386"] || [modelId isEqualToString:@"x86_64"] || [modelId isEqualToString:@"arm64"]) {
|
|
148
|
-
modelId = [NSString stringWithFormat:@"%s", getenv("SIMULATOR_MODEL_IDENTIFIER")];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return modelId;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
+ (EXDeviceType)deviceType
|
|
155
|
-
{
|
|
156
|
-
switch (UIDevice.currentDevice.userInterfaceIdiom) {
|
|
157
|
-
case UIUserInterfaceIdiomPhone:
|
|
158
|
-
return EXDeviceTypePhone;
|
|
159
|
-
case UIUserInterfaceIdiomPad:
|
|
160
|
-
return EXDeviceTypeTablet;
|
|
161
|
-
case UIUserInterfaceIdiomTV:
|
|
162
|
-
return EXDeviceTypeTV;
|
|
163
|
-
default:
|
|
164
|
-
// NOTE: in the future for macOS, return Desktop
|
|
165
|
-
return EXDeviceTypeUnknown;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
+ (nullable NSArray<NSString *> *)cpuArchitectures
|
|
170
|
-
{
|
|
171
|
-
// NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL if none is known
|
|
172
|
-
// https://stackoverflow.com/questions/19859388/how-can-i-get-the-ios-device-cpu-architecture-in-runtime
|
|
173
|
-
const NXArchInfo *info = NXGetLocalArchInfo();
|
|
174
|
-
if (!info) {
|
|
175
|
-
return nil;
|
|
176
|
-
}
|
|
177
|
-
NSString *cpuType = [NSString stringWithUTF8String:info->description];
|
|
178
|
-
return @[cpuType];
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
+ (BOOL)isDevice
|
|
182
|
-
{
|
|
183
|
-
#if TARGET_IPHONE_SIMULATOR
|
|
184
|
-
return NO;
|
|
185
|
-
#else
|
|
186
|
-
return YES;
|
|
187
|
-
#endif
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
+ (nullable NSString *)osBuildId
|
|
191
|
-
{
|
|
192
|
-
#if TARGET_OS_TV
|
|
193
|
-
return nil;
|
|
194
|
-
#else
|
|
195
|
-
size_t bufferSize = 64;
|
|
196
|
-
NSMutableData *buffer = [[NSMutableData alloc] initWithLength:bufferSize];
|
|
197
|
-
int status = sysctlbyname("kern.osversion", buffer.mutableBytes, &bufferSize, NULL, 0);
|
|
198
|
-
if (status != 0) {
|
|
199
|
-
return nil;
|
|
200
|
-
}
|
|
201
|
-
return [[NSString alloc] initWithCString:buffer.mutableBytes encoding:NSUTF8StringEncoding];
|
|
202
|
-
#endif
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
+ (NSDictionary *)getDeviceMap
|
|
206
|
-
{
|
|
207
|
-
return @{
|
|
208
|
-
// iPod
|
|
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 }
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
+ (nullable NSString *)modelName
|
|
319
|
-
{
|
|
320
|
-
NSString *platform = [self modelId];
|
|
321
|
-
|
|
322
|
-
if (platform == nil) {
|
|
323
|
-
return [NSNull null];
|
|
324
|
-
}
|
|
325
|
-
|
|
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];
|
|
355
|
-
|
|
356
|
-
if (platform != nil) {
|
|
357
|
-
NSDictionary *mapping = [self getDeviceMap];
|
|
358
|
-
|
|
359
|
-
if (mapping[platform]) {
|
|
360
|
-
return mapping[platform][@"year"];
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// Simulator or unknown - assume this is the newest device
|
|
365
|
-
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
|
366
|
-
[formatter setDateFormat:@"yyyy"];
|
|
367
|
-
NSString *yearString = [formatter stringFromDate:[NSDate date]];
|
|
368
|
-
|
|
369
|
-
return @([yearString intValue]);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
@end
|
|
373
|
-
|
|
374
|
-
NS_ASSUME_NONNULL_END
|
package/unimodule.json
DELETED