├── LICENSE
├── Makefile
├── README.md
├── Telegrammask.plist
├── Tweak.x
└── control
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 iOS宝藏
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | TARGET = iphone:clang:latest:15.0
2 | ARCHS = arm64 arm64e
3 | INSTALL_TARGET_PROCESSES = Telegram
4 |
5 | include $(THEOS)/makefiles/common.mk
6 | TWEAK_NAME = Telegrammask
7 | $(TWEAK_NAME)_FILES = Tweak.x
8 | $(TWEAK_NAME)_CFLAGS = -fobjc-arc
9 |
10 | include $(THEOS_MAKE_PATH)/tweak.mk
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Telegrammask
2 | 一款将Telegram 伪装计算器页面的插件(A Tweak that disguises Telegram as a calculator app)
3 |
4 | 可越狱可侧载注入,仅适配TG,支持sg、ime,ng第三方。
5 | 默认密码:当前时间(24 小时制),00:05 则为 0005,13:14,则为 1314。
6 | 修改密码:三指双击可自定义密码,退出后台重启后重新进入计算器页面。
7 |
8 | 预览: https://t.me/iparxwy/1371
9 |
--------------------------------------------------------------------------------
/Telegrammask.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Filter
6 |
7 | Bundles
8 |
9 | ph.telegra.Telegraph
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Tweak.x:
--------------------------------------------------------------------------------
1 | // 仅TG及其第三方可用,未适配其他应用,非全局版
2 | // 水平很低,代码很乱,仅供参考~
3 | // iOS宝藏 https://t.me/iosrxwy
4 |
5 | #import
6 | #import
7 | #import
8 |
9 | @interface CalculatorViewController : UIViewController
10 | @property (nonatomic, strong) UILabel *displayLabel;
11 | @property (nonatomic, strong) UILabel *historyLabel;
12 | @property (nonatomic, strong) NSMutableString *currentExpression;
13 | @property (nonatomic, strong) NSMutableString *history;
14 | @property (nonatomic, strong) NSString *customPassword;
15 | @property (nonatomic, assign) BOOL isCustomPasswordEnabled;
16 | @end
17 |
18 | @implementation CalculatorViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 | self.view.backgroundColor = [UIColor blackColor];
23 | self.currentExpression = [NSMutableString stringWithString:@""];
24 | self.history = [NSMutableString stringWithString:@""];
25 |
26 | // 读取保存的自定义密码
27 | self.customPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"customPassword"];
28 | self.isCustomPasswordEnabled = self.customPassword != nil; // 判断是否启用了自定义密码
29 |
30 | // 不显示状态问题自行调整吧
31 | [self setNeedsStatusBarAppearanceUpdate];
32 |
33 | // 计算器历史记录标签
34 | self.historyLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, self.view.bounds.size.width - 40, 80)];
35 | self.historyLabel.text = @"";
36 | self.historyLabel.font = [UIFont systemFontOfSize:20];
37 | self.historyLabel.textColor = [UIColor lightGrayColor];
38 | self.historyLabel.numberOfLines = 0;
39 | [self.view addSubview:self.historyLabel];
40 |
41 | self.displayLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 250, self.view.bounds.size.width - 40, 80)];
42 | self.displayLabel.text = @"0";
43 | self.displayLabel.font = [UIFont systemFontOfSize:48];
44 | self.displayLabel.textAlignment = NSTextAlignmentRight;
45 | self.displayLabel.textColor = [UIColor whiteColor];
46 | [self.view addSubview:self.displayLabel];
47 |
48 | // 手势控制,三指双击
49 | UITapGestureRecognizer *threeFingerDoubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showCustomPasswordMenu)];
50 | threeFingerDoubleTap.numberOfTapsRequired = 2;
51 | threeFingerDoubleTap.numberOfTouchesRequired = 3;
52 | [self.view addGestureRecognizer:threeFingerDoubleTap];
53 |
54 | UITapGestureRecognizer *twoFingerDoubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideCustomPasswordMenu)];
55 | twoFingerDoubleTap.numberOfTapsRequired = 2;
56 | twoFingerDoubleTap.numberOfTouchesRequired = 2;
57 | [self.view addGestureRecognizer:twoFingerDoubleTap];
58 |
59 | [self setupButtons];
60 | }
61 |
62 | - (void)setupButtons {
63 | NSArray *buttons = @[
64 | @[@"C", @"(", @")", @"/"],
65 | @[@"7", @"8", @"9", @"*"],
66 | @[@"4", @"5", @"6", @"-"],
67 | @[@"1", @"2", @"3", @"+"],
68 | @[@"0", @".", @"="]
69 | ];
70 |
71 | CGFloat buttonWidth = (self.view.bounds.size.width - 100) / 4;
72 | CGFloat buttonHeight = 70;
73 | CGFloat yOffset = self.view.bounds.size.height - 5 * buttonHeight - 160;
74 |
75 | for (int row = 0; row < buttons.count; row++) {
76 | NSArray *rowButtons = buttons[row];
77 | for (int col = 0; col < rowButtons.count; col++) {
78 | NSString *title = rowButtons[col];
79 | UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
80 |
81 | if ([title isEqualToString:@"0"]) {
82 | button.frame = CGRectMake(20, yOffset + row * (buttonHeight + 20), buttonWidth * 2 + 20, buttonHeight);
83 | button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
84 | button.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
85 | } else if ([title isEqualToString:@"."]) {
86 | button.frame = CGRectMake(20 + 2 * (buttonWidth + 20), yOffset + row * (buttonHeight + 20), buttonWidth, buttonHeight);
87 | } else if ([title isEqualToString:@"="]) {
88 | button.frame = CGRectMake(20 + 3 * (buttonWidth + 20), yOffset + row * (buttonHeight + 20), buttonWidth, buttonHeight);
89 | } else {
90 | button.frame = CGRectMake(20 + col * (buttonWidth + 20), yOffset + row * (buttonHeight + 20), buttonWidth, buttonHeight);
91 | }
92 |
93 | [button setTitle:title forState:UIControlStateNormal];
94 | button.titleLabel.font = [UIFont systemFontOfSize:28];
95 |
96 | if ([title isEqualToString:@"="]) {
97 | button.backgroundColor = [UIColor systemRedColor];
98 | [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
99 | } else if ([title isEqualToString:@"+"] || [title isEqualToString:@"-"] || [title isEqualToString:@"*"] || [title isEqualToString:@"/"]) {
100 | button.backgroundColor = [UIColor systemGreenColor];
101 | [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
102 | } else {
103 | button.backgroundColor = [UIColor colorWithWhite:0.2 alpha:1];
104 | [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
105 | }
106 |
107 | button.layer.cornerRadius = buttonHeight / 2;
108 | button.layer.masksToBounds = YES;
109 | [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
110 | [self.view addSubview:button];
111 | }
112 | }
113 | }
114 |
115 | - (void)buttonTapped:(UIButton *)sender {
116 | NSString *title = sender.titleLabel.text;
117 |
118 | title = [title stringByReplacingOccurrencesOfString:@"(" withString:@"("];
119 | title = [title stringByReplacingOccurrencesOfString:@")" withString:@")"];
120 |
121 | if ([title isEqualToString:@"="]) {
122 | if (self.currentExpression.length == 0) {
123 | self.displayLabel.text = @"0";
124 | return;
125 | }
126 |
127 | NSString *result = [self calculateExpression:self.currentExpression];
128 | if ([result isEqualToString:@"iOS宝藏:别乱玩哦~"]) {
129 | self.displayLabel.font = [UIFont systemFontOfSize:18];
130 | } else {
131 | self.displayLabel.font = [UIFont systemFontOfSize:48];
132 | }
133 |
134 | self.displayLabel.text = result;
135 |
136 | NSString *historyEntry = [NSString stringWithFormat:@"%@ = %@", self.currentExpression, result];
137 | [self.history appendFormat:@"%@\n", historyEntry];
138 | self.historyLabel.text = self.history;
139 | self.currentExpression = [NSMutableString stringWithString:result];
140 | } else if ([title isEqualToString:@"C"]) {
141 | self.currentExpression = [NSMutableString stringWithString:@""];
142 | self.displayLabel.text = @"0";
143 | self.historyLabel.text = @"";
144 | self.displayLabel.font = [UIFont systemFontOfSize:48];
145 | } else {
146 | [self.currentExpression appendString:title];
147 | self.displayLabel.text = self.currentExpression;
148 | self.displayLabel.font = [UIFont systemFontOfSize:48];
149 | }
150 |
151 | NSString *currentPassword = [self getCurrentPassword];
152 | if ([self.currentExpression isEqualToString:currentPassword]) {
153 | [self hideCalculatorView];
154 | }
155 | }
156 |
157 | - (NSString *)calculateExpression:(NSString *)expression {
158 | @try {
159 | NSString *floatExpression = [expression stringByReplacingOccurrencesOfString:@"/" withString:@".0/"];
160 | floatExpression = [floatExpression stringByReplacingOccurrencesOfString:@"*" withString:@".0*"];
161 |
162 | // 使用 NSExpression 进行运算
163 | NSExpression *exp = [NSExpression expressionWithFormat:floatExpression];
164 | id result = [exp expressionValueWithObject:nil context:nil];
165 |
166 | if ([result isKindOfClass:[NSNumber class]]) {
167 | NSNumber *numberResult = (NSNumber *)result;
168 | double doubleResult = numberResult.doubleValue;
169 | if (fmod(doubleResult, 1) == 0) {
170 | return [NSString stringWithFormat:@"%.0f", doubleResult]; // 如果是整数
171 | } else {
172 | return [NSString stringWithFormat:@"%.2f", round(doubleResult * 100) / 100]; // 小数保留两位
173 | }
174 | }
175 | return [NSString stringWithFormat:@"%@", result];
176 | } @catch (NSException *exception) {
177 | return @"iOS宝藏:别乱玩哦~"; // 错误提示
178 | }
179 | }
180 |
181 | - (NSString *)getCurrentPassword {
182 | if (self.isCustomPasswordEnabled && self.customPassword) {
183 | return self.customPassword;
184 | } else {
185 | return [self getCurrentTimePassword];
186 | }
187 | }
188 |
189 | - (NSString *)getCurrentTimePassword {
190 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
191 | [formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
192 | [formatter setDateFormat:@"HHmm"];
193 | NSString *currentTime = [formatter stringFromDate:[NSDate date]];
194 | return currentTime;
195 | }
196 |
197 | - (void)hideCalculatorView {
198 | [self.view removeFromSuperview];
199 | UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
200 | for (UIView *subview in keyWindow.subviews) {
201 | if ([subview isKindOfClass:[CalculatorViewController class]]) {
202 | [subview removeFromSuperview];
203 | }
204 | }
205 | keyWindow.hidden = YES;
206 | }
207 |
208 | // 显示自定义密码设置窗口
209 | - (void)showCustomPasswordMenu {
210 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"iOS宝藏"
211 | message:nil
212 | preferredStyle:UIAlertControllerStyleActionSheet];
213 |
214 | UIAlertAction *setCustomPasswordAction = [UIAlertAction actionWithTitle:@"自定义密码" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
215 | [self verifyCurrentPasswordBeforeSetting];
216 | }];
217 |
218 | UIAlertAction *changePasswordAction = [UIAlertAction actionWithTitle:@"关闭自定义" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
219 | [self verifyCurrentPasswordBeforeDisabling];
220 | }];
221 |
222 | UIAlertAction *morePluginsAction = [UIAlertAction actionWithTitle:@"更多插件" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
223 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tg://resolve?domain=iosrxwy"] options:@{} completionHandler:nil];
224 | }];
225 |
226 | UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
227 |
228 | [alert addAction:setCustomPasswordAction];
229 | [alert addAction:changePasswordAction];
230 | [alert addAction:morePluginsAction];
231 | [alert addAction:cancelAction];
232 |
233 | [self presentViewController:alert animated:YES completion:nil];
234 | }
235 |
236 | // 先验证当前密码,然后设置新密码
237 | - (void)verifyCurrentPasswordBeforeSetting {
238 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"请输入当前密码"
239 | message:nil
240 | preferredStyle:UIAlertControllerStyleAlert];
241 |
242 | [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
243 | textField.placeholder = @"当前密码";
244 | textField.secureTextEntry = YES;
245 | }];
246 |
247 | UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
248 | NSString *inputPassword = alert.textFields[0].text;
249 | if ([inputPassword isEqualToString:[self getCurrentPassword]]) {
250 | [self setCustomPassword];
251 | } else {
252 | [self showError:@"密码不正确"];
253 | }
254 | }];
255 |
256 | UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
257 |
258 | [alert addAction:confirmAction];
259 | [alert addAction:cancelAction];
260 |
261 | [self presentViewController:alert animated:YES completion:nil];
262 | }
263 |
264 | // 设置新密码并保存到NSUserDefaults
265 | - (void)setCustomPassword {
266 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"设置自定义密码"
267 | message:@"请输入新密码"
268 | preferredStyle:UIAlertControllerStyleAlert];
269 |
270 | [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
271 | textField.placeholder = @"新密码";
272 | textField.secureTextEntry = YES;
273 | }];
274 |
275 | [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
276 | textField.placeholder = @"再次输入新密码";
277 | textField.secureTextEntry = YES;
278 | }];
279 |
280 | UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
281 | NSString *newPassword = alert.textFields[0].text;
282 | NSString *confirmPassword = alert.textFields[1].text;
283 | if ([newPassword isEqualToString:confirmPassword]) {
284 | self.customPassword = newPassword;
285 | self.isCustomPasswordEnabled = YES;
286 |
287 | // 保存自定义密码到NSUserDefaults
288 | [[NSUserDefaults standardUserDefaults] setObject:self.customPassword forKey:@"customPassword"];
289 | [[NSUserDefaults standardUserDefaults] synchronize];
290 |
291 | [self showSuccess:@"自定义密码已设置"];
292 | } else {
293 | [self showError:@"两次密码不一致"];
294 | }
295 | }];
296 |
297 | UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
298 |
299 | [alert addAction:confirmAction];
300 | [alert addAction:cancelAction];
301 |
302 | [self presentViewController:alert animated:YES completion:nil];
303 | }
304 |
305 | // 验证当前密码然后关闭自定义密码
306 | - (void)verifyCurrentPasswordBeforeDisabling {
307 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"输入当前密码"
308 | message:nil
309 | preferredStyle:UIAlertControllerStyleAlert];
310 |
311 | [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
312 | textField.placeholder = @"当前密码";
313 | textField.secureTextEntry = YES;
314 | }];
315 |
316 | UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
317 | NSString *inputPassword = alert.textFields[0].text;
318 | if ([inputPassword isEqualToString:[self getCurrentPassword]]) {
319 | self.isCustomPasswordEnabled = NO;
320 | self.customPassword = nil;
321 |
322 | // 移除保存的自定义密码
323 | [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"customPassword"];
324 | [[NSUserDefaults standardUserDefaults] synchronize];
325 |
326 | [self showSuccess:@"自定义密码已关闭"];
327 | } else {
328 | [self showError:@"密码不正确"];
329 | }
330 | }];
331 |
332 | UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
333 |
334 | [alert addAction:confirmAction];
335 | [alert addAction:cancelAction];
336 |
337 | [self presentViewController:alert animated:YES completion:nil];
338 | }
339 |
340 | - (void)showSuccess:(NSString *)message {
341 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"成功"
342 | message:message
343 | preferredStyle:UIAlertControllerStyleAlert];
344 | UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
345 | [alert addAction:okAction];
346 | [self presentViewController:alert animated:YES completion:nil];
347 | }
348 |
349 | - (void)showError:(NSString *)errorMessage {
350 | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"错误"
351 | message:errorMessage
352 | preferredStyle:UIAlertControllerStyleAlert];
353 |
354 | UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
355 |
356 | [alert addAction:okAction];
357 |
358 | [self presentViewController:alert animated:YES completion:nil];
359 | }
360 |
361 | - (void)hideCustomPasswordMenu {
362 | [self dismissViewControllerAnimated:YES completion:nil];
363 | }
364 |
365 | @end
366 |
367 | CHDeclareClass(AppDelegate)
368 |
369 | CHOptimizedMethod(2, self, BOOL, AppDelegate, application, UIApplication *, application, didFinishLaunchingWithOptions, NSDictionary *, launchOptions) {
370 | CHSuper(2, AppDelegate, application, application, didFinishLaunchingWithOptions, launchOptions);
371 |
372 | CalculatorViewController *calculatorVC = [[CalculatorViewController alloc] init];
373 | UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
374 |
375 | window.windowLevel = UIWindowLevelAlert + 999; // 其他应用自测吧,这里是为了保证最上层
376 | window.rootViewController = calculatorVC;
377 | [window makeKeyAndVisible];
378 |
379 | [UIApplication sharedApplication].delegate.window = window;
380 | return YES;
381 | }
382 |
383 | CHConstructor {
384 | CHLoadLateClass(AppDelegate);
385 | CHClassHook(2, AppDelegate, application, didFinishLaunchingWithOptions);
386 | }
387 |
388 | // 移除分割线 by level3tjg
389 |
390 | @interface ASDisplayNode : NSObject
391 | @property id supernode;
392 | - (BOOL)isSeparatorNode;
393 | @end
394 |
395 | @interface CALayer (AsyncDisplayKit)
396 | @property ASDisplayNode *asyncdisplaykit_node;
397 | @end
398 |
399 | %hook CALayer
400 | - (void)setBackgroundColor:(CGColorRef)color {
401 | if ([self.asyncdisplaykit_node isSeparatorNode])
402 | color = UIColor.clearColor.CGColor;
403 | %orig;
404 | }
405 | %end
406 |
407 | %hook ASDisplayNode
408 | %new
409 | - (BOOL)isSeparatorNode {
410 | for (NSString *name in @[
411 | @"separatorNode",
412 | @"topSeparatorNode",
413 | @"bottomSeparatorNode",
414 | @"topStripeNode",
415 | @"bottomStripeNode"
416 | ]) {
417 | if ([self isEqual:object_getIvar(self.supernode, class_getInstanceVariable(object_getClass(self.supernode), name.UTF8String))]) {
418 | return YES;
419 | }
420 | }
421 | return NO;
422 | }
423 | %end
424 |
425 | // 原生键盘暗黑增强 by dayanch96
426 |
427 | @interface UIView (Private)
428 | @property (nonatomic, assign, readonly) BOOL _mapkit_isDarkModeEnabled;
429 |
430 | - (UIViewController *)_viewControllerForAncestor;
431 | @end
432 |
433 | static BOOL isDarkMode(UIView *view) {
434 | if ([view respondsToSelector:@selector(_mapkit_isDarkModeEnabled)]) {
435 | return view._mapkit_isDarkModeEnabled;
436 | }
437 |
438 | return view._viewControllerForAncestor.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark;
439 | }
440 |
441 | @interface UIKeyboard : UIView // Regular keyboard
442 | + (instancetype)activeKeyboard;
443 | @end
444 |
445 | %hook UIKeyboard
446 | - (void)displayLayer:(id)arg1 {
447 | %orig;
448 |
449 | self.backgroundColor = isDarkMode(self) ? [UIColor blackColor] : [UIColor clearColor];
450 | }
451 | %end
452 |
453 | @interface UIPredictionViewController : UIViewController // Keyboard with enabled predictions panel
454 | @end
455 |
456 | %hook UIPredictionViewController
457 | - (id)_currentTextSuggestions {
458 | UIKeyboard *keyboard = [%c(UIKeyboard) activeKeyboard];
459 |
460 | if (isDarkMode(keyboard)) {
461 | [self.view setBackgroundColor:[UIColor blackColor]];
462 | keyboard.backgroundColor = [UIColor blackColor];
463 | } else {
464 | [self.view setBackgroundColor:[UIColor clearColor]];
465 | keyboard.backgroundColor = [UIColor clearColor];
466 | }
467 |
468 | return %orig;
469 | }
470 | %end
471 |
472 | @interface UIKeyboardDockView : UIView // Dock under keyboard for notched devices
473 | @end
474 |
475 | %hook UIKeyboardDockView
476 | - (void)layoutSubviews {
477 | %orig;
478 |
479 | self.backgroundColor = isDarkMode(self) ? [UIColor blackColor] : [UIColor clearColor];
480 | }
481 | %end
482 |
483 | %hook UIInputView
484 | - (void)layoutSubviews {
485 | %orig;
486 |
487 | if ([self isKindOfClass:NSClassFromString(@"TUIEmojiSearchInputView")] // Emoji searching panel
488 | || [self isKindOfClass:NSClassFromString(@"_SFAutoFillInputView")]) { // Autofill password
489 | self.backgroundColor = isDarkMode(self) ? [UIColor blackColor] : [UIColor clearColor];
490 | }
491 | }
492 | %end
493 |
494 | @interface UIKBVisualEffectView : UIVisualEffectView
495 | @property (nonatomic, copy, readwrite) NSArray *backgroundEffects;
496 | @end
497 |
498 | %hook UIKBVisualEffectView
499 | - (void)layoutSubviews {
500 | %orig;
501 |
502 | if (isDarkMode(self)) {
503 | self.backgroundEffects = nil;
504 | self.backgroundColor = [UIColor blackColor];
505 | }
506 | }
507 | %end
508 |
--------------------------------------------------------------------------------
/control:
--------------------------------------------------------------------------------
1 | Package: com.iosrxwy.Telegrammask
2 | Name: Telegrammask
3 | Version: 0.1-4
4 | Description: TG伪装计算器插件,密码为当前时间,如13:14密码为1314,00:56密码为56,24小时制为准。三指双击可自定义密码。新增level3tjg的移除界面分割线,dayanch96的系统键盘暗黑增强。
5 | Section: Tweaks
6 | Depends: firmware (>= 5.0), mobilesubstrate
7 | Priority: optional
8 | Author: iosrxwy
9 | Architecture: iphoneos-arm64
10 |
--------------------------------------------------------------------------------