mirror of
https://github.com/Burrit0z/kai
synced 2025-07-01 20:16:48 +00:00
lmao
This commit is contained in:
@ -23,20 +23,24 @@ long long lastPercentage;
|
|||||||
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");
|
//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) {
|
if([devices count]!=0) {
|
||||||
NSLog(@"kai: info is good, will proceed");
|
//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
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[cell removeFromSuperview];
|
[cell removeFromSuperview];
|
||||||
|
});
|
||||||
} else if([cell respondsToSelector:@selector(updateInfo)]) {
|
} else if([cell respondsToSelector:@selector(updateInfo)]) {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[cell updateInfo];
|
[cell updateInfo];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,20 +72,25 @@ long long lastPercentage;
|
|||||||
if(shouldAdd && [deviceName length]!=0) {
|
if(shouldAdd && [deviceName length]!=0) {
|
||||||
if(![self.subviews containsObject:cell]) {
|
if(![self.subviews containsObject:cell]) {
|
||||||
cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight);
|
cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight);
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[self addSubview:cell];
|
[self addSubview:cell];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
y+=bannerHeight + spacing;
|
y+=bannerHeight + spacing;
|
||||||
|
|
||||||
} else if(!shouldAdd) {
|
} else if(!shouldAdd) {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[cell removeFromSuperview];
|
[cell removeFromSuperview];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;
|
//[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;
|
||||||
self.number = [self.subviews count];
|
self.number = [self.subviews count];
|
||||||
[(CSAdjunctListView *)self.superview.superview KaiUpdate];
|
//[(CSAdjunctListView *)self.superview.superview KaiUpdate];
|
||||||
}
|
}
|
||||||
self.isUpdating = NO;
|
self.isUpdating = NO;
|
||||||
NSLog(@"kai: finished update");
|
//NSLog(@"kai: finished update");
|
||||||
|
[(CSAdjunctListView *)self.superview.superview KaiUpdate];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user