File tree 3 files changed +16
-18
lines changed
3 files changed +16
-18
lines changed Original file line number Diff line number Diff line change 44
44
@interface _UIStatusBarStyleAttributes : NSObject
45
45
@property (nonatomic , readonly ) long long style;
46
46
@property (nonatomic , copy ) UIColor *textColor;
47
+ @property (nonatomic , copy ) UIColor *imageTintColor;
47
48
@end
48
49
49
50
@interface _UIStatusBarItemUpdate : NSObject
57
58
@end
58
59
59
60
@interface _UIStatusBarWifiItem : _UIStatusBarItem
60
- @property (nonatomic , strong ) NSNumber *smIsVPNEnabled;
61
- @property (nonatomic , strong ) NSNumber *smDisplayValue;
61
+ @property (nonatomic , strong ) _UIStatusBarImageView *networkIconView;
62
62
- (UIColor *)_fillColorForUpdate : (_UIStatusBarItemUpdate *)update entry : (_UIStatusBarDataWifiEntry *)entry ;
63
63
@end
64
64
Original file line number Diff line number Diff line change 1
- export PACKAGE_VERSION := 1.4
1
+ export PACKAGE_VERSION := 1.5
2
2
3
3
ifeq ($(THEOS_DEVICE_SIMULATOR ) ,1)
4
4
TARGET := simulator:clang:latest:14.0
Original file line number Diff line number Diff line change @@ -43,29 +43,27 @@ static void ReloadPrefs() {
43
43
44
44
%hook _UIStatusBarWifiItem
45
45
46
- %property (nonatomic, strong) NSNumber *smIsVPNEnabled;
47
- %property (nonatomic, strong) NSNumber *smDisplayValue;
48
-
49
46
- (id )applyUpdate:(_UIStatusBarItemUpdate *)update toDisplayItem:(_UIStatusBarDisplayItem *)displayItem {
50
47
_isVPNEnabled = update.data .vpnEntry .enabled ;
51
- long long displayValue = update.data .wifiEntry .displayValue ;
52
48
53
49
id result = %orig ;
54
- BOOL needsReload = NO ;
55
50
56
- if ([self .smIsVPNEnabled boolValue ] != _isVPNEnabled) {
57
- self.smIsVPNEnabled = @(_isVPNEnabled);
58
- needsReload = YES ;
59
- }
51
+ UIColor *originalColor = update.styleAttributes .textColor ;
52
+ UIColor *newColor = nil ;
60
53
61
- if ([ self .smDisplayValue longLongValue ] != displayValue) {
62
- self. smDisplayValue = @(displayValue);
63
- needsReload = YES ;
54
+ BOOL decision = _isEnabledReversed ? !_isVPNEnabled : _isVPNEnabled;
55
+ if (decision) {
56
+ newColor = svpnColorWithTextColor (originalColor) ;
64
57
}
65
58
66
- if (needsReload) {
67
- for (_UIStatusBarDisplayItem *item in self.displayItems .allValues ) {
68
- %orig (update, item);
59
+ if (!newColor) { newColor = update.styleAttributes .imageTintColor ?: originalColor; }
60
+
61
+ for (_UIStatusBarDisplayItem *item in self.displayItems .allValues ) {
62
+ %orig (update, item);
63
+
64
+ if (item.view == self.networkIconView && [item.view isKindOfClass: %c (_UIStatusBarImageView)]) {
65
+ _UIStatusBarImageView *imageView = (_UIStatusBarImageView *)item.view ;
66
+ [imageView setTintColor: newColor];
69
67
}
70
68
}
71
69
You can’t perform that action at this time.
0 commit comments