From 48b561ba10cfa1c9010be8bbcae3d94a65ce11d1 Mon Sep 17 00:00:00 2001 From: Burrit0z Date: Wed, 20 May 2020 09:19:46 -0400 Subject: [PATCH] 0.0.2 --- KAIBattery.mm | 2 +- Kai.xm | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/KAIBattery.mm b/KAIBattery.mm index f29e4c2..ec60d25 100644 --- a/KAIBattery.mm +++ b/KAIBattery.mm @@ -46,7 +46,7 @@ long long lastPercentage; BOOL charging = MSHookIvar(device, "_charging"); BOOL LPM = MSHookIvar(device, "_batterySaverModeActive"); - if(charging || !charging) { + if(charging) { UIVisualEffectView *blank; if(@available(iOS 12.0, *)) { diff --git a/Kai.xm b/Kai.xm index e5dd27f..e41fb4f 100644 --- a/Kai.xm +++ b/Kai.xm @@ -96,13 +96,24 @@ CGRect originalBattery; //battery.heightConstraint.constant = (battery.number * 85); if(!battery.heightConstraint) { - NSLog(@"kai: 1st time, assigning to %ld", (battery.number * 85)); - battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:(battery.number * 85)]; + + battery.heightConstraint.active = NO; + NSLog(@"kai: 1st time, assigning to %d", 500); + battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:500]; battery.heightConstraint.active = YES; - } - NSLog(@"kai: setting to %ld", (battery.number * 85)); - battery.heightConstraint.constant = (battery.number * 85); + } else { + int height = (battery.number * 85); + if(height!=0) { + battery.heightConstraint.active = NO; + NSLog(@"kai: setting to %d", height); + battery.heightConstraint.constant = height; + battery.heightConstraint.active = YES; + + UIStackView *s = [self stackView]; + s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1)); + } + } }];