From fb4b56c873538d6553a5b325e838c1aba55a1e5e Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:43:36 -0600 Subject: [PATCH] Create YTCastConfirm.xm --- Sources/YTCastConfirm.xm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Sources/YTCastConfirm.xm diff --git a/Sources/YTCastConfirm.xm b/Sources/YTCastConfirm.xm new file mode 100644 index 0000000..e23c5f8 --- /dev/null +++ b/Sources/YTCastConfirm.xm @@ -0,0 +1,21 @@ +#import "../Tweaks/YouTubeHeader/YTAlertView.h" +#import "uYouPlus.h" + +extern NSBundle *uYouPlusBundle(); + +// YTCastConfirm: https://github.com/JamieBerghmans/YTCastConfirm +%hook MDXPlaybackRouteButtonController +- (void)didPressButton:(id)arg1 { + if (IS_ENABLED(@"castConfirm_enabled")) { + NSBundle *tweakBundle = uYouPlusBundle(); + YTAlertView *alertView = [%c(YTAlertView) confirmationDialogWithAction:^{ + %orig; + } actionTitle:LOC(@"MSG_YES")]; + alertView.title = LOC(@"CASTING"); + alertView.subtitle = LOC(@"MSG_ARE_YOU_SURE"); + [alertView show]; + } else { + return %orig; + } +} +%end