-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.xmi
578 lines (457 loc) · 17.7 KB
/
Tweak.xmi
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
/*
_______ _______ _ _________ _______ _______ _______
( ____ \( ____ \( \ \__ __/( ____ )( ____ \( ____ \
| ( \/| ( \/| ( ) ( | ( )|| ( \/| ( \/
| (__ | | | | | | | (____)|| (_____ | (__
| __) | | | | | | | _____)(_____ )| __)
| ( | | | | | | | ( ) || (
| (____/\| (____/\| (____/\___) (___| ) /\____) || (____/\
(_______/(_______/(_______/\_______/|/ \_______)(_______/
NIGHT MODE FOR IOS - Initializer
COPYRIGHT © 2018 GUILLERMO MORAN
*/
// static NSString* darkSafariJS = @"document.getElementsByTagName('*')[0].style.webkitTextFillColor='#F4F4F4'; var x = document.getElementsByTagName('*');var i; for (i = 0; i < x.length; i++) {x[i].style.backgroundColor = '#141414';};";
static NSString* darkCydiaJS = @"var x = document.getElementsByTagName('*');var i; for (i = 0; i < x.length; i++) {x[i].style.backgroundColor = 'transparent';x[i].style.borderColor = '#222222';};document.getElementsByTagName('*')[0].style.webkitTextFillColor='#F4F4F4';document.getElementsByTagName('body')[0].style.backgroundColor='#transparent';";
static NSString* darkSafariJS = @"var x = document.getElementsByTagName('*');var i; for (i = 0; i < x.length; i++) {x[i].style.backgroundColor = '#141414';x[i].style.borderColor = '#222222';};document.getElementsByTagName('*')[0].style.webkitTextFillColor='#F4F4F4';document.getElementsByTagName('body')[0].style.backgroundColor='#141414';";
#import <objc/runtime.h>
#import "Utils/Interfaces.h"
#import "Utils/UIColor+Eclipse.h"
#import "Utils/UIImage+Eclipse.h"
#include <notify.h>
#include "Utils/Filters.xm"
/*
d8888b. d8888b. d88888b d88888b .d8888.
88 `8D 88 `8D 88' 88' 88' YP
88oodD' 88oobY' 88ooooo 88ooo `8bo.
88~~~ 88`8b 88~~~~~ 88~~~ `Y8b.
88 88 `88. 88. 88 db 8D
88 88 YD Y88888P YP `8888Y'
*/
#include "Utils/Preferences.xm"
%group AppTerminator
#include "Utils/AppTerminator.xm"
%end
/*
.d8b. db d88888b d8888b. d888888b .d8888.
d8' `8b 88 88' 88 `8D `~~88~~' 88' YP
88ooo88 88 88ooooo 88oobY' 88 `8bo.
88~~~88 88 88~~~~~ 88`8b 88 `Y8b.
88 88 88booo. 88. 88 `88. 88 db 8D
YP YP Y88888P Y88888P 88 YD YP `8888Y'
*/
#include "UIKit/Alerts.xm"
/*
d8b db .d8b. db db d888888b d888888b d88888b .88b d88. .d8888.
888o 88 d8' `8b 88 88 `88' `~~88~~' 88' 88'YbdP`88 88' YP
88V8o 88 88ooo88 Y8 8P 88 88 88ooooo 88 88 88 `8bo.
88 V8o88 88~~~88 `8b d8' 88 88 88~~~~~ 88 88 88 `Y8b.
88 V888 88 88 `8bd8' .88. 88 88. 88 88 88 db 8D
VP V8P YP YP YP Y888888P YP Y88888P YP YP YP `8888Y'
*/
#include "UIKit/NavItems.xm"
/*
db db d888888b .o88b. .d88b. db .d88b. d8888b.
88 88 `88' d8P Y8 .8P Y8. 88 .8P Y8. 88 `8D
88 88 88 8P 88 88 88 88 88 88oobY'
88 88 88 8b 88 88 88 88 88 88`8b
88b d88 .88. Y8b d8 `8b d8' 88booo. `8b d8' 88 `88.
~Y8888P' Y888888P `Y88P' `Y88P' Y88888P `Y88P' 88 YD
*/
#include "UIKit/UIColorReplacement.xm"
/*
.o88b. .d88b. db db db db d888888b d88888b db d8b db
d8P Y8 .8P Y8. 88 88 88 88 `88' 88' 88 I8I 88
8P 88 88 88 88 Y8 8P 88 88ooooo 88 I8I 88
8b 88 88 88 88 `8b d8' 88 88~~~~~ Y8 I8I 88
Y8b d8 `8b d8' 88booo. 88booo. `8bd8' .88. 88. `8b d8'8b d8'
`Y88P' `Y88P' Y88888P Y88888P YP Y888888P Y88888P `8b8' `8d8'
*/
/*
Collection View in Videos is 0 alpha BGColor. Figure it out, asshole.
%hook UICollectionView
-(void)layoutSubviews {
%orig;
if (isEnabled) {
if (isLightColor(self.backgroundColor) && ![self.backgroundColor isEqual:[UIColor clearColor]] && ![self isKindOfClass:%c(HBFPBackgroundView)]) {
[self setBackgroundColor:VIEW_COLOR];
}
}
}
%end
*/
/*
UIImageView
*/
/*
db db d888888b db db d888888b d88888b db d8b db
88 88 `88' 88 88 `88' 88' 88 I8I 88
88 88 88 Y8 8P 88 88ooooo 88 I8I 88
88 88 88 `8b d8' 88 88~~~~~ Y8 I8I 88
88b d88 .88. `8bd8' .88. 88. `8b d8'8b d8'
~Y8888P' Y888888P YP Y888888P Y88888P `8b8' `8d8'
*/
#include "UIKit/UIView.xm"
/*
d888888b db db d888888b db db d888888b d88888b db d8b db
`~~88~~' `8b d8' `~~88~~' 88 88 `88' 88' 88 I8I 88
88 `8bd8' 88 Y8 8P 88 88ooooo 88 I8I 88
88 .dPYb. 88 `8b d8' 88 88~~~~~ Y8 I8I 88
88 .8P Y8. 88 `8bd8' .88. 88. `8b d8'8b d8'
YP YP YP YP YP Y888888P Y88888P `8b8' `8d8'
*/
#include "UIKit/UITextView.xm"
//Text Caret
%hook UITextSelectionView
-(id)caretViewColor {
if (isEnabled) {
if (_selectedTint == 1) {
return BABY_BLUE_COLOR;
}
else {
return selectedTintColor();
}
}
return %orig;
}
%end
/*
Activity Indicator
*/
#include "UIKit/UIActivityIndicatorView.xm"
/*
d888888b db db d888888b d88888b d888888b d88888b db d8888b.
`~~88~~' `8b d8' `~~88~~' 88' `88' 88' 88 88 `8D
88 `8bd8' 88 88ooo 88 88ooooo 88 88 88
88 .dPYb. 88 88~~~ 88 88~~~~~ 88 88 88
88 .8P Y8. 88 88 .88. 88. 88booo. 88 .8D
YP YP YP YP YP Y888888P Y88888P Y88888P Y8888D'
*/
#include "UIKit/UITextField.xm"
/*
db db d888888b db .d8b. d8888b. d88888b db
88 88 `88' 88 d8' `8b 88 `8D 88' 88
88 88 88 88 88ooo88 88oooY' 88ooooo 88
88 88 88 88 88~~~88 88~~~b. 88~~~~~ 88
88b d88 .88. 88booo. 88 88 88 8D 88. 88booo.
~Y8888P' Y888888P Y88888P YP YP Y8888P' Y88888P Y88888P
*/
#include "UIKit/UILabel.xm"
/*
d888888b .d8b. d8888b. db d88888b
`~~88~~' d8' `8b 88 `8D 88 88'
88 88ooo88 88oooY' 88 88ooooo
88 88~~~88 88~~~b. 88 88~~~~~
88 88 88 88 8D 88booo. 88.
YP YP YP Y8888P' Y88888P Y88888P
*/
#include "UIKit/UITableView.xm"
/*
db dD d88888b db db d8888b. .d88b. .d8b. d8888b. d8888b.
88 ,8P' 88' `8b d8' 88 `8D .8P Y8. d8' `8b 88 `8D 88 `8D
88,8P 88ooooo `8bd8' 88oooY' 88 88 88ooo88 88oobY' 88 88
88`8b 88~~~~~ 88 88~~~b. 88 88 88~~~88 88`8b 88 88
88 `88. 88. 88 88 8D `8b d8' 88 88 88 `88. 88 .8D
YP YD Y88888P YP Y8888P' `Y88P' YP YP 88 YD Y8888D'
*/
#include "UIKit/UIKeyboard.xm"
/*
.d8888. d888888b .d8b. d888888b db db .d8888. d8888b. .d8b. d8888b.
88' YP `~~88~~' d8' `8b `~~88~~' 88 88 88' YP 88 `8D d8' `8b 88 `8D
`8bo. 88 88ooo88 88 88 88 `8bo. 88oooY' 88ooo88 88oobY'
` Y8b. 88 88~~~88 88 88 88 `Y8b. 88~~~b. 88~~~88 88`8b
db 8D 88 88 88 88 88b d88 db 8D 88 8D 88 88 88 `88.
`8888Y' YP YP YP YP ~Y8888P' `8888Y' Y8888P' YP YP 88 YD
*/
#include "UIKit/UIStatusBar.xm"
//LibColorPicker fixes
#include "TweakSupport/LibColorPickerFix.xm"
//System Applications
//Do not group SMS
#include "Application_Support/SMS.xm"
//Do not group Contacts
#include "Application_Support/Contacts.xm"
#include "Application_Support/Phone.xm"
#include "Application_Support/Mail.xm"
#include "Application_Support/Safari.xm"
#include "Application_Support/Passbook.xm"
#include "Application_Support/Reminders.xm"
#include "Application_Support/Music.xm"
#include "Application_Support/Notes.xm"
#include "Application_Support/iTunesStore.xm"
#include "Application_Support/AppStore.xm"
#include "Application_Support/WatchApp.xm"
#include "Application_Support/Calendar.xm"
#include "Application_Support/Maps.xm"
#include "Application_Support/Photos.xm"
#include "Application_Support/Settings.xm"
#include "UIKit/WiFiKit.xm"
// Third Party App Support
#include "Application_Support/WhatsApp.xm"
#include "Application_Support/Instagram.xm"
#include "Application_Support/Twitter.xm"
#include "Application_Support/Kik.xm"
#include "Application_Support/Threema.xm"
#include "Application_Support/Telegram.xm"
#include "Application_Support/Tweetbot.xm"
#include "Application_Support/Tumblr.xm"
#include "Application_Support/Snapchat.xm"
#include "Application_Support/Soundcloud.xm"
#include "Application_Support/FBMessenger.xm"
#include "Application_Support/Tinder.xm"
#include "Application_Support/Cydia.xm"
#include "Application_Support/YouTube.xm"
#include "Application_Support/OneFootball.xm"
#include "Application_Support/Gmail.xm"
// %group NSStringHack
// %hook NSString
//
// -(CGSize)drawAtPoint:(CGPoint)arg1 forWidth:(double)arg2 withFont:(id)arg3 lineBreakMode:(long long)arg4 {
// CGSize x = %orig;
// if (isEnabled) {
// [RED_COLOR set];
// }
// return x;
// }
// %end
// %end
// %group CoreAuthUI //com.apple.CoreAuthUI
//
// %hook UILabel
// -(void)layoutSubviews {
// %orig;
// [self setTextColor: TEXT_COLOR];
// }
//
// -(void)setTextColor:(UIColor *)arg1 {
// arg1 = TEXT_COLOR;
// %orig(arg1);
// }
// %end
//
// %end
static void checkAppBlackList() {
if (idIsEqual(@"com.facebook.Facebook")) {
isEnabled = NO;
}
if (idIsEqual(@"com.apple.calculator")) {
isEnabled = NO;
}
if (idIsEqual(@"com.apple.Camera")) {
isEnabled = NO;
}
if (idIsEqual(@"com.apple.Preferences")) {
if (isBetterSettingsInstalled()) {
isEnabled = NO;
}
}
}
static void checkRunningApp() {
//Third Party Application
if (idIsEqual(@"us.mxms.relay")) {
//%init(RelayApp);
}
if (idIsEqual(@"com.vine.iphone")) {
//VineApp
}
if (idIsEqual(@"com.tumblr.tumblr")) {
%init(TumblrApp);
}
if (idIsEqual(@"com.tapbots.Tweetbot3")) {
%init(TweetbotApp);
}
if (idIsEqual(@"ph.telegra.Telegraph")) {
%init(TelegramApp);
}
if (idIsEqual(@"com.kik.chat")) {
%init(KikApp);
}
if (idIsEqual(@"com.atebits.Tweetie2")) {
%init(TwitterApp);
}
if (idIsEqual(@"com.burbn.instagram")) {
%init(InstagramApp);
}
if (idIsEqual(@"net.whatsapp.WhatsApp")) {
%init(WhatsappApp);
}
//Added 6/4/14
if (idIsEqual(@"com.toyopagroup.picaboo")) {
//%init(SnapchatApp);
}
if (idIsEqual(@"com.soundcloud.TouchApp")) {
%init(SoundcloudApp);
}
//Added 9/19/14
if (idIsEqual(@"com.facebook.Messenger")) {
%init(FBMessenger);
}
//Added 9/28
if (idIsEqual(@"ch.threema.iapp")) {
%init(ThreemaApp);
}
//Added 10/1
if (idIsEqual(@"com.cardify.tinder")) {
%init(TinderApp);
}
//Added 4/3/18
if (idIsEqual(@"de.motain.iliga")) {
%init(OneFootball);
}
//Stock Applications
if (idIsEqual(@"com.apple.mobilephone")) {
%init(PhoneApp);
//dlopen("/Library/MobileSubstrate/DynamicLibraries/SleekPhone.dylib", RTLD_NOW);
}
if (idIsEqual(@"com.apple.mobilemail")) {
%init(MailApp);
}
if (idIsEqual(@"com.apple.mobilesafari")) {
%init(SafariApp);
shouldOverrideStatusBarStyle = YES;
//isEnabled = NO;
}
if (idIsEqual(@"com.apple.Passbook")) {
%init(PassbookApp);
}
if (idIsEqual(@"com.apple.reminders")) {
%init(RemindersApp);
}
if (idIsEqual(@"com.apple.Music")) {
//%init(MusicApp);
%init(MusicApp, MusicPlayerTimeControl = objc_getClass("Music.PlayerTimeControl"), MusicNavBarBGView = objc_getClass("Music.NavigationBarBackgroundView"), PlayIntentControlsReusableView = objc_getClass("Music.PlayIntentControlsReusableView"));
}
if (idIsEqual(@"com.apple.mobilenotes")) {
//isEnabled = NO;
%init(NotesApp);
}
if (idIsEqual(@"com.apple.AppStore")) {
//%init(AppstoreApp);
%init(AppstoreApp, AppStoreSearchHeaderView = objc_getClass("AppStore.SearchHeaderView"), FadeInDynamicTypeButton = objc_getClass("AppStore.FadeInDynamicTypeButton"));
}
if (idIsEqual(@"com.apple.mobilecal")) {
%init(CalendarApp);
%init(CalendarFix);
}
if (idIsEqual(@"com.apple.MobileAddressBook")) {
%init(ContactsApp);
}
if (idIsEqual(@"com.apple.MobileStore")) {
%init(MobileStoreApp);
}
if (idIsEqual(@"com.saurik.Cydia")) {
%init(CydiaApp);
}
if (idIsEqual(@"com.apple.Bridge")) {
%init(WatchApp);
}
if (idIsEqual(@"com.apple.Maps")) {
%init(MapsApp);
}
if (idIsEqual(@"com.apple.mobileslideshow")) {
//%init(PhotosApp);
}
if (idIsEqual(@"com.apple.Preferences")) {
if (!isBetterSettingsInstalled()) {
%init(WiFiKitFix);
%init(PreferencesApp);
}
}
if (idIsEqual(@"com.google.Gmail")) {
%init(GMail);
}
}
static void initializeApplications() {
//Check if Application is on the blacklist
//BOOL shouldAutoReplaceColors = NO;
//BOOL applicationIsEnabledInSettings = YES;
//BOOL shouldAutoReplaceColors = [[prefs objectForKey:[@"AutoColorReplacement-" stringByAppendingString:[UIApplication displayIdentifier]]] boolValue];
//isEnabled = isTweakEnabled();
BOOL applicationIsEnabledInSettings = [[prefs objectForKey:[@"EnabledApps-" stringByAppendingString:[UIApplication displayIdentifier]]] boolValue];
BOOL shouldAutoReplaceColors = NO;
isEnabled = applicationIsEnabledInSettings && isTweakEnabled();
//isEnabled = false;
checkAppBlackList();
// if (idIsEqual(@"com.apple.springboard")) {
// isEnabled = NO;
// }
//If Tweak enabled:
if (isEnabled) {
checkRunningApp();
%init(_ungrouped);
// if (!idIsEqual(@"com.apple.mobilesafari")) {
%init(SystemUIColors);
// }
//Fix clock app crashing
isClockApp = idIsEqual(@"com.apple.mobiletimer");
if (!idIsEqual(@"com.apple.mobilemail")) {
darkenUIElements();
}
if (shouldAutoReplaceColors && !idIsEqual(@"com.apple.Preferences")) {
%init(AutoReplaceColor);
}
//if (UniformityInstalled()) {
// dlopen("/Library/MobileSubstrate/DynamicLibraries/Uniformity.dylib", RTLD_NOW);
//}
}
}
#import <os/log.h>
%ctor {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *args = [[NSClassFromString(@"NSProcessInfo") processInfo] arguments];
NSUInteger count = args.count;
prefsChanged(NULL, NULL, NULL, NULL, NULL); // initialize prefs
registerNotification(quitAppsRequest, QUIT_APPS_NOTIF);
if (count != 0) {
NSString *executablePath = args[0];
if (executablePath) {
NSString *processName = [executablePath lastPathComponent];
BOOL isSpringBoard = [processName isEqualToString:@"SpringBoard"];
BOOL isApplication = [executablePath rangeOfString:@"/Application"].location != NSNotFound;
//BOOL isApplication = YES;
if (isSpringBoard) {
%init(AppTerminator);
prefsChanged(NULL, NULL, NULL, NULL, NULL); // initialize prefs
registerNotification(quitAppsRequest, QUIT_APPS_NOTIF);
}
if (isApplication) {
//if (true) {
// IS APPLICATION
//log bundle identifier
const char *msg = [[NSBundle mainBundle].bundleIdentifier UTF8String];
os_log(OS_LOG_DEFAULT, "ECLIPSE HOOKED BUNDLE IDENTIFIER : %s", msg);
prefsChanged(NULL, NULL, NULL, NULL, NULL); // initialize prefs
// register to receive changed notifications
registerNotification(prefsChanged, PREFS_CHANGED_NOTIF);
registerNotification(wallpaperChanged, WALLPAPER_CHANGED_NOTIF);
// NoctisXI Support
BOOL noctisInstalled = [[NSFileManager defaultManager] fileExistsAtPath:@"/Library/MobileSubstrate/DynamicLibraries/NoctisXI.dylib"];
//BOOL noctisInstalled = [[NSFileManager defaultManager] fileExistsAtPath:@"/Library/noctis_installed"];
if (noctisInstalled) {
os_log(OS_LOG_DEFAULT, "NOCTIS INSTALLED");
NSDictionary *applicationList = [[[NSDictionary alloc] initWithContentsOfFile:NOCTIS_ENABLED_APPS]?:[NSDictionary dictionary] copy];
NSDictionary *noctisxiPrefs = [[[NSDictionary alloc] initWithContentsOfFile:NOCTISXI_PREFS]?:[NSDictionary dictionary] copy];
NSDictionary *noctisPrefs = [[[NSDictionary alloc] initWithContentsOfFile:NOCTIS_PREFS]?:[NSDictionary dictionary] copy];
NSArray* enabledApps = [applicationList objectForKey:@"Enabled Apps"];
BOOL applicationsEnabled = [[noctisxiPrefs objectForKey:@"enabledApplications"] boolValue];
BOOL noctisIsEnabled = [[noctisPrefs objectForKey:@"LQDDarkModeEnabled"] boolValue];
if (applicationsEnabled && noctisIsEnabled) {
if (![enabledApps containsObject:[NSBundle mainBundle].bundleIdentifier]) {
initializeApplications();
}
}
else {
initializeApplications();
}
}
else {
os_log(OS_LOG_DEFAULT, "NOCTIS NOT INSTALLED");
initializeApplications();
if (alertsEnabled()) {
%init(EclipseAlerts);
}
}
}
}
}
[pool release];
}