Delete web process bundle in favor of custom scheme handler

This commit is contained in:
2025-05-05 18:14:46 -07:00
parent a2e29abf19
commit 8fe8426cc2
11 changed files with 162 additions and 447 deletions

View File

@@ -7,6 +7,7 @@
#import <CoreFoundation/CoreFoundation.h>
#import <MessageUI/MessageUI.h>
#import <WebKit/WKWebView.h>
#import <objc/runtime.h>
@interface MFMailComposeViewController (InternalMethods)
@@ -31,3 +32,26 @@ static void swizzleMFMailComposeViewController(void)
return YES;
}));
}
@interface WKWebView (Hacks)
+ (BOOL)orig_handlesURLScheme:(NSString *)scheme;
@end
@implementation WKWebView (Hacks)
+ (BOOL)orig_handlesURLScheme:(NSString *)scheme
{
if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]) {
return NO;
}
return [self orig_handlesURLScheme:scheme];
}
@end
__attribute__((constructor))
static void swizzleWebKitConfiguration(void)
{
Method origMethod = class_getClassMethod(WKWebView.class, @selector(handlesURLScheme:));
Method replMethod = class_getClassMethod(WKWebView.class, @selector(orig_handlesURLScheme:));
method_exchangeImplementations(origMethod, replMethod);
}