This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTweak.xm
56 lines (46 loc) · 1.42 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
#import <UIKit/UIApplication.h>
#import <UIKit/UIViewController.h>
#import <UIKit/UIViewControllerTransitioning.h>
@interface SFSafariViewController : UIViewController
-(NSURL *)initialURL;
@end
%group main
%hook SFSafariViewController
-(void)viewWillAppear:(BOOL)animated {
NSURL *url = [self initialURL];
NSString *urlStr = [url absoluteString];
if ([urlStr hasPrefix:@"https://twitter.com/account/"]) {
return %orig;
}
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
[self dismissViewControllerAnimated:NO completion:nil];
}
%end
%hook SFInteractiveDismissController
-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
[transitionContext completeTransition:NO];
}
%end
%end
%ctor {
NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
NSArray *excludeBundleIds = @[
@"com.apple.*",
@"me.apptapp.installer",
@"org.coolstar.SileoBeta",
@"org.coolstar.SileoNightly",
@"org.coolstar.SileoStore",
@"xyz.willy.Zebra",
];
for (NSString *bid in excludeBundleIds) {
if ([bid hasSuffix:@"*"]) {
NSString *prefix = [bid substringToIndex:[bid length] - 1];
if ([bundleId hasPrefix:prefix]) {
return;
}
} else if ([bundleId isEqualToString:bid]) {
return;
}
}
%init(main);
}