-
Notifications
You must be signed in to change notification settings - Fork 7
/
EmojiPicker.x
74 lines (53 loc) · 2.16 KB
/
EmojiPicker.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
70
71
72
73
74
#import <EmojiLibrary/Header.h>
#import <EmojiLibrary/PSEmojiUtilities.h>
#import <UIKit/UIKeyboardPreferencesController.h>
#import <version.h>
CGFloat scaleFactor = CATEGORIES_COUNT / 6.;
%hook UIKeyboardEmojiCategoryPicker
- (NSString *)symbolForRow:(NSInteger)row {
return ((UIKeyboardEmojiCategory *)[NSClassFromString(@"UIKeyboardEmojiCategory") categoryForType:row]).displaySymbol;
}
- (NSString *)titleForRow:(NSInteger)row {
return ((UIKeyboardEmojiCategory *)[NSClassFromString(@"UIKeyboardEmojiCategory") categoryForType:row]).displayName;
}
%end
%group iOS7Up
%hook UIKeyboardEmojiSplitCharacterPicker
- (id)initWithFrame:(CGRect)frame keyplane:(UIKBTree *)keyplane key:(UIKBTree *)key {
CGRect newFrame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height * scaleFactor);
self = %orig(newFrame, keyplane, key);
return self;
}
%end
%hook UIKeyboardEmojiSplitCategoryPicker
- (id)initWithFrame:(CGRect)frame keyplane:(UIKBTree *)keyplane key:(UIKBTree *)key {
CGRect newFrame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height * scaleFactor);
self = %orig(newFrame, keyplane, key);
return self;
}
- (NSString *)symbolForRow:(NSInteger)row {
NSString *symbol = ((UIKeyboardEmojiCategory *)[NSClassFromString(@"UIKeyboardEmojiCategory") categoryForType:row]).displaySymbol;
CGFloat rivenFactor = [[%c(UIKeyboardPreferencesController) sharedPreferencesController] rivenSizeFactor:1.0];
return [symbol stringByReplacingOccurrencesOfString:@".png" withString:rivenFactor < 1.0 ? @"_split-163r.png" : @"_split.png"];
}
- (NSString *)titleForRow:(NSInteger)row {
return ((UIKeyboardEmojiCategory *)[NSClassFromString(@"UIKeyboardEmojiCategory") categoryForType:row]).displayName;
}
%end
%end
%group iOS6
%hook UIKeyboardEmojiPickerCategoryCell
- (UIFont *)symbolFont {
CGFloat fontSize = [[%c(UIKeyboardPreferencesController) sharedPreferencesController] rivenSizeFactor:25.0];
return [UIFont fontWithName:@"AppleColorEmoji" size:fontSize];
}
%end
%end
%ctor {
%init;
if (IS_IOS_OR_NEWER(iOS_7_0)) {
%init(iOS7Up);
} else {
%init(iOS6);
}
}