Delete web process bundle in favor of custom scheme handler
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user