2020#import " NSString+QMUI.h"
2121#import " UIInterface+QMUI.h"
2222#import " NSObject+QMUI.h"
23+ #import " NSArray+QMUI.h"
2324#import < AVFoundation/AVFoundation.h>
2425#import < math.h>
2526#import < sys/utsname.h>
@@ -317,6 +318,10 @@ + (NSString *)deviceName {
317318 @" iPhone15,5" : @" iPhone 15 Plus" ,
318319 @" iPhone16,1" : @" iPhone 15 Pro" ,
319320 @" iPhone16,2" : @" iPhone 15 Pro Max" ,
321+ @" iPhone17,1" : @" iPhone 16 Pro" ,
322+ @" iPhone17,2" : @" iPhone 16 Pro Max" ,
323+ @" iPhone17,3" : @" iPhone 16" ,
324+ @" iPhone17,4" : @" iPhone 16 Plus" ,
320325
321326 @" iPad1,1" : @" iPad 1" ,
322327 @" iPad2,1" : @" iPad 2 (WiFi)" ,
@@ -389,6 +394,18 @@ + (NSString *)deviceName {
389394 @" iPad13,11" : @" iPad Pro (12.9 inch, 5th generation)" ,
390395 @" iPad14,1" : @" iPad mini (6th generation)" ,
391396 @" iPad14,2" : @" iPad mini (6th generation)" ,
397+ @" iPad14,3" : @" iPad Pro 11 inch 4th Gen" ,
398+ @" iPad14,4" : @" iPad Pro 11 inch 4th Gen" ,
399+ @" iPad14,5" : @" iPad Pro 12.9 inch 6th Gen" ,
400+ @" iPad14,6" : @" iPad Pro 12.9 inch 6th Gen" ,
401+ @" iPad14,8" : @" iPad Air 6th Gen" ,
402+ @" iPad14,9" : @" iPad Air 6th Gen" ,
403+ @" iPad14,10" : @" iPad Air 7th Gen" ,
404+ @" iPad14,11" : @" iPad Air 7th Gen" ,
405+ @" iPad16,3" : @" iPad Pro 11 inch 5th Gen" ,
406+ @" iPad16,4" : @" iPad Pro 11 inch 5th Gen" ,
407+ @" iPad16,5" : @" iPad Pro 12.9 inch 7th Gen" ,
408+ @" iPad16,6" : @" iPad Pro 12.9 inch 7th Gen" ,
392409
393410 @" iPod1,1" : @" iPod touch 1" ,
394411 @" iPod2,1" : @" iPod touch 2" ,
@@ -440,6 +457,11 @@ + (NSString *)deviceName {
440457 @" Watch6,16" : @" Apple Watch Series 8 41mm case (GPS+Cellular)" ,
441458 @" Watch6,17" : @" Apple Watch Series 8 45mm case (GPS+Cellular)" ,
442459 @" Watch6,18" : @" Apple Watch Ultra" ,
460+ @" Watch7,1" : @" Apple Watch Series 9 41mm case (GPS)" ,
461+ @" Watch7,2" : @" Apple Watch Series 9 45mm case (GPS)" ,
462+ @" Watch7,3" : @" Apple Watch Series 9 41mm case (GPS+Cellular)" ,
463+ @" Watch7,4" : @" Apple Watch Series 9 45mm case (GPS+Cellular)" ,
464+ @" Watch7,5" : @" Apple Watch Ultra 2" ,
443465
444466 @" AudioAccessory1,1" : @" HomePod" ,
445467 @" AudioAccessory1,2" : @" HomePod" ,
@@ -542,9 +564,26 @@ + (BOOL)isNotchedScreen {
542564}
543565
544566+ (BOOL )isRegularScreen {
567+ if ([@[
568+ @" iPhone 14 Pro" ,
569+ @" iPhone 15" ,
570+ @" iPhone 16" ,
571+ ] qmui_firstMatchWithBlock: ^BOOL (NSString *item) {
572+ return [QMUIHelper.deviceName hasPrefix: item];
573+ }]) {
574+ return YES ;
575+ }
545576 return [self isIPad ] || (!IS_ZOOMEDMODE && ([self is67InchScreenAndiPhone14Later ] || [self is67InchScreen ] || [self is65InchScreen ] || [self is61InchScreen ] || [self is55InchScreen ]));
546577}
547578
579+ static NSInteger is69InchScreen = -1 ;
580+ + (BOOL )is69InchScreen {
581+ if (is69InchScreen < 0 ) {
582+ is69InchScreen = CGSizeEqualToSize (CGSizeMake (DEVICE_WIDTH, DEVICE_HEIGHT), self.screenSizeFor69Inch ) ? 1 : 0 ;
583+ }
584+ return is69InchScreen > 0 ;
585+ }
586+
548587static NSInteger is67InchScreenAndiPhone14Later = -1 ;
549588+ (BOOL )is67InchScreenAndiPhone14Later {
550589 if (is67InchScreenAndiPhone14Later < 0 ) {
@@ -571,6 +610,14 @@ + (BOOL)is65InchScreen {
571610 return is65InchScreen > 0 ;
572611}
573612
613+ static NSInteger is63InchScreen = -1 ;
614+ + (BOOL )is63InchScreen {
615+ if (is63InchScreen < 0 ) {
616+ is63InchScreen = CGSizeEqualToSize (CGSizeMake (DEVICE_WIDTH, DEVICE_HEIGHT), self.screenSizeFor63Inch ) ? 1 : 0 ;
617+ }
618+ return is63InchScreen > 0 ;
619+ }
620+
574621static NSInteger is61InchScreenAndiPhone14ProLater = -1 ;
575622+ (BOOL )is61InchScreenAndiPhone14ProLater {
576623 if (is61InchScreenAndiPhone14ProLater < 0 ) {
@@ -645,6 +692,10 @@ + (BOOL)is35InchScreen {
645692 return is35InchScreen > 0 ;
646693}
647694
695+ + (CGSize)screenSizeFor69Inch {
696+ return CGSizeMake (440 , 956 );
697+ }
698+
648699+ (CGSize)screenSizeFor67InchAndiPhone14Later {
649700 return CGSizeMake (430 , 932 );// iPhone 14 Pro Max
650701}
@@ -665,6 +716,10 @@ + (CGSize)screenSizeFor61InchAndiPhone12Later {
665716 return CGSizeMake (390 , 844 );
666717}
667718
719+ + (CGSize)screenSizeFor63Inch {
720+ return CGSizeMake (402 , 874 );
721+ }
722+
668723+ (CGSize)screenSizeFor61Inch {
669724 return CGSizeMake (414 , 896 );
670725}
@@ -724,6 +779,26 @@ + (UIEdgeInsets)safeAreaInsetsForDeviceWithNotch {
724779 static NSDictionary <NSString *, NSDictionary <NSNumber *, NSValue *> *> *dict;
725780 if (!dict) {
726781 dict = @{
782+ // iPhone 16 Pro
783+ @" iPhone17,1" : @{
784+ @(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (62 , 0 , 34 , 0 )],
785+ @(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (0 , 62 , 21 , 62 )],
786+ },
787+ // iPhone 16 Pro Max
788+ @" iPhone17,2" : @{
789+ @(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (62 , 0 , 34 , 0 )],
790+ @(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (0 , 62 , 21 , 62 )],
791+ },
792+ // iPhone 16
793+ @" iPhone17,3" : @{
794+ @(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (59 , 0 , 34 , 0 )],
795+ @(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (0 , 59 , 21 , 59 )],
796+ },
797+ // iPhone 16 Plus
798+ @" iPhone17,4" : @{
799+ @(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (59 , 0 , 34 , 0 )],
800+ @(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (0 , 59 , 21 , 59 )],
801+ },
727802 // iPhone 15
728803 @" iPhone15,4" : @{
729804 @(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (47 , 0 , 34 , 0 )],
@@ -960,19 +1035,16 @@ + (BOOL)isZoomedMode {
9601035
9611036+ (BOOL )isDynamicIslandDevice {
9621037 if (!IS_IPHONE) return NO ;
963- __block BOOL result = NO ;
964- NSString *deviceName = self.deviceName ;
965- [@[
1038+ if ([@[
9661039 @" iPhone 14 Pro" ,
967- @" iPhone 14 Pro Max" ,
9681040 @" iPhone 15" ,
969- ] enumerateObjectsUsingBlock: ^( id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
970- if ([deviceName hasPrefix: obj] ) {
971- result = YES ;
972- *stop = YES ;
973- }
974- }];
975- return result ;
1041+ @" iPhone 16 " ,
1042+ ] qmui_firstMatchWithBlock: ^ BOOL ( NSString *item ) {
1043+ return [QMUIHelper.deviceName hasPrefix: item] ;
1044+ }]) {
1045+ return YES ;
1046+ }
1047+ return NO ;
9761048}
9771049
9781050- (void )handleAppSizeWillChange : (NSNotification *)notification {
@@ -1017,13 +1089,13 @@ + (CGFloat)statusBarHeightConstant {
10171089 // iPhone 13 Mini
10181090 return 48 ;
10191091 }
1020- if ([deviceModel isEqualToString: @" iPhone15,2 " ] // iPhone 14 Pro
1021- || [deviceModel isEqualToString: @" iPhone15,3 " ] // iPhone 14 Pro Max
1022- || [deviceModel isEqualToString: @" iPhone15,4 " ] // iPhone 15
1023- || [deviceModel isEqualToString: @" iPhone15,5 " ] // iPhone 15 Plus
1024- || [deviceModel isEqualToString: @" iPhone16,1 " ] // iPhone 15 Pro
1025- || [deviceModel isEqualToString: @" iPhone16,2 " ] // iPhone 15 Pro Max
1026- ) {
1092+ if ([@[
1093+ @" iPhone 14 Pro" ,
1094+ @" iPhone 15" ,
1095+ @" iPhone 16 " ,
1096+ ] qmui_firstMatchWithBlock: ^ BOOL ( NSString *item) {
1097+ return [QMUIHelper.deviceName hasPrefix: item];
1098+ }] ) {
10271099 return 54 ;
10281100 }
10291101 if (IS_61INCH_SCREEN_AND_IPHONE12 || IS_67INCH_SCREEN) {
@@ -1040,15 +1112,20 @@ + (CGFloat)navigationBarMaxYConstant {
10401112 result += PreferredValueForVisualDevice (44 , 32 );
10411113 } else {
10421114 result += 44 ;
1043- NSString *deviceModel = [QMUIHelper deviceModel ];
1044- if ([deviceModel isEqualToString: @" iPhone15,2" ] // iPhone 14 Pro
1045- || [deviceModel isEqualToString: @" iPhone15,3" ] // iPhone 14 Pro Max
1046- || [deviceModel isEqualToString: @" iPhone15,4" ] // iPhone 15
1047- || [deviceModel isEqualToString: @" iPhone15,5" ] // iPhone 15 Plus
1048- || [deviceModel isEqualToString: @" iPhone16,1" ] // iPhone 15 Pro
1049- || [deviceModel isEqualToString: @" iPhone16,2" ] // iPhone 15 Pro Max
1050- ) {
1051- result -= PixelOne;
1115+ if ([@[
1116+ @" iPhone 16 Pro" ,
1117+ ] qmui_firstMatchWithBlock: ^BOOL (NSString *item) {
1118+ return [QMUIHelper.deviceName hasPrefix: item];
1119+ }]) {
1120+ result += 2 + PixelOne;// 56.333
1121+ } else if ([@[
1122+ @" iPhone 14 Pro" ,
1123+ @" iPhone 15" ,
1124+ @" iPhone 16" ,
1125+ ] qmui_firstMatchWithBlock: ^BOOL (NSString *item) {
1126+ return [QMUIHelper.deviceName hasPrefix: item];
1127+ }]) {
1128+ result -= PixelOne;// 53.667
10521129 }
10531130 }
10541131 return result;
0 commit comments