Ask before casting to prevent you from accidentally hijacking the tv when you press the cast button.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- %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
|