Skip to content

Commit 6c4d656

Browse files
committed
优化视频全屏适配逻辑,调整设备IP地址
1 parent 331e423 commit 6c4d656

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

DYYY.xm

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,12 +4488,24 @@ static BOOL DYYYIsLandscapeVideoBounds(CGSize size) {
44884488
if (!DYYYGetBool(@"DYYYEnableFullScreen")) {
44894489
return;
44904490
}
4491-
if (!DYYYIsLandscapeVideoBounds(self.bounds.size)) {
4491+
BOOL shouldAdjust = DYYYIsLandscapeVideoBounds(self.bounds.size);
4492+
if (!shouldAdjust) {
4493+
CGFloat width = self.bounds.size.width;
4494+
CGFloat height = self.bounds.size.height;
4495+
if (width > 0.0f && height > width) {
4496+
const CGFloat maxPortraitRatio = 1.5f;
4497+
CGFloat aspectRatio = height / width;
4498+
shouldAdjust = aspectRatio <= maxPortraitRatio;
4499+
}
4500+
}
4501+
if (!shouldAdjust) {
44924502
return;
44934503
}
44944504

44954505
CGFloat viewWidth = CGRectGetWidth(self.bounds);
4496-
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
4506+
CGRect screenBounds = [UIScreen mainScreen].bounds;
4507+
CGFloat screenWidth = CGRectGetWidth(screenBounds);
4508+
BOOL isScreenLandscape = screenWidth > CGRectGetHeight(screenBounds);
44974509

44984510
if (viewWidth < screenWidth) {
44994511
return;
@@ -4504,7 +4516,7 @@ static BOOL DYYYIsLandscapeVideoBounds(CGSize size) {
45044516
return;
45054517
}
45064518

4507-
CGFloat desiredOffset = tabHeight * 0.6f;
4519+
CGFloat desiredOffset = isScreenLandscape ? 0.0f : (tabHeight * 0.6f);
45084520
CGFloat appliedOffset = storedValue ? storedValue.doubleValue : 0.0f;
45094521
CGFloat delta = desiredOffset - appliedOffset;
45104522
if (fabs(delta) < 0.1f) {
@@ -4555,15 +4567,6 @@ static BOOL DYYYIsLandscapeVideoBounds(CGSize size) {
45554567

45564568
%end
45574569

4558-
// 去广告功能
4559-
%hook AwemeAdManager
4560-
- (void)showAd {
4561-
if (DYYYGetBool(@"DYYYNoAds"))
4562-
return;
4563-
%orig;
4564-
}
4565-
%end
4566-
45674570
%hook AWEPlayInteractionUserAvatarView
45684571
- (void)layoutSubviews {
45694572
%orig;
@@ -7001,12 +7004,16 @@ static Class TagViewClass = nil;
70017004
- (void)setFrame:(CGRect)frame {
70027005

70037006
CGFloat viewWidth = CGRectGetWidth(self.bounds);
7004-
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
7007+
CGRect screenBounds = [UIScreen mainScreen].bounds;
7008+
CGFloat screenWidth = CGRectGetWidth(screenBounds);
7009+
BOOL isScreenLandscape = screenWidth > CGRectGetHeight(screenBounds);
70057010

70067011
if (viewWidth < screenWidth) {
70077012
%orig(frame);
70087013
} else if (DYYYGetBool(@"DYYYEnableFullScreen") && gCurrentTabBarHeight > 0.0f) {
7009-
frame.size.height += 25.0f;
7014+
if (!isScreenLandscape) {
7015+
frame.size.height += 25.0f;
7016+
}
70107017
}
70117018
%orig(frame);
70127019
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ include $(THEOS_MAKE_PATH)/tweak.mk
5454
ifeq ($(shell whoami),huami)
5555
THEOS_DEVICE_IP = 192.168.31.222
5656
else
57-
THEOS_DEVICE_IP = 192.168.15.105
57+
THEOS_DEVICE_IP = 192.168.15.106
5858
endif
5959
THEOS_DEVICE_PORT = 22
6060

0 commit comments

Comments
 (0)