UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
UITextField *whitelistField = alertController.textFields.firstObject;
if ([whitelistField.text length] != 0) [[NSUserDefaults standardUserDefaults]
setObject:whitelistField.text forKey:@"whitelist"];
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel handler:nil];
[alertController addAction:okAction];
[alertController addAction:cancelAction];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"[email protected]";
textField.text = [[NSUserDefaults standardUserDefaults]
objectForKey:@"whitelist"];
}];
[self presentViewController:alertController animated:YES completion:nil];
}
- (void)viewWillAppear:(BOOL)arg1
{
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]
initWithTitle:@"Whitelist" style:UIBarButtonItemStylePlain target:self
action:@selector(iOSREShowWhitelist)] autorelease];
%orig;
}
%end
%hook MailboxContentViewController
- (void)megaMallMessageCountChanged:(NSConcreteNotification )arg1
{
%orig;
NSMutableSet targetMessages = [NSMutableSet setWithCapacity:600];
NSString whitelist = [[NSUserDefaults standardUserDefaults]
objectForKey:@"whitelist"];
MessageMegaMall mall = [arg1 object];
NSSet messages = [mall copyAllMessages]; // Remember to release it later
for (MFLibraryMessage message in messages)
{
MFMessageInfo messageInfo = [message copyMessageInfo]; // Remember to
release it later
for (NSString sender in [message senders]) if (!messageInfo.read && [sender
rangeOfString:[NSString stringWithFormat:@"<%@>", whitelist]].location == NSNotFound)
[targetMessages addObject:message];
[messageInfo release];
}
[messages release];
[mall markMessagesAsViewed:targetMessages];
}
%end
8.4.4 Edit Makefile and control files
The finalized Makefile looks like this:
export THEOS_DEVICE_IP = iOSIP
export ARCHS = armv7 arm64
export TARGET = iphone:clang:latest:8.0
include theos/makefiles/common.mk