From 05926540d28393987cca3defee35bbfcc68670ae Mon Sep 17 00:00:00 2001 From: Jamie Berghmans Date: Sun, 29 Dec 2019 00:15:35 +0100 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ Makefile | 13 +++++++++++++ Tweak.xm | 37 +++++++++++++++++++++++++++++++++++++ YTCastConfirm.plist | 1 + control | 9 +++++++++ 5 files changed, 63 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 Tweak.xm create mode 100644 YTCastConfirm.plist create mode 100644 control diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f5f6458 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +.theos +packages \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ae6bade --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +export ARCHS = armv7 arm64 arm64e + +PACKAGE_VERSION = 1.0.0 + +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = YTCastConfirm +YTCastConfirm_FILES = Tweak.xm + +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "killall -9 SpringBoard" diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..a01b8c5 --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,37 @@ +%hook MDXPlaybackRouteButtonController + +-(void)didPressButton:(id)arg1 { + + UIAlertController* alertController = [%c(UIAlertController) alertControllerWithTitle:@"Casting" + message:@"Are you sure you want to start casting?" + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* defaultAction = [%c(UIAlertAction) actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + %orig; + }]; + + UIAlertAction* noButton = [%c(UIAlertAction) + actionWithTitle:@"Cancel" + style:UIAlertActionStyleDefault + handler: ^(UIAlertAction * action) { + return; + }]; + + + [alertController addAction:defaultAction]; + [alertController addAction:noButton]; + + id rootViewController = [%c(UIApplication) sharedApplication].delegate.window.rootViewController; + if([rootViewController isKindOfClass:[%c(UINavigationController) class]]) { + rootViewController = ((UINavigationController *)rootViewController).viewControllers.firstObject; + } + if([rootViewController isKindOfClass:[%c(UITabBarController) class]]) { + rootViewController = ((UITabBarController *)rootViewController).selectedViewController; + } + if ([rootViewController presentedViewController] != nil) { + rootViewController = [rootViewController presentedViewController]; + } + [rootViewController presentViewController:alertController animated:YES completion:nil]; +} + +%end \ No newline at end of file diff --git a/YTCastConfirm.plist b/YTCastConfirm.plist new file mode 100644 index 0000000..fb2904e --- /dev/null +++ b/YTCastConfirm.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.google.ios.youtube" ); }; } diff --git a/control b/control new file mode 100644 index 0000000..4a78cac --- /dev/null +++ b/control @@ -0,0 +1,9 @@ +Package: com.devvix.ytcastconfirm +Name: YTCastConfirm +Depends: mobilesubstrate +Version: 1.0.0 +Architecture: iphoneos-arm +Description: An awesome MobileSubstrate tweak! +Maintainer: Devvix +Author: Devvix +Section: Tweaks