-
Notifications
You must be signed in to change notification settings - Fork 8
/
Tweak.x
55 lines (44 loc) · 1.17 KB
/
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
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
#import <dlfcn.h>
#import <UIKit/UIKit.h>
#include <notify.h>
#include <objc/message.h>
#import "FLEXManager.h"
@interface UIStatusBarWindow : UIWindow @end
__attribute__((visibility("hidden")))
@interface AutoFLEX : NSObject {
@private
}
@end
@implementation AutoFLEX
+ (instancetype)sharedInstance
{
static AutoFLEX *_sharedFactory;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedFactory = [[self alloc] init];
});
return _sharedFactory;
}
- (id)init
{
self = [super init];
return self;
}
-(void)inject {
NSLog(@"Openning explorer: %@", [FLEXManager sharedManager]);
[[FLEXManager sharedManager] showExplorer];
}
@end
%hook UIStatusBarWindow
- (id)initWithFrame:(CGRect)frame {
self = %orig;
[self addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(inject:)]];
return self;
}
-(void) inject: (UILongPressGestureRecognizer*)lges {
[[FLEXManager sharedManager] showExplorer];
}
%end
%ctor {
[[NSNotificationCenter defaultCenter] addObserver:[AutoFLEX sharedInstance] selector:@selector(inject) name:UIApplicationDidBecomeActiveNotification object:nil];
}