20
20
#import " NSString+QMUI.h"
21
21
#import " UIInterface+QMUI.h"
22
22
#import " NSObject+QMUI.h"
23
+ #import " NSArray+QMUI.h"
23
24
#import < AVFoundation/AVFoundation.h>
24
25
#import < math.h>
25
26
#import < sys/utsname.h>
@@ -317,6 +318,10 @@ + (NSString *)deviceName {
317
318
@" iPhone15,5" : @" iPhone 15 Plus" ,
318
319
@" iPhone16,1" : @" iPhone 15 Pro" ,
319
320
@" 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" ,
320
325
321
326
@" iPad1,1" : @" iPad 1" ,
322
327
@" iPad2,1" : @" iPad 2 (WiFi)" ,
@@ -389,6 +394,18 @@ + (NSString *)deviceName {
389
394
@" iPad13,11" : @" iPad Pro (12.9 inch, 5th generation)" ,
390
395
@" iPad14,1" : @" iPad mini (6th generation)" ,
391
396
@" 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" ,
392
409
393
410
@" iPod1,1" : @" iPod touch 1" ,
394
411
@" iPod2,1" : @" iPod touch 2" ,
@@ -440,6 +457,11 @@ + (NSString *)deviceName {
440
457
@" Watch6,16" : @" Apple Watch Series 8 41mm case (GPS+Cellular)" ,
441
458
@" Watch6,17" : @" Apple Watch Series 8 45mm case (GPS+Cellular)" ,
442
459
@" 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" ,
443
465
444
466
@" AudioAccessory1,1" : @" HomePod" ,
445
467
@" AudioAccessory1,2" : @" HomePod" ,
@@ -542,9 +564,26 @@ + (BOOL)isNotchedScreen {
542
564
}
543
565
544
566
+ (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
+ }
545
576
return [self isIPad ] || (!IS_ZOOMEDMODE && ([self is67InchScreenAndiPhone14Later ] || [self is67InchScreen ] || [self is65InchScreen ] || [self is61InchScreen ] || [self is55InchScreen ]));
546
577
}
547
578
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
+
548
587
static NSInteger is67InchScreenAndiPhone14Later = -1 ;
549
588
+ (BOOL )is67InchScreenAndiPhone14Later {
550
589
if (is67InchScreenAndiPhone14Later < 0 ) {
@@ -571,6 +610,14 @@ + (BOOL)is65InchScreen {
571
610
return is65InchScreen > 0 ;
572
611
}
573
612
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
+
574
621
static NSInteger is61InchScreenAndiPhone14ProLater = -1 ;
575
622
+ (BOOL )is61InchScreenAndiPhone14ProLater {
576
623
if (is61InchScreenAndiPhone14ProLater < 0 ) {
@@ -645,6 +692,10 @@ + (BOOL)is35InchScreen {
645
692
return is35InchScreen > 0 ;
646
693
}
647
694
695
+ + (CGSize)screenSizeFor69Inch {
696
+ return CGSizeMake (440 , 956 );
697
+ }
698
+
648
699
+ (CGSize)screenSizeFor67InchAndiPhone14Later {
649
700
return CGSizeMake (430 , 932 );// iPhone 14 Pro Max
650
701
}
@@ -665,6 +716,10 @@ + (CGSize)screenSizeFor61InchAndiPhone12Later {
665
716
return CGSizeMake (390 , 844 );
666
717
}
667
718
719
+ + (CGSize)screenSizeFor63Inch {
720
+ return CGSizeMake (402 , 874 );
721
+ }
722
+
668
723
+ (CGSize)screenSizeFor61Inch {
669
724
return CGSizeMake (414 , 896 );
670
725
}
@@ -724,6 +779,26 @@ + (UIEdgeInsets)safeAreaInsetsForDeviceWithNotch {
724
779
static NSDictionary <NSString *, NSDictionary <NSNumber *, NSValue *> *> *dict;
725
780
if (!dict) {
726
781
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
+ },
727
802
// iPhone 15
728
803
@" iPhone15,4" : @{
729
804
@(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets: UIEdgeInsetsMake (47 , 0 , 34 , 0 )],
@@ -960,19 +1035,16 @@ + (BOOL)isZoomedMode {
960
1035
961
1036
+ (BOOL )isDynamicIslandDevice {
962
1037
if (!IS_IPHONE) return NO ;
963
- __block BOOL result = NO ;
964
- NSString *deviceName = self.deviceName ;
965
- [@[
1038
+ if ([@[
966
1039
@" iPhone 14 Pro" ,
967
- @" iPhone 14 Pro Max" ,
968
1040
@" 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 ;
976
1048
}
977
1049
978
1050
- (void )handleAppSizeWillChange : (NSNotification *)notification {
@@ -1017,13 +1089,13 @@ + (CGFloat)statusBarHeightConstant {
1017
1089
// iPhone 13 Mini
1018
1090
return 48 ;
1019
1091
}
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
+ }] ) {
1027
1099
return 54 ;
1028
1100
}
1029
1101
if (IS_61INCH_SCREEN_AND_IPHONE12 || IS_67INCH_SCREEN) {
@@ -1040,15 +1112,20 @@ + (CGFloat)navigationBarMaxYConstant {
1040
1112
result += PreferredValueForVisualDevice (44 , 32 );
1041
1113
} else {
1042
1114
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
1052
1129
}
1053
1130
}
1054
1131
return result;
0 commit comments