1
0
mirror of https://github.com/Burrit0z/kai synced 2025-07-04 00:16:46 +00:00

fix a few final things before new beta

This commit is contained in:
Burrit0z
2020-05-22 15:02:18 -04:00
parent 79a4b1b2a9
commit 1369ec0831
2 changed files with 11 additions and 6 deletions

View File

@ -20,14 +20,17 @@ long long batteryPercentage;
long long lastPercentage; long long lastPercentage;
-(void)updateBattery { -(void)updateBattery {
//dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
//NSLog(@"kai: battery platter called to update"); //NSLog(@"kai: battery platter called to update");
if(!self.isUpdating) { if(!self.isUpdating) {
NSLog(@"kai: IS Updating");
self.isUpdating = YES; self.isUpdating = YES;
self.number = 0; //self.number = 0;
float y = 0; float y = 0;
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance]; BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
NSArray *devices = MSHookIvar<NSArray *>(bcb, "_sortedDevices"); NSArray *devices = MSHookIvar<NSArray *>(bcb, "_sortedDevices");
if([devices count]!=0) {
NSLog(@"kai: info is good, will proceed");
for(KAIBatteryCell *cell in self.subviews) { for(KAIBatteryCell *cell in self.subviews) {
if([cell respondsToSelector:@selector(updateInfo)] && ![devices containsObject:cell.device]) { //to confirm is a cell and battery device does not exist if([cell respondsToSelector:@selector(updateInfo)] && ![devices containsObject:cell.device]) { //to confirm is a cell and battery device does not exist
@ -59,7 +62,7 @@ long long lastPercentage;
if(cell) { if(cell) {
cell.device = device; cell.device = device;
cell.frame = cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); //bro im like creating my own stack view cell.frame = cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); //bro im like creating my own stack view
[cell updateInfo]; //[cell updateInfo];
} }
if(shouldAdd && [deviceName length]!=0) { if(shouldAdd && [deviceName length]!=0) {
@ -74,11 +77,13 @@ long long lastPercentage;
} }
} }
//[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES; //[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;
self.isUpdating = NO;
self.number = [self.subviews count]; self.number = [self.subviews count];
[(CSAdjunctListView *)self.superview.superview KaiUpdate]; [(CSAdjunctListView *)self.superview.superview KaiUpdate];
}
self.isUpdating = NO;
NSLog(@"kai: finished update");
} }
//}); });
} }
-(void)removeAllAndRefresh { -(void)removeAllAndRefresh {

2
Kai.xm
View File

@ -80,7 +80,7 @@
isUpdating = YES; isUpdating = YES;
//NSLog(@"kai: kai info will update"); NSLog(@"kai: kai info will update");
[[KAIBattery sharedInstance] updateBattery]; [[KAIBattery sharedInstance] updateBattery];
[self KaiUpdate]; [self KaiUpdate];