Skip to content

Commit 7a058bb

Browse files
committed
Drop Activator dependency
1 parent 58d6a41 commit 7a058bb

File tree

3 files changed

+27
-56
lines changed

3 files changed

+27
-56
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ IMPORTS = -I$(FLEX_ROOT)/Classes/ $(call dtoim, $(_IMPORTS))
1717
TWEAK_NAME = FLEXing
1818
FLEXing_FRAMEWORKS = CoreGraphics UIKit ImageIO QuartzCore
1919
FLEXing_FILES = Tweak.xm $(SOURCES)
20-
FLEXing_LIBRARIES = sqlite3 z activator objcipc
20+
FLEXing_LIBRARIES = sqlite3 z #objcipc #activator
2121
FLEXing_CFLAGS += -fobjc-arc -w $(IMPORTS)
2222

2323
include $(THEOS_MAKE_PATH)/tweak.mk

Tweak.xm

Lines changed: 25 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,67 +9,38 @@
99

1010
#import "Interfaces.h"
1111

12-
13-
@interface FLEXingActivatorListenerInstance : NSObject <LAListener>
14-
@end
15-
16-
@implementation FLEXingActivatorListenerInstance
17-
18-
- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event forListenerName:(NSString *)listenerName {
19-
NSString *frontmostAppID = [(SpringBoard *)[UIApplication sharedApplication] _accessibilityFrontMostApplication].bundleIdentifier;
12+
UIView * AddGestures(UIView *view) {
13+
id flex = [FLEXManager sharedManager];
14+
SEL show = @selector(showExplorer);
15+
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:flex action:show];
16+
tap.numberOfTapsRequired = 2;
17+
tap.numberOfTouchesRequired = 2;
2018

21-
if ([listenerName isEqualToString:kFLEXingShow] ){
22-
if (frontmostAppID) {
23-
[OBJCIPC sendMessageToAppWithIdentifier:frontmostAppID messageName:kFLEXingShow dictionary:nil replyHandler:^(NSDictionary *response) {
24-
event.handled = YES;
25-
}];
26-
} else {
27-
[[FLEXManager sharedManager] showExplorer];
28-
event.handled = YES;
29-
}
30-
}
31-
else if ([listenerName isEqualToString:kFLEXingToggle]) {
32-
if (frontmostAppID) {
33-
[OBJCIPC sendMessageToAppWithIdentifier:frontmostAppID messageName:kFLEXingToggle dictionary:nil replyHandler:^(NSDictionary *response) {
34-
event.handled = YES;
35-
}];
36-
} else {
37-
[[FLEXManager sharedManager] toggleExplorer];
38-
event.handled = YES;
39-
}
40-
} else {
41-
event.handled = NO;
42-
}
43-
}
19+
UILongPressGestureRecognizer *tap2 = [[UILongPressGestureRecognizer alloc] initWithTarget:flex action:show];
20+
tap2.minimumPressDuration = .5;
21+
tap2.numberOfTouchesRequired = 3;
22+
23+
[view addGestureRecognizer:tap];
24+
[view addGestureRecognizer:tap2];
4425

45-
@end
26+
return view;
27+
}
4628

29+
%group NoActivator
30+
%hook UIWindow
31+
- (id)initWithFrame:(CGRect)frame {
32+
return AddGestures(%orig(frame));
33+
}
4734

48-
%hook UIApplication
35+
%end
36+
%end
4937

50-
- (id)init {
51-
// Register activator handlers in springboard
38+
%ctor {
39+
%init(NoActivator);
5240
if ([[NSBundle mainBundle].bundleIdentifier isEqualToString:@"com.apple.springboard"]) {
53-
FLEXingActivatorListenerInstance *FLEXALI = [FLEXingActivatorListenerInstance new];
54-
[[LAActivator sharedInstance] registerListener:FLEXALI forName:kFLEXingShow];
55-
[[LAActivator sharedInstance] registerListener:FLEXALI forName:kFLEXingToggle];
56-
} else if (NSClassFromString(@"OBJCIPC")) {
57-
58-
// Register message handlers
59-
[OBJCIPC registerIncomingMessageFromSpringBoardHandlerForMessageName:kFLEXingShow handler:^NSDictionary *(NSDictionary *message) {
41+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
6042
[[FLEXManager sharedManager] showExplorer];
61-
return nil;
62-
}];
43+
});
6344

64-
[OBJCIPC registerIncomingMessageFromSpringBoardHandlerForMessageName:kFLEXingToggle handler:^NSDictionary *(NSDictionary *message) {
65-
[[FLEXManager sharedManager] toggleExplorer];
66-
return nil;
67-
}];
68-
} else {
69-
NSLog(@"FLEXing: OBJCIPC class not found");
7045
}
71-
72-
return %orig;
7346
}
74-
75-
%end

control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: com.pantsthief.flexing
22
Name: FLEXing
33
Pre-Depends: firmware (>= 8.0)
4-
Depends: mobilesubstrate, libactivator, cc.tweak.libobjcipc
4+
Depends:
55
Version: 0.0.5
66
Architecture: iphoneos-arm
77
Description: Open FLEX anywhere with Activator!

0 commit comments

Comments
 (0)