diff --git a/PlayTools/MysticRunes/PlayShadow.m b/PlayTools/MysticRunes/PlayShadow.m index 8e2d5160..b30fdb90 100644 --- a/PlayTools/MysticRunes/PlayShadow.m +++ b/PlayTools/MysticRunes/PlayShadow.m @@ -7,6 +7,7 @@ #import #import +#import #import __attribute__((visibility("hidden"))) @@ -116,6 +117,23 @@ - (NSDictionary *) pm_return_empty_dictionary { return @{}; } +// Endfield UIAlertController hook +- (void)pm_endfield_presentViewController:(UIViewController *)viewControllerToPresent + animated:(BOOL)flag + completion:(void (^)(void))completion { + // If it's a UIAlertController, silently ignore it + if ([viewControllerToPresent isKindOfClass:[UIAlertController class]]) { + NSLog(@"PC-DEBUG: [PlayShadow] Blocked UIAlertController for Endfield"); + if (completion) { + completion(); + } + return; + } + + // Otherwise, present normally + [self pm_endfield_presentViewController:viewControllerToPresent animated:flag completion:completion]; +} + // Class methods + (void) pm_return_2_with_completion_handler:(void (^)(NSInteger))completionHandler { @@ -171,6 +189,14 @@ + (void) load { // canResizeToFitContent // [objc_getClass("UIWindow") swizzleInstanceMethod:@selector(canResizeToFitContent) withMethod:@selector(pm_return_true)]; + + // Block UIAlertController presentation to bypass Endfield jailbreak message + NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier]; + if ([bundleID isEqualToString:@"com.gryphline.endfield.ios"] || + [bundleID isEqualToString:@"com.hypergryph.endfield"]) { + [self debugLogger:@"loading UIAlertController bypass"]; + [objc_getClass("UIViewController") swizzleInstanceMethod:@selector(presentViewController:animated:completion:) withMethod:@selector(pm_endfield_presentViewController:animated:completion:)]; + } } + (void) loadJailbreakBypass {