-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTweak.xm
66 lines (55 loc) · 1.97 KB
/
Tweak.xm
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//Thanks to Tony, without him I would still be lost and smashing my head against my keyboard like an idiot.
#import "spawn.h"
#import "AppList.h"
@interface UIApplication (PrivateMethods)
- (BOOL)launchApplicationWithIdentifier:(NSString *)identifier suspended:(BOOL)suspend;
@end
@interface SBControlCenterController
+(id)sharedInstance;
+(void)presentAnimated:(BOOL)arg1;
@end
#define PLIST_PATH @"/var/mobile/Library/Preferences/com.midnightchips.homehijackpreferences.plist" //Gets Preference bundle settings
inline bool GetPrefBool(NSString *key) {
return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue]; //Looks for bool
}
static NSString *selectedApp; //Applist stuff
static void loadPrefs() {
NSDictionary *prefs = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.midnightchips.homehijackpreferences.plist"];
selectedApp = [prefs objectForKey:@"otherApp"]; //Setting up variables
}
/*%hook SBAssistantController
-(BOOL)isAssistantVisible{
BOOL answer = %orig;
if (answer == YES)
[[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.amazon.echo" suspended:FALSE];
return NO;
}
%end*/
%hook SBAssistantController
-(void)_viewWillAppearOnMainScreen:(BOOL)arg1{
//[[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.amazon.echo" suspended:FALSE];
loadPrefs();
if(GetPrefBool(@"kCC")){
[[%c(SBControlCenterController) sharedInstance] presentAnimated:TRUE];
%orig;
}
else if(selectedApp != nil){
[[UIApplication sharedApplication] launchApplicationWithIdentifier:selectedApp suspended:FALSE];
%orig(NO);
}else{
%orig;
}
}
%end
%hook SBAssistantWindow
-(id)initWithScreen:(id)arg1 layoutStrategy:(id)arg2 debugName:(id)arg3 scene:(id)arg4 {
loadPrefs();
if (selectedApp !=nil) {
return NULL;
}else if(GetPrefBool(@"kCC")){
return NULL;
}else{
return %orig;
}
}
%end