fix YTCastconfirm, code clean up

This commit is contained in:
qnblackcat 2022-05-21 12:51:11 +07:00
parent 2e6c19c060
commit ec7eec660b

View file

@ -112,9 +112,9 @@ BOOL ytMiniPlayer() {
%end
//YTCastConfirm: https://github.com/JamieBerghmans/YTCastConfirm
%group gYTCastconfirm
%hook MDXPlaybackRouteButtonController
- (void)didPressButton:(id)arg1 {
if (castConfirm()) {
UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:@"Casting"
message:@"Are you sure you want to start casting?"
preferredStyle:UIAlertControllerStyleAlert];
@ -125,8 +125,9 @@ BOOL ytMiniPlayer() {
UIAlertAction* noButton = [%c(UIAlertAction)
actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler: ^(UIAlertAction * action) { return; }
];
handler: ^(UIAlertAction * action) {
return;
}];
[alertController addAction:defaultAction];
[alertController addAction:noButton];
@ -142,10 +143,10 @@ BOOL ytMiniPlayer() {
rootViewController = [rootViewController presentedViewController];
}
[rootViewController presentViewController:alertController animated:YES completion:nil];
return %orig;
} else { return %orig; }
}
%end
%end
// Workaround for https://github.com/MiRO92/uYou-for-YouTube/issues/12
%hook YTAdsInnerTubeContextDecorator
@ -317,9 +318,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
%orig;
self.tableView.backgroundColor = oledColor;
} else {
return %orig();
}
} else { return %orig; }
}
%end
@ -417,9 +416,7 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook YTCollectionSeparatorView
- (void)didMoveToWindow {
if (isDarkMode()) {}
else {
return %orig();
}
else { return %orig; }
}
%end
@ -443,8 +440,8 @@ UIColor* oledColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
%hook ASWAppSwitcherCollectionViewCell
- (void)didMoveToWindow {
if (isDarkMode()) {
%orig;
self.subviews[1].backgroundColor = oledColor;
%orig;
}
}
%end
@ -568,7 +565,4 @@ static void replaceTab(YTIGuideResponse *response) {
if (bigYTMiniPlayer() && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
%init(Main);
}
if (castConfirm()) {
%init(gYTCastconfirm);
}
}