-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTweak.x
27 lines (23 loc) · 887 Bytes
/
Tweak.x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#import <AudioToolbox/AudioToolbox.h>
#import <AudioToolbox/AudioServices.h>
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.thelazyitguy.iconvibeprefs.plist"
NSInteger prefsVariable;
static void loadPrefs() {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:PLIST_PATH];
prefsVariable = [[prefs objectForKey:@"TapticStrength"] intValue];
}
%hook SBIconController
-(void)iconManager:(id)arg1 launchIconForIconView:(id)arg2
{
if(prefsVariable == 1){
AudioServicesPlaySystemSound(1519);
}else if(prefsVariable == 2){
AudioServicesPlaySystemSound(1520);
}
%orig;
}
%end
%ctor{
loadPrefs();
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.thelazyitguy.iconvibeprefs.settingschanged"), NULL, CFNotificationSuspensionBehaviorCoalesce);
}