Skip to content

Added support for iPad mini and iPad 4th Generation. #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define IPAD_4G_NAMESTRING @"iPad 4G"
#define IPAD_UNKNOWN_NAMESTRING @"Unknown iPad"

#define IPAD_MINI_1G_NAMESTRING @"iPad mini 1G"

#define APPLETV_2G_NAMESTRING @"Apple TV 2G"
#define APPLETV_3G_NAMESTRING @"Apple TV 3G"
#define APPLETV_4G_NAMESTRING @"Apple TV 4G"
Expand Down Expand Up @@ -65,6 +67,8 @@ typedef enum {
UIDevice3GiPad,
UIDevice4GiPad,

UIDevice1GiPadMini,

UIDeviceAppleTV2,
UIDeviceAppleTV3,
UIDeviceAppleTV4,
Expand Down
31 changes: 25 additions & 6 deletions C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ @implementation UIDevice (Hardware)
iPad2,3 -> iPad 2G, CDMA 3G, K95
iPad2,4 -> iPad 2G, (Smaller chip set) K93a

iPad2,5 -> iPad mini, WiFi
iPad2,6 -> iPad mini, GSM
iPad2,7 -> iPad mini, CDMA

iPad3,1 -> iPad 3G, WiFi J1
iPad3,2 -> iPad 3G, CDMA J2A, ?J2
iPad3,3 -> iPad 3G, GSM J33

iPad4,1 -> (iPad 4G, WiFi)
iPad4,2 -> (iPad 4G, CDMA)
iPad4,3 -> (iPad 4G, GSM)
iPad3,4 -> (iPad 4G, WiFi)
iPad3,5 -> (iPad 4G, GSM)
iPad3,6 -> (iPad 4G, CDMA)

AppleTV2,1 -> AppleTV 2, K66
AppleTV3,1 -> AppleTV 3, ??
Expand Down Expand Up @@ -180,9 +184,22 @@ - (NSUInteger) platformType

// iPad
if ([platform hasPrefix:@"iPad1"]) return UIDevice1GiPad;
if ([platform hasPrefix:@"iPad2"]) return UIDevice2GiPad;
if ([platform hasPrefix:@"iPad3"]) return UIDevice3GiPad;
if ([platform hasPrefix:@"iPad4"]) return UIDevice4GiPad;
if ([platform hasPrefix:@"iPad2"]) {
NSUInteger lastCharacterIndex = platform.length - 1;
if ([platform characterAtIndex:lastCharacterIndex] < '5') {
return UIDevice2GiPad;
} else {
return UIDevice1GiPadMini;
}
}
if ([platform hasPrefix:@"iPad3"]) {
NSUInteger lastCharacterIndex = platform.length - 1;
if ([platform characterAtIndex:lastCharacterIndex] < '4') {
return UIDevice3GiPad;
} else {
return UIDevice4GiPad;
}
}

// Apple TV
if ([platform hasPrefix:@"AppleTV2"]) return UIDeviceAppleTV2;
Expand Down Expand Up @@ -227,6 +244,8 @@ - (NSString *) platformString
case UIDevice4GiPad : return IPAD_4G_NAMESTRING;
case UIDeviceUnknowniPad : return IPAD_UNKNOWN_NAMESTRING;

case UIDevice1GiPadMini : return IPAD_MINI_1G_NAMESTRING;

case UIDeviceAppleTV2 : return APPLETV_2G_NAMESTRING;
case UIDeviceAppleTV3 : return APPLETV_3G_NAMESTRING;
case UIDeviceAppleTV4 : return APPLETV_4G_NAMESTRING;
Expand Down