-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathTemplate.x.example
62 lines (46 loc) · 1.49 KB
/
Template.x.example
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
#import "../YTVideoOverlay/Header.h"
#import "../YTVideoOverlay/Init.x"
#define TweakKey "TweakKey"
@interface YTInlinePlayerBarContainerView (Tweak)
- (void)didPressTweak:(id)arg;
@end
@interface YTMainAppControlsOverlayView (Tweak)
- (void)didPressTweak:(id)arg;
@end
%group Top
%hook YTMainAppControlsOverlayView
// Remove this method if your button is a text button
- (UIImage *)buttonImage:(NSString *)tweakId {
return [tweakId isEqualToString:TweakKey] ? <Your Tweak Button Image> : %orig;
}
%new(v@:@)
- (void)didPressTweak:(id)arg {
// Do stuff
[self.overlayButtons[TweakKey] setImage:<Another Tweak Button Image> forState:0];
}
%end
%end
%group Bottom
%hook YTInlinePlayerBarContainerView
// Remove this method if your button is a text button
- (UIImage *)buttonImage:(NSString *)tweakId {
return [tweakId isEqualToString:TweakKey] ? <Your Tweak Button Image> : %orig;
}
%new(v@:@)
- (void)didPressTweak:(id)arg {
// Do stuff
[self.overlayButtons[TweakKey] setImage:<Another Tweak Button Image> forState:0];
}
%end
%end
%ctor {
initYTVideoOverlay(TweakKey, @{
AccessibilityLabelKey: @"Tweak",
SelectorKey: @"didPressTweak:",
// AsTextKey: @YES, // If yes, the button is rendered as a text button
// ToggleKey: @YES, // If yes, the toggle setting is hidden from YTVideoOverlay settings
// UpdateImageOnVisibleKey: @YES, // If yes, the button image is assigned again when the button is visible
});
%init(Top);
%init(Bottom);
}