Obscure mail spi

This commit is contained in:
2025-05-05 19:05:49 -07:00
parent 6301c40c59
commit 334703ec43
3 changed files with 11 additions and 12 deletions

View File

@@ -9,26 +9,18 @@
#import <MessageUI/MessageUI.h>
#import <WebKit/WKWebView.h>
#import <objc/runtime.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);
}
#import "Hacks.h"
__attribute__((constructor))
static void swizzleMFMailComposeViewController(void)
{
// 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;
}));
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;
}));
}