1
0
mirror of https://github.com/Burrit0z/kai synced 2025-07-01 17:16:47 +00:00

finish ios 14 (works ios 14.0)

This commit is contained in:
Burrit0z
2020-09-24 13:46:37 -04:00
parent 1ef3ed3576
commit b734b0681b
3 changed files with 6 additions and 7 deletions

View File

@ -76,9 +76,12 @@
} }
UIImage *glyph = ios13 ? [device glyph] : [device batteryWidgetGlyph]; UIImage *glyph = ios13 ? [device glyph] : [device batteryWidgetGlyph];
glyph= [glyph imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
self.glyphView = [[UIImageView alloc] init]; self.glyphView = [[UIImageView alloc] init];
self.glyphView.contentMode = UIViewContentModeScaleAspectFit; self.glyphView.contentMode = UIViewContentModeScaleAspectFit;
[self.glyphView setImage:glyph]; [self.glyphView setImage:glyph];
self.glyphView.tintColor = [UIColor whiteColor];
[self addSubview:blurPlatter]; [self addSubview:blurPlatter];
[blurPlatter addSubview:blur]; [blurPlatter addSubview:blur];
@ -218,9 +221,6 @@
} }
[self.percentLabel setText:[NSString stringWithFormat:@"%ld%%", (long)((NSInteger)batteryPercentage)]]; [self.percentLabel setText:[NSString stringWithFormat:@"%ld%%", (long)((NSInteger)batteryPercentage)]];
self.battery.chargePercent = (batteryPercentage * 0.01); self.battery.chargePercent = (batteryPercentage * 0.01);
[self.glyphView setImage:ios13 ? [self.device glyph] : [self.device batteryWidgetGlyph]];
} else {
} }
} }

View File

@ -100,7 +100,7 @@ NSMutableArray *cellsForDeviceNames = [[NSMutableArray alloc] init];
- (void)updateBattery { - (void)updateBattery {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance]; BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
NSArray *devices = ios13 ? [bcb sortedDevices] : [bcb connectedDevices]; NSArray *devices = [bcb connectedDevices];
if (self.oldCountOfDevices == -100) { if (self.oldCountOfDevices == -100) {
self.oldCountOfDevices = [devices count] + 1; self.oldCountOfDevices = [devices count] + 1;
@ -311,7 +311,7 @@ NSMutableArray *cellsForDeviceNames = [[NSMutableArray alloc] init];
} }
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance]; BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
NSArray *devices = ios13 ? [bcb sortedDevices] : [bcb connectedDevices]; NSArray *devices = [bcb connectedDevices];
for (BCBatteryDevice *device in devices) { for (BCBatteryDevice *device in devices) {
[device resetKaiCellForNewPrefs]; [device resetKaiCellForNewPrefs];
} }

View File

@ -19,8 +19,7 @@
@interface BCBatteryDeviceController : NSObject @interface BCBatteryDeviceController : NSObject
@property (nonatomic, strong) NSArray *sortedDevices; @property (nonatomic, strong) NSArray *sortedDevices;
- (id)_sortedDevices; - (id)connectedDevices;
- (id)connectedDevices; //ios 14
+ (id)sharedInstance; + (id)sharedInstance;
@end @end