Skip to content

Commit 4d91270

Browse files
committed
优化清除按钮和设置界面的可见性管理逻辑
1 parent bb33da1 commit 4d91270

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

DYYY.xm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6468,6 +6468,7 @@ static void DYYYRemoveKeyboardObserver(void) {
64686468

64696469
hideButton.hidden = NO;
64706470
[getKeyWindow() addSubview:hideButton];
6471+
updateClearButtonVisibility();
64716472

64726473
DYYYRemoveAppLifecycleObservers();
64736474

@@ -6591,10 +6592,12 @@ static Class TagViewClass = nil;
65916592
pureModeSet = NO;
65926593

65936594
// 倍速和清屏按钮的状态控制
6594-
if (speedButton && isFloatSpeedButtonEnabled) {
6595-
if (alpha == 0) {
6595+
BOOL hasFloatingButtons = (speedButton && isFloatSpeedButtonEnabled) || hideButton;
6596+
if (hasFloatingButtons && !dyyyIsPerformingFloatClearOperation) {
6597+
const CGFloat threshold = 0.01f;
6598+
if (alpha <= threshold) {
65966599
dyyyCommentViewVisible = YES;
6597-
} else if (alpha == 1) {
6600+
} else if (alpha >= (1.0f - threshold)) {
65986601
dyyyCommentViewVisible = NO;
65996602
}
66006603
updateSpeedButtonVisibility();

DYYYFloatClearButton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern BOOL isInPlayInteractionVC;
1111
extern BOOL isPureViewVisible;
1212
extern BOOL clearButtonForceHidden;
1313
extern BOOL isAppActive;
14+
extern BOOL dyyyIsPerformingFloatClearOperation;
1415
extern BOOL isAppInTransition;
1516
extern NSArray *targetClassNames;
1617
extern BOOL dyyyInteractionViewVisible;
@@ -52,4 +53,3 @@ void initTargetClassNames(void);
5253
- (void)saveLockState;
5354
- (void)loadLockState;
5455
@end
55-

DYYYSettings.xm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,8 +3052,12 @@ void showDYYYSettingsVC(UIViewController *rootVC, BOOL hasAgreed) {
30523052
[clearButtonItems addObject:hideSpeedButton];
30533053
// 获取清屏按钮的当前开关状态
30543054
BOOL isEnabled = [DYYYSettingsHelper getUserDefaults:@"DYYYEnableFloatClearButton"];
3055-
clearButtonSizeItem.isEnable = isEnabled;
3056-
clearButtonIcon.isEnable = isEnabled;
3055+
for (AWESettingItemModel *item in clearButtonItems) {
3056+
if (item == enableClearButton) {
3057+
continue;
3058+
}
3059+
item.isEnable = isEnabled;
3060+
}
30573061

30583062
// 创建并组织所有section
30593063
NSMutableArray *sections = [NSMutableArray array];

0 commit comments

Comments
 (0)