Tweak.x 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #import <UIKit/UIKit.h>
  2. #import "TweakHelper.h"
  3. #define TWEAK_SOURCE @"thebigboss.org"
  4. // #define TWEAK_SOURCE @"abox.plus"
  5. #define TWEAK_VERSION @"1.0.0"
  6. #define TWEAK_NAME @"MiHomeNoAds"
  7. #define ALERT_KEY @"block-ad-alert"
  8. @interface MHFamilyMainViewController: UIViewController
  9. - (void)showAlertControllerWhitKey:(NSString *)key;
  10. @end
  11. @interface MHSplashViewController: UIViewController
  12. - (void)jumpAd;
  13. @end
  14. %hook MHFamilyMainViewController
  15. - (void)viewDidLoad {
  16. %log;
  17. %orig;
  18. if (![[NSUserDefaults standardUserDefaults] boolForKey:ALERT_KEY]) {
  19. [self showAlertControllerWhitKey:ALERT_KEY];
  20. }
  21. }
  22. %new
  23. - (void)showAlertControllerWhitKey:(NSString *)key {
  24. NSString * appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
  25. NSString *alertTitle = [NSString stringWithFormat:@"%@去广告插件",appName];
  26. NSString *alertMessage = @"由SWING开发";
  27. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleAlert];
  28. if ([TweakHelper canOpenSileo]) {
  29. [alertController addAction:[UIAlertAction actionWithTitle:@"在Sileo中添加源" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  30. NSString *urlString = @"sileo://source/https://repo.abox.plus/";
  31. NSURL *url = [NSURL URLWithString:urlString];
  32. [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
  33. }]];
  34. }
  35. if ([TweakHelper canOpenCydia]) {
  36. [alertController addAction:[UIAlertAction actionWithTitle:@"在Cydia中添加源" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  37. NSString *urlString = @"cydia://url/https://cydia.saurik.com/api/share#?source=https://repo.abox.plus/";
  38. NSURL *url = [NSURL URLWithString:urlString];
  39. [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
  40. }]];
  41. }
  42. UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"不再提醒" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  43. [[NSUserDefaults standardUserDefaults] setBool:true forKey:key];
  44. }];
  45. [alertController addAction:okAction];
  46. UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
  47. [alertController addAction:cancelAction];
  48. [self presentViewController:alertController animated:YES completion:nil];
  49. }
  50. - (void)refreshFocusAdData{
  51. %log;
  52. }
  53. %end
  54. %hook MHTabBarViewController
  55. - (void)p_setupBrandZoneTab:(id)arg1 {
  56. %log;
  57. }
  58. %end
  59. %hook MHSplashViewController
  60. - (void)viewDidLoad {
  61. [self jumpAd];
  62. }
  63. %end
  64. %hook MHSplashADProcessor
  65. + (id)shared {
  66. return nil;
  67. }
  68. - (void)displaySplashAd {
  69. }
  70. - (id)init {
  71. return nil;
  72. }
  73. - (id)loadSplashAdCacheDataAdList {
  74. return nil;
  75. }
  76. - (id)loadSplashAdCacheData {
  77. return nil;
  78. }
  79. %end
  80. %hook AppDelegate
  81. - (void)showUserGuideOrSplashAD {
  82. %log;
  83. }
  84. %end