-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.xm
32 lines (25 loc) · 922 Bytes
/
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
#import <AppList/AppList.h>
@interface UIApplication (Undocumented)
-(void)launchApplicationWithIdentifier:(NSString*)identifier suspended:(BOOL)suspended;
@end
@interface BluetoothManager : NSObject
-(BOOL)connected;
@end
%hook BluetoothManager
-(void)_connectedStatusChanged {
%orig;
if ([self connected]) {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.idevicehacked.bluelaunch.plist"] ? : [NSMutableDictionary new];
NSString* selectedApp = nil;
for (NSString *key in [prefs allKeys]) {
if (![prefs[key] boolValue]) continue;
selectedApp = key;
}
if (selectedApp) {
%orig;
NSLog(@"BlueLaunch App Launched");
[[UIApplication sharedApplication] launchApplicationWithIdentifier:selectedApp suspended:NO];
}
}
}
%end