This repository has been archived by the owner on Jul 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tweak.xm
115 lines (79 loc) · 1.69 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#import <AppSupport/CPBitmapStore.h>
#import <UIKit/UIKeyboardCache.h>
#import <UIKit/UIKBRenderConfig.h>
#import <UIKit/UIKBRenderFactoryiPhonePasscode.h>
#import <UIKit/UIKBRenderFactoryiPadPasscode.h>
#import <UIKit/UIKBRenderFactoryiPadLandscapePasscode.h>
#pragma mark - Keyboard hooks
BOOL override = NO;
#pragma mark - iPhone
%hook UIKBRenderFactoryiPhone
+ (id)alloc {
if (override) {
override = NO;
return %orig;
} else {
return [%c(UIKBRenderFactoryiPhonePasscode) alloc];
}
}
%end
%hook UIKBRenderFactoryiPad
+ (id)alloc {
return override ? %orig : [%c(UIKBRenderFactoryiPadPasscode) alloc];
}
%end
%hook UIKBRenderFactoryiPadLandscape
+ (id)alloc {
return override ? %orig : [%c(UIKBRenderFactoryiPadLandscapePasscode) alloc];
}
%end
%hook UIKBRenderFactoryiPhonePasscode
+ (id)alloc {
override = YES;
return %orig;
}
%end
%hook UIKBRenderFactoryiPadPasscode
+ (id)alloc {
override = YES;
return %orig;
}
%end
%hook UIKBRenderFactoryiPadLandscapePasscode
+ (id)alloc {
override = YES;
return %orig;
}
%end
#pragma mark - Render config
/*
this is one of those "i don't know why it works but it works" things.
*/
%hook UIKBRenderConfig
+ (UIKBRenderConfig *)darkConfig {
return [self defaultConfig];
}
- (BOOL)lightKeyboard {
return NO;
}
- (double)keycapOpacity {
return 0.2f;
}
%end
#pragma mark - SpringBoard hooks
%group SpringBoardHooks
%hook SpringBoard
- (void)applicationDidFinishLaunching:(UIApplication *)application {
%orig;
CPBitmapStore *store = MSHookIvar<CPBitmapStore *>([%c(UIKeyboardCache) sharedInstance], "_store");
[store purge];
}
%end
%end
#pragma mark - Constructor
%ctor {
if (IN_SPRINGBOARD) {
%init(SpringBoardHooks);
}
%init;
}