mirror of
https://github.com/Burrit0z/kai
synced 2025-06-30 21:16:48 +00:00
im so done, at least stack view works
This commit is contained in:
@ -9,11 +9,11 @@ NSMutableArray *deviceInstances = [[NSMutableArray alloc] init];
|
||||
if(self && device!=nil) {
|
||||
|
||||
self.device = device;
|
||||
|
||||
|
||||
NSString *deviceName = device.name;
|
||||
double batteryPercentage = device.percentCharge;
|
||||
BOOL charging = device.charging;
|
||||
BOOL LPM = device.batterySaverModeActive;
|
||||
BOOL charging = MSHookIvar<long long>(device, "_charging");
|
||||
BOOL LPM = MSHookIvar<BOOL>(device, "_batterySaverModeActive");
|
||||
|
||||
UIView *blank;
|
||||
if(bannerStyle==1) {
|
||||
|
@ -12,7 +12,7 @@ KAIBatteryStack *instance;
|
||||
self.displayingDevices = [[NSMutableArray alloc] init];
|
||||
self.axis = 1;
|
||||
self.distribution = 0;
|
||||
self.spacing = spacing;
|
||||
self.spacing = 0;
|
||||
self.alignment = 0;
|
||||
[self updateBattery];
|
||||
//self.clipsToBounds = YES;
|
||||
|
19
Kai.xm
19
Kai.xm
@ -110,11 +110,15 @@
|
||||
}
|
||||
|
||||
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
|
||||
if(self && self.kaiCell == nil) {
|
||||
self.kaiCell = [[KAIBatteryCell alloc] initWithFrame:CGRectMake(0,0,0,0) device:self]; }
|
||||
((KAIBatteryCell *)self.kaiCell).translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[((KAIBatteryCell *)self.kaiCell).heightAnchor constraintEqualToConstant:bannerHeight].active = YES;
|
||||
@try {
|
||||
if([self isMemberOfClass:[objc_getClass("BCBatteryDevice") class]] && [self respondsToSelector:@selector(_kaiCell)]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
if(self && self.kaiCell == nil) {
|
||||
self.kaiCell = [[KAIBatteryCell alloc] initWithFrame:CGRectMake(0,0,[KAIBatteryStack sharedInstance].frame.size.width,0) device:self]; }
|
||||
((KAIBatteryCell *)self.kaiCell).translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[((KAIBatteryCell *)self.kaiCell).heightAnchor constraintEqualToConstant:bannerHeight + spacing].active = YES;
|
||||
|
||||
//sends the noti to update battery info
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"KaiInfoChanged" object:nil userInfo:nil];
|
||||
[(KAIBatteryCell *)self.kaiCell updateInfo];
|
||||
@ -134,8 +138,15 @@
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
} @catch (NSException *exc) {}
|
||||
|
||||
}
|
||||
|
||||
%new
|
||||
-(id)_kaiCell {
|
||||
return self.kaiCell;
|
||||
}
|
||||
%end
|
||||
|
||||
%hook KAICSTarget //Again, not a class
|
||||
|
Reference in New Issue
Block a user