1111
1212#include " alt_ldid.hpp"
1313
14+ ALTDeviceType ALTDeviceTypeFromUIDeviceFamily (NSInteger deviceFamily)
15+ {
16+ switch (deviceFamily)
17+ {
18+ case 1 : return ALTDeviceTypeiPhone;
19+ case 2 : return ALTDeviceTypeiPad;
20+ case 3 : return ALTDeviceTypeAppleTV;
21+ default : return ALTDeviceTypeNone;
22+ }
23+ }
24+
1425@interface ALTApplication ()
1526
1627@property (nonatomic , copy , nullable , readonly ) NSString *iconName;
@@ -64,6 +75,27 @@ - (instancetype)initWithFileURL:(NSURL *)fileURL
6475 minimumVersion.minorVersion = minorVersion;
6576 minimumVersion.patchVersion = patchVersion;
6677
78+ NSArray <NSNumber *> *deviceFamilies = infoDictionary[@" UIDeviceFamily" ];
79+ ALTDeviceType supportedDeviceTypes = ALTDeviceTypeNone;
80+
81+ if ([deviceFamilies isKindOfClass: [NSNumber class ]])
82+ {
83+ NSInteger rawDeviceFamily = [(NSNumber *)deviceFamilies integerValue ];
84+ supportedDeviceTypes = ALTDeviceTypeFromUIDeviceFamily (rawDeviceFamily);
85+ }
86+ else if ([deviceFamilies isKindOfClass: [NSArray class ]] && deviceFamilies.count > 0 )
87+ {
88+ for (NSNumber *deviceFamily in deviceFamilies)
89+ {
90+ NSInteger rawDeviceFamily = [deviceFamily integerValue ];
91+ supportedDeviceTypes |= ALTDeviceTypeFromUIDeviceFamily (rawDeviceFamily);
92+ }
93+ }
94+ else
95+ {
96+ supportedDeviceTypes = ALTDeviceTypeiPhone;
97+ }
98+
6799 NSDictionary *icons = infoDictionary[@" CFBundleIcons" ];
68100 NSDictionary *primaryIcon = icons[@" CFBundlePrimaryIcon" ];
69101
@@ -84,6 +116,7 @@ - (instancetype)initWithFileURL:(NSURL *)fileURL
84116 _bundleIdentifier = [bundleIdentifier copy ];
85117 _version = [version copy ];
86118 _minimumiOSVersion = minimumVersion;
119+ _supportedDeviceTypes = supportedDeviceTypes;
87120 _iconName = [iconName copy ];
88121 }
89122
0 commit comments