Obscure mail spi
This commit is contained in:
@@ -9,3 +9,4 @@
|
|||||||
|
|
||||||
extern Class DecodedClass(const char *encodedClassName);
|
extern Class DecodedClass(const char *encodedClassName);
|
||||||
extern SEL DecodedSelector(const char *encodedSelectorName);
|
extern SEL DecodedSelector(const char *encodedSelectorName);
|
||||||
|
extern void SwizzleClassMethod(Class targetClass, SEL originalSelector, IMP replacementIMP);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "Hacks.h"
|
#import "Hacks.h"
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
|
||||||
Class DecodedClass(const char *encodedClassName) {
|
Class DecodedClass(const char *encodedClassName) {
|
||||||
NSData *data = [NSData dataWithBytesNoCopy:(void *)encodedClassName length:strlen(encodedClassName) freeWhenDone:NO];
|
NSData *data = [NSData dataWithBytesNoCopy:(void *)encodedClassName length:strlen(encodedClassName) freeWhenDone:NO];
|
||||||
@@ -23,3 +24,8 @@ SEL DecodedSelector(const char *encodedSelectorName) {
|
|||||||
return NSSelectorFromString(str);
|
return NSSelectorFromString(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SwizzleClassMethod(Class targetClass, SEL originalSelector, IMP replacementIMP)
|
||||||
|
{
|
||||||
|
Method originalMethod = class_getClassMethod(targetClass, originalSelector);
|
||||||
|
method_setImplementation(originalMethod, replacementIMP);
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,26 +9,18 @@
|
|||||||
#import <MessageUI/MessageUI.h>
|
#import <MessageUI/MessageUI.h>
|
||||||
#import <WebKit/WKWebView.h>
|
#import <WebKit/WKWebView.h>
|
||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
|
#import "Hacks.h"
|
||||||
@interface MFMailComposeViewController (InternalMethods)
|
|
||||||
+ (BOOL)canSendMailSourceAccountManagement:(NSInteger)sourceAccountManagement;
|
|
||||||
@end
|
|
||||||
|
|
||||||
static void swizzleClassMethod(Class targetClass, SEL originalSelector, IMP replacementIMP)
|
|
||||||
{
|
|
||||||
Method originalMethod = class_getClassMethod(targetClass, originalSelector);
|
|
||||||
method_setImplementation(originalMethod, replacementIMP);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((constructor))
|
__attribute__((constructor))
|
||||||
static void swizzleMFMailComposeViewController(void)
|
static void swizzleMFMailComposeViewController(void)
|
||||||
{
|
{
|
||||||
// Hacks to work around the fact that MFMailComposeViewController is broken in iOS 14+
|
// Hacks to work around the fact that MFMailComposeViewController is broken in iOS 14+
|
||||||
swizzleClassMethod(MFMailComposeViewController.class, @selector(canSendMail), imp_implementationWithBlock(^BOOL(void) {
|
SwizzleClassMethod(MFMailComposeViewController.class, @selector(canSendMail), imp_implementationWithBlock(^BOOL(void) {
|
||||||
return YES;
|
return YES;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
swizzleClassMethod(MFMailComposeViewController.class, @selector(canSendMailSourceAccountManagement:), imp_implementationWithBlock(^BOOL(NSInteger sam) {
|
SEL canSendMailSourceAccountManagement = DecodedSelector("Y2FuU2VuZE1haWxTb3VyY2VBY2NvdW50TWFuYWdlbWVudDo=");
|
||||||
|
SwizzleClassMethod(MFMailComposeViewController.class, canSendMailSourceAccountManagement, imp_implementationWithBlock(^BOOL(NSInteger sam) {
|
||||||
return YES;
|
return YES;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user