#import #import "TweakHelper.h" #define TWEAK_SOURCE @"thebigboss.org" // #define TWEAK_SOURCE @"abox.plus" #define TWEAK_VERSION @"1.0.0" #define TWEAK_NAME @"MiHomeNoAds" #define ALERT_KEY @"block-ad-alert" @interface MHFamilyMainViewController: UIViewController - (void)showAlertControllerWhitKey:(NSString *)key; @end @interface MHSplashViewController: UIViewController - (void)jumpAd; @end %hook MHFamilyMainViewController - (void)viewDidLoad { %log; %orig; if (![[NSUserDefaults standardUserDefaults] boolForKey:ALERT_KEY]) { [self showAlertControllerWhitKey:ALERT_KEY]; } } %new - (void)showAlertControllerWhitKey:(NSString *)key { NSString * appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; NSString *alertTitle = [NSString stringWithFormat:@"%@去广告插件",appName]; NSString *alertMessage = @"由SWING开发"; UIAlertController *alertController = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleAlert]; if ([TweakHelper canOpenSileo]) { [alertController addAction:[UIAlertAction actionWithTitle:@"在Sileo中添加源" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSString *urlString = @"sileo://source/https://repo.abox.plus/"; NSURL *url = [NSURL URLWithString:urlString]; [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; }]]; } if ([TweakHelper canOpenCydia]) { [alertController addAction:[UIAlertAction actionWithTitle:@"在Cydia中添加源" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSString *urlString = @"cydia://url/https://cydia.saurik.com/api/share#?source=https://repo.abox.plus/"; NSURL *url = [NSURL URLWithString:urlString]; [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; }]]; } UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"不再提醒" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { [[NSUserDefaults standardUserDefaults] setBool:true forKey:key]; }]; [alertController addAction:okAction]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil]; [alertController addAction:cancelAction]; [self presentViewController:alertController animated:YES completion:nil]; } - (void)refreshFocusAdData{ %log; } %end %hook MHTabBarViewController - (void)p_setupBrandZoneTab:(id)arg1 { %log; } %end %hook MHSplashViewController - (void)viewDidLoad { [self jumpAd]; } %end %hook MHSplashADProcessor + (id)shared { return nil; } - (void)displaySplashAd { } - (id)init { return nil; } - (id)loadSplashAdCacheDataAdList { return nil; } - (id)loadSplashAdCacheData { return nil; } %end %hook AppDelegate - (void)showUserGuideOrSplashAD { %log; } %end