-
Notifications
You must be signed in to change notification settings - Fork 7
/
EmojiHUDSupport.x
69 lines (57 loc) · 1.45 KB
/
EmojiHUDSupport.x
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
#import <EmojiLibrary/PSEmojiUtilities.h>
#import "EmojiHUD.h"
BOOL from;
NSTimer *__showHUD;
UIKeyboardEmojiView *_emojiView;
void clearTimer() {
if (__showHUD) {
[__showHUD invalidate];
__showHUD = nil;
}
}
%hook UIKeyboardEmojiPage
%new
- (void)_showHUD {
if (EmojiHUD.sharedInstance.showing)
[EmojiHUD.sharedInstance hide];
else {
from = YES;
[self touchCancelled:[self activeTouch]];
from = NO;
[EmojiHUD.sharedInstance showWithEmojiView:_emojiView];
}
}
- (void)setOnDisplay:(UIKeyboardEmojiView *)emojiView {
%orig;
if (emojiView) {
BOOL supportsSkin = emojiView.emoji.supportsSkin;
if (!supportsSkin)
return;
_emojiView = emojiView;
if (!EmojiHUD.sharedInstance.showing) {
__showHUD = [NSTimer scheduledTimerWithTimeInterval:EmojiHUDHoldInterval target:self selector:@selector(_showHUD) userInfo:nil repeats:NO];
[__showHUD retain];
} else {
[EmojiHUD.sharedInstance hide];
}
} else {
if (EmojiHUD.sharedInstance.showing && !from)
[EmojiHUD.sharedInstance hide];
clearTimer();
}
}
- (void)touchEnded:(id)arg1 {
%orig;
clearTimer();
}
- (void)dealloc {
[EmojiHUD.sharedInstance hide];
%orig;
}
%end
%hook UIKeyboardEmojiCategoryBar
- (void)touchesBegan:(id)arg1 withEvent:(id)arg2 {
[EmojiHUD.sharedInstance hide];
%orig;
}
%end