-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.x
More file actions
41 lines (32 loc) · 1.26 KB
/
Tweak.x
File metadata and controls
41 lines (32 loc) · 1.26 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
// #import <Cephei/HBPreferences.h>
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.afiq.dtlpreferences.plist"
static BOOL isEnabled;
static void loadPrefs() {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:PLIST_PATH];
isEnabled = [[prefs objectForKey:@"isEnabled"] boolValue];
}
@interface SpringBoard : UIApplication
- (void)_simulateLockButtonPress;
@end
%hook SBIconListView
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (isEnabled) {
if ([[touches anyObject] tapCount] == 2) [(SpringBoard *)[%c(SpringBoard) sharedApplication] _simulateLockButtonPress];
} else {
%orig;
}
}
%end
%ctor{
loadPrefs();
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.afiq.dtlpreferences/ReloadPrefs"), NULL, CFNotificationSuspensionBehaviorCoalesce);
}
// @interface SpringBoard : UIApplication
// - (void)_simulateLockButtonPress;
// @end
// %hook SBIconListView
// - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
// NSLog(@"tapped");
// if ([[touches anyObject] tapCount] == 2) [(SpringBoard *)[%c(SpringBoard) sharedApplication] _simulateLockButtonPress];
// }
// %end