-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHarlemShakeTVModule.m
71 lines (49 loc) · 1.71 KB
/
HarlemShakeTVModule.m
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#import "HarlemShakeTVModule.h"
/*
This tweak/TVControlCenterModule was created out of boredom and for my good friend David from @thejailbreakhub.
Copyright 2019 J.K. Hayslip (@iKilledAppl3) & ToxicAppl3 INSDC./iKilledAppl3 LLC.
December, 29, 2019 was a fun day for us all!
Anyways enjoy and remember not to spoil yourself!
*/
@implementation HarlemShakeTVModule
+(long long)buttonStyle {
return 1;
}
-(id)contentViewController {
buttonController = (TVSMButtonViewController*)[super contentViewController];
[buttonController setStyle:1];
packageFile = [[self bundle] pathForResource:@"HarlemShake" ofType:@"png"];
theImage = [[UIImage imageWithContentsOfFile:packageFile] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[buttonController setImage:theImage];
return buttonController;
}
-(void)handleAction {
if (!animating) {
lonerView = self.contentViewController.view;
harlemShake = [[VLMHarlemShake alloc] initWithLonerView:lonerView];
}
if (animating) {
return;
}
if (lonerView != nil) {
animating = YES;
}
[harlemShake shakeWithCompletion:^{
animating = NO;
harlemShake = nil;
// We call this so the control center can dismiss after the whole thing finishes animating
TVSMSystemMenuManager *controlCenterMan = [NSClassFromString(@"TVSMSystemMenuManager") sharedInstance];
[controlCenterMan dismissSystemMenu];
}];
}
//Since the VLMHarlemShake class can't use -fobjarc we have to release it manually :/
//We don't want memory leaks!
-(void)dealloc {
[harlemShake release];
[super dealloc];
}
// We return false here so it can be dismissed AFTER the animation has finished;
-(BOOL)dismissAfterAction {
return FALSE;
}
@end