From 3f6e4d3214f4d020298018303a02fb5e51abc30b Mon Sep 17 00:00:00 2001 From: Behzad Richey Date: Thu, 20 Jun 2013 15:18:18 -0700 Subject: [PATCH] Added support for iPad mini and iPad 4th Generation. --- .../UIDevice-Hardware.h | 4 +++ .../UIDevice-Hardware.m | 31 +++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.h b/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.h index 261229b..82d67a1 100644 --- a/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.h +++ b/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.h @@ -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" @@ -65,6 +67,8 @@ typedef enum { UIDevice3GiPad, UIDevice4GiPad, + UIDevice1GiPadMini, + UIDeviceAppleTV2, UIDeviceAppleTV3, UIDeviceAppleTV4, diff --git a/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.m b/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.m index 7e60ded..793716a 100644 --- a/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.m +++ b/C01 - Device/02 - UIDevice-Hardware/UIDevice-Hardware.m @@ -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, ?? @@ -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; @@ -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;