From 945ecccc89672475b2e13b778b0593e436131fe8 Mon Sep 17 00:00:00 2001 From: Levent Duivel Date: Sun, 10 Nov 2024 05:42:51 +0500 Subject: [PATCH] fix for modern times --- AAAppIconCell.h | 3 +++ AAConfigurationViewController.h | 1 + AAConfigurationViewControllerDelegate.h | 2 ++ AACoreDataStack.m | 5 +++-- AutoAlerts.h | 1 + Makefile | 8 ++++++-- Model/AAAlertInfo.h | 2 ++ Tweak.xm | 12 +++--------- control | 4 ++-- 9 files changed, 23 insertions(+), 15 deletions(-) diff --git a/AAAppIconCell.h b/AAAppIconCell.h index 47adf3e..cca2e4e 100644 --- a/AAAppIconCell.h +++ b/AAAppIconCell.h @@ -1,3 +1,6 @@ +#import +#import + @interface AAAppIconCell: UITableViewCell @property (nonatomic, retain) UIImageView *appIconImageView; diff --git a/AAConfigurationViewController.h b/AAConfigurationViewController.h index 1ba8822..3716815 100644 --- a/AAConfigurationViewController.h +++ b/AAConfigurationViewController.h @@ -1,4 +1,5 @@ #import "AAConfigurationViewControllerDelegate.h" +#import @interface AAConfigurationViewController: UIViewController diff --git a/AAConfigurationViewControllerDelegate.h b/AAConfigurationViewControllerDelegate.h index 596982f..7b036c1 100644 --- a/AAConfigurationViewControllerDelegate.h +++ b/AAConfigurationViewControllerDelegate.h @@ -1,3 +1,5 @@ +#import + @protocol AAConfigurationViewControllerDelegate -(void)saveAndRunAction:(int)action; diff --git a/AACoreDataStack.m b/AACoreDataStack.m index 3294d0b..b4abf04 100644 --- a/AACoreDataStack.m +++ b/AACoreDataStack.m @@ -1,5 +1,6 @@ #import "AACoreDataStack.h" #import +#import @interface AACoreDataStack () @@ -16,11 +17,11 @@ -(id)init { if (self = [super init]) { - NSURL *url = [NSURL fileURLWithPath:@"/Library/PreferenceBundles/AutoAlertsPreferences.bundle/AutoAlerts.momd"]; + NSURL *url = [NSURL fileURLWithPath:ROOT_PATH_NS(@"/Library/PreferenceBundles/AutoAlertsPreferences.bundle/AutoAlerts.momd")]; NSManagedObjectModel *model = [[[NSManagedObjectModel alloc] initWithContentsOfURL:url] autorelease]; - NSString *dir = @"/var/mobile/Library/Preferences/AutoAlerts/"; + NSString *dir = ROOT_PATH_NS(@"/var/mobile/Library/Preferences/AutoAlerts/"); BOOL isSpringBoard = [[NSBundle mainBundle].bundleIdentifier isEqual:@"com.apple.springboard"]; diff --git a/AutoAlerts.h b/AutoAlerts.h index add85ae..f670f52 100644 --- a/AutoAlerts.h +++ b/AutoAlerts.h @@ -1,5 +1,6 @@ #import "Model/AAAlertInfo.h" #import "AAConfigurationViewControllerDelegate.h" +#import @interface UIAlertController () diff --git a/Makefile b/Makefile index 7f67b13..8eff402 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ -include $(THEOS)/makefiles/common.mk +export THEOS_PACKAGE_SCHEME = rootless +export ARCHS = arm64 arm64e +export TARGET = iphone:14.5:14.0 +export GO_EASY_ON_ME = 1 +export COPYFILE_DISABLE=1 -ARCHS = arm64 arm64e +include $(THEOS)/makefiles/common.mk TWEAK_NAME = AutoAlerts AutoAlerts_FILES = Tweak.xm AAConfigurationViewController.xm AAAppIconCell.m Model/AAAlertInfo.m AACoreDataStack.m AAAlertManager.m diff --git a/Model/AAAlertInfo.h b/Model/AAAlertInfo.h index 023b33c..5312a55 100644 --- a/Model/AAAlertInfo.h +++ b/Model/AAAlertInfo.h @@ -1,3 +1,5 @@ +#import + @interface AAAlertInfo: NSObject @property (nonatomic, retain) NSArray *actions; diff --git a/Tweak.xm b/Tweak.xm index ce69427..58813f1 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -1,6 +1,7 @@ #import "AutoAlerts.h" #import "AAConfigurationViewController.h" #import "AAAlertManager.h" +#import extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void); @@ -292,15 +293,8 @@ static void *sbObserver = NULL; %ctor { BOOL isSpringBoard = [[NSBundle mainBundle].bundleIdentifier isEqual:@"com.apple.springboard"]; - if (isSpringBoard) { - NSUserDefaults *defaults = [[[NSUserDefaults alloc] initWithSuiteName:@"com.shiftcmdk.autoalertspreferences"] autorelease]; - - autoAlertsEnabled = [defaults objectForKey:@"enabled"] == nil || [defaults boolForKey:@"enabled"]; - } else { - NSDictionary *prefsDict = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.shiftcmdk.autoalertspreferences.plist"]; - - autoAlertsEnabled = !prefsDict || [prefsDict objectForKey:@"enabled"] == nil || [[prefsDict objectForKey:@"enabled"] boolValue]; - } + NSDictionary *prefsDict = [NSDictionary dictionaryWithContentsOfFile:ROOT_PATH_NS(@"/var/mobile/Library/Preferences/com.shiftcmdk.autoalertspreferences.plist")]; + autoAlertsEnabled = !prefsDict || [prefsDict objectForKey:@"enabled"] == nil || [[prefsDict objectForKey:@"enabled"] boolValue]; [[AAAlertManager sharedManager] initialize]; diff --git a/control b/control index b46ea9b..5f8f91b 100644 --- a/control +++ b/control @@ -1,10 +1,10 @@ Package: com.shiftcmdk.autoalerts Name: AutoAlerts Depends: mobilesubstrate -Version: 1.0.2 +Version: 1.0.2-fix Architecture: iphoneos-arm Description: Automate alert actions. -Maintainer: shiftcmdk +Maintainer: mostm Author: shiftcmdk Section: Tweaks Depiction: https://shiftcmdk.github.io/repo/depictions/?p=com.shiftcmdk.autoalerts