-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
executable file
·50 lines (39 loc) · 1.48 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
static UIView *tapView; // The view that acts like the snooze button
static BOOL showBorder = NO; // Used during development only
@interface SBLockScreenFullscreenBulletinViewController : UIViewController
@end
%hook SBLockScreenFullscreenBulletinViewController
- (void)loadView {
%orig;
// Get the view containing the snooze button
UIView *bulletinView = MSHookIvar<UIView *>(self, "_bulletinView");
// Just making the button bigger does not increase the tappable area
// Add a tap view over the whole screen that also initiates snooze
CGSize size = bulletinView.bounds.size;
CGRect frame = CGRectMake(0, 0, size.width, size.height);
[tapView removeFromSuperview];
tapView = nil;
tapView = [[UIView alloc] initWithFrame:frame];
[bulletinView addSubview:tapView];
// Add the gesture recognizer to the view
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTap)];
[tapView addGestureRecognizer:tap];
if (showBorder) {
// Make a border around the tap view to indicate tappable area
// Used during development only
tapView.layer.borderColor = [UIColor whiteColor].CGColor;
tapView.layer.borderWidth = 2.0;
}
}
- (void)viewDidLayoutSubviews {
%orig;
[self.view bringSubviewToFront:tapView];
}
%new
- (void)handleTap {
// Send handleTapGestureFromView: to snooze alarm
UIView *v = MSHookIvar<UIView *>(self, "_bulletinView");
[self performSelector:@selector(handleTapGestureFromView:) withObject:v];
}
%end