@@ -79,6 +79,57 @@ static void DYYYRemoveRemoteConfigObserver(void) {
7979}
8080%end
8181
82+ @interface AWELeftSideBarTopIconHorizontalView : UIView
83+ @end
84+
85+ %hook AWELeftSideBarTopIconHorizontalView
86+
87+ - (void )didMoveToSuperview {
88+ %orig ;
89+ dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
90+ NSString *accessibilityLabel = self.accessibilityLabel ;
91+ if (![accessibilityLabel isEqualToString: @" 设置" ]) {
92+ return ;
93+ }
94+ UIView *targetSuperView = self.superview .superview .superview ?: self;
95+ UIButton *oldBtn = (UIButton *)[targetSuperView viewWithTag: 232323 ];
96+ if (oldBtn) {
97+ [oldBtn removeFromSuperview ];
98+ }
99+ UIButton *dyyyBtn = [UIButton buttonWithType: UIButtonTypeSystem];
100+ dyyyBtn.tag = 232323 ;
101+ dyyyBtn.accessibilityLabel = @" DYYYSettingsButton" ;
102+ [dyyyBtn setTitle: @" DYYY" forState: UIControlStateNormal];
103+
104+ UIColor *titleColor = [DYYYUtils isDarkMode ] ? [UIColor whiteColor ] : [UIColor blackColor ];
105+ [dyyyBtn setTitleColor: titleColor forState: UIControlStateNormal];
106+
107+ dyyyBtn.titleLabel .font = [UIFont boldSystemFontOfSize: 15 ];
108+ CGRect frame = self.frame ;
109+ dyyyBtn.frame = CGRectMake (frame.origin .x + frame.size .width - 40 - 2 , 8 , 60 , 32 );
110+ dyyyBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
111+ dyyyBtn.layer .cornerRadius = 8 ;
112+ dyyyBtn.clipsToBounds = YES ;
113+ [dyyyBtn addTarget: self action: @selector (dyyyButtonTapped ) forControlEvents: UIControlEventTouchUpInside];
114+ [targetSuperView addSubview: dyyyBtn];
115+ });
116+ }
117+
118+ %new
119+ - (void )dyyyButtonTapped {
120+ UIViewController *targetVC = [DYYYSettingsHelper findViewController: self ];
121+ if (!targetVC) {
122+ UIWindow *activeWindow = [DYYYUtils getActiveWindow ];
123+ targetVC = activeWindow.rootViewController ?: [DYYYUtils topView ];
124+ while (targetVC.presentedViewController ) {
125+ targetVC = targetVC.presentedViewController ;
126+ }
127+ }
128+ BOOL hasAgreed = [DYYYSettingsHelper getUserDefaults: @" DYYYUserAgreementAccepted" ];
129+ showDYYYSettingsVC (targetVC, hasAgreed);
130+ }
131+ %end
132+
82133@interface AWELeftSideBarTopRightLayoutView : UIView
83134@end
84135
0 commit comments