-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweak.x
More file actions
35 lines (26 loc) · 1.13 KB
/
Tweak.x
File metadata and controls
35 lines (26 loc) · 1.13 KB
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
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <SparkColourPickerUtils.h>
// Preference Vars
UIColor *currentColor;
UIColor *otherColor;
%hook UIPageControl
//The currently selected page
-(UIColor *)currentPageIndicatorTintColor {
return currentColor;
}
//The non-selected pages
-(UIColor *)pageIndicatorTintColor {
return otherColor;
}
%end
//Prefereneces loader
static void loadPrefs() {
NSMutableDictionary *preferences = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.colaski.colormydotspref.plist"];
currentColor = [SparkColourPickerUtils colourWithString: [preferences objectForKey:@"currentColor"] withFallback: @"#ffffff"];
otherColor = [SparkColourPickerUtils colourWithString: [preferences objectForKey:@"otherColor"] withFallback: @"#7d7d7d"];
}
%ctor {
loadPrefs(); // Load preferences into variables
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)loadPrefs, CFSTR("com.colaski.colormydotspref/saved"), NULL, CFNotificationSuspensionBehaviorCoalesce); // Listen for preference changes
}