-
Notifications
You must be signed in to change notification settings - Fork 2
/
OrchardtvOSDevice.m
67 lines (54 loc) · 1.69 KB
/
OrchardtvOSDevice.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// This file was automatically generated and should not be edited.
//
// OrchardtvOSDevice.m
// Orchard
//
// Created by Jeff Kelley on 3/21/19.
//
#import "OrchardtvOSDevice.h"
#if TARGET_OS_TV
#import "NSString+OrchardUtilities.h"
#import "OrchardDeviceIdentification.h"
OrchardtvOSDevice OrchardtvOSDeviceFromNSString(NSString *string) {
if ([string orchard_isEqualToOneOfStrings:@[@"arm64", @"i386", @"x86_64"]]) {
return OrchardtvOSDeviceSimulator;
}
else if ([string isEqualToString:@"AppleTV5,3"]) {
return OrchardtvOSDeviceAppleTVHD;
}
else if ([string isEqualToString:@"AppleTV6,2"]) {
return OrchardtvOSDeviceAppleTV4K;
}
else if ([string isEqualToString:@"AppleTV11,1"]) {
if (@available(tvOS 14.5, *)) {
return OrchardtvOSDeviceAppleTV4K2;
}
}
else if ([string isEqualToString:@"AppleTV14,1"]) {
if (@available(tvOS 16.1, *)) {
return OrchardtvOSDeviceAppleTV4K3;
}
}
return OrchardtvOSDeviceUnknown;
}
NSString *OrchardMarketingNameFortvOSDevice(OrchardtvOSDevice device)
{
switch (device) {
case OrchardtvOSDeviceSimulator: return nil;
case OrchardtvOSDeviceAppleTVHD: return @"Apple TV HD";
case OrchardtvOSDeviceAppleTV4K: return @"Apple TV 4K";
case OrchardtvOSDeviceAppleTV4K2: return @"Apple TV 4K (2nd Generation)";
case OrchardtvOSDeviceAppleTV4K3: return @"Apple TV 4K (3rd Generation)";
default: break;
}
return nil;
#pragma clang diagnostic pop
}
@implementation UIDevice (Orchard)
- (OrchardtvOSDevice)orchardiOSDevice
{
return OrchardtvOSDeviceFromNSString(OrchardDeviceIdentifier());
}
@end
#endif