|
|
|
|
|
|
|
|
@interface _CSSingleBatteryChargingView : UIView |
|
|
@interface _CSSingleBatteryChargingView : UIView |
|
|
@end |
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@interface NCNotificationListView : UIView |
|
|
|
|
|
@property (nonatomic, assign) BOOL hasKai; |
|
|
|
|
|
@property (nonatomic, assign) NSInteger previousKaiCount; |
|
|
|
|
|
@end |
|
|
|
|
|
|
|
|
BOOL setFrame = NO; |
|
|
BOOL setFrame = NO; |
|
|
UIView *batteryWidgetController; |
|
|
|
|
|
|
|
|
NCNotificationListView *batteryWidgetController; |
|
|
KAIBattery *batteryWidget; |
|
|
KAIBattery *batteryWidget; |
|
|
CSCoverSheetViewBase *base; |
|
|
CSCoverSheetViewBase *base; |
|
|
CGRect original; |
|
|
CGRect original; |
|
|
|
|
|
|
|
|
[base KaiInit]; |
|
|
[base KaiInit]; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
[base KaiUpdate]; |
|
|
|
|
|
|
|
|
//[base KaiUpdate]; |
|
|
} |
|
|
} |
|
|
%end |
|
|
%end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
name:@"KaiInfoChanged" |
|
|
name:@"KaiInfoChanged" |
|
|
object:nil]; |
|
|
object:nil]; |
|
|
|
|
|
|
|
|
[self KaiUpdate]; |
|
|
|
|
|
|
|
|
//[self KaiUpdate]; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-(void)setNeedsLayout { |
|
|
-(void)setNeedsLayout { |
|
|
%orig; |
|
|
%orig; |
|
|
[self KaiUpdate]; |
|
|
|
|
|
|
|
|
//[self KaiUpdate]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
%new |
|
|
%new |
|
|
-(void)KaiInit { |
|
|
-(void)KaiInit { |
|
|
if(!setFrame) { |
|
|
if(!setFrame) { |
|
|
UIView *scroller; |
|
|
|
|
|
|
|
|
NCNotificationListView *scroller; |
|
|
if([self.subviews count] > 1) { |
|
|
if([self.subviews count] > 1) { |
|
|
UIView *temp = [self.subviews objectAtIndex:1]; |
|
|
UIView *temp = [self.subviews objectAtIndex:1]; |
|
|
if([temp.subviews count] > 0) { |
|
|
if([temp.subviews count] > 0) { |
|
|
scroller = [temp.subviews objectAtIndex:0]; |
|
|
|
|
|
|
|
|
scroller = [[temp.subviews objectAtIndex:0].subviews objectAtIndex:0]; |
|
|
base = self; |
|
|
base = self; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setFrame = YES; |
|
|
setFrame = YES; |
|
|
batteryWidgetController = scroller; |
|
|
batteryWidgetController = scroller; |
|
|
batteryWidget = battery; |
|
|
batteryWidget = battery; |
|
|
|
|
|
batteryWidgetController.previousKaiCount = 0; |
|
|
} |
|
|
} |
|
|
[self KaiUpdate]; |
|
|
[self KaiUpdate]; |
|
|
[batteryWidget darkLightMode]; |
|
|
[batteryWidget darkLightMode]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%new |
|
|
%new |
|
|
-(void)KaiUpdate { |
|
|
-(void)KaiUpdate { |
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
|
|
|
|
|
[UIView animateWithDuration:0.3 animations:^{ |
|
|
[UIView animateWithDuration:0.3 animations:^{ |
|
|
/*UIView *notiView; |
|
|
/*UIView *notiView; |
|
|
if([self.subviews count] > 0) { |
|
|
if([self.subviews count] > 0) { |
|
|
notiView = [self.subviews objectAtIndex:0]; |
|
|
notiView = [self.subviews objectAtIndex:0]; |
|
|
}*/ |
|
|
}*/ |
|
|
|
|
|
|
|
|
batteryWidgetController.frame = CGRectMake( |
|
|
|
|
|
original.origin.x, |
|
|
|
|
|
original.origin.y + (batteryWidget.number * 85), |
|
|
|
|
|
original.size.width, |
|
|
|
|
|
original.size.height |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
batteryWidgetController.translatesAutoresizingMaskIntoConstraints = NO; |
|
|
|
|
|
|
|
|
|
|
|
for(UIView *view in batteryWidgetController.subviews) { |
|
|
|
|
|
view.bounds = CGRectMake( |
|
|
|
|
|
view.bounds.origin.x, |
|
|
|
|
|
view.bounds.origin.y - (batteryWidget.number * 85) + (batteryWidgetController.previousKaiCount * 85), |
|
|
|
|
|
view.bounds.size.width, |
|
|
|
|
|
view.bounds.size.height |
|
|
); |
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
batteryWidgetController.previousKaiCount = batteryWidget.number; |
|
|
|
|
|
/*[batteryWidgetController.topAnchor constraintEqualToAnchor:batteryWidgetController.superview.topAnchor constant:(batteryWidget.number * 85)].active = YES; |
|
|
|
|
|
batteryWidgetController.translatesAutoresizingMaskIntoConstraints = NO;*/ |
|
|
|
|
|
|
|
|
batteryWidget.frame = CGRectMake( |
|
|
batteryWidget.frame = CGRectMake( |
|
|
originalBattery.origin.x, |
|
|
originalBattery.origin.x, |
|
|
|
|
|
|
|
|
); |
|
|
); |
|
|
}]; |
|
|
}]; |
|
|
[batteryWidget darkLightMode]; |
|
|
[batteryWidget darkLightMode]; |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
%end |
|
|
%end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%hook NCNotificationListView |
|
|
|
|
|
%property (nonatomic, assign) BOOL hasKai; |
|
|
|
|
|
%property (nonatomic, assign) NSInteger previousKaiCount; |
|
|
|
|
|
|
|
|
|
|
|
//-(void)setBounds:(CGRect)arg1 { |
|
|
|
|
|
/*if(batteryWidgetController==self) { |
|
|
|
|
|
arg1 = (CGRectMake( |
|
|
|
|
|
original.origin.x, |
|
|
|
|
|
original.origin.y - (batteryWidget.number * 85), |
|
|
|
|
|
original.size.width, |
|
|
|
|
|
original.size.height |
|
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
batteryWidget.frame = CGRectMake( |
|
|
|
|
|
originalBattery.origin.x, |
|
|
|
|
|
originalBattery.origin.y - (batteryWidget.number * 85), |
|
|
|
|
|
originalBattery.size.width, |
|
|
|
|
|
originalBattery.size.height |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
[batteryWidget darkLightMode]; |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
// %orig; |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
%end |
|
|
|
|
|
|
|
|
%hook BCBatteryDevice |
|
|
%hook BCBatteryDevice |
|
|
|
|
|
|
|
|
- (id)initWithIdentifier:(id)arg1 vendor:(long long)arg2 productIdentifier:(long long)arg3 parts:(unsigned long long)arg4 matchIdentifier:(id)arg5 { |
|
|
- (id)initWithIdentifier:(id)arg1 vendor:(long long)arg2 productIdentifier:(long long)arg3 parts:(unsigned long long)arg4 matchIdentifier:(id)arg5 { |
|
|
|
|
|
|
|
|
[self addObserver:self forKeyPath:@"name" options:NSKeyValueObservingOptionNew context:nil]; |
|
|
[self addObserver:self forKeyPath:@"name" options:NSKeyValueObservingOptionNew context:nil]; |
|
|
[self addObserver:self forKeyPath:@"charging" options:NSKeyValueObservingOptionNew context:nil]; |
|
|
[self addObserver:self forKeyPath:@"charging" options:NSKeyValueObservingOptionNew context:nil]; |
|
|
|
|
|
[self addObserver:self forKeyPath:@"powerSourceState" options:NSKeyValueObservingOptionNew context:nil]; |
|
|
|
|
|
[self addObserver:self forKeyPath:@"batterySaverModeActive" options:NSKeyValueObservingOptionNew context:nil]; |
|
|
|
|
|
[self addObserver:self forKeyPath:@"percentCharge" options:NSKeyValueObservingOptionNew context:nil]; |
|
|
|
|
|
|
|
|
//[self setValue:@"crash" forKeyPath:@"euhidehuud"]; |
|
|
//[self setValue:@"crash" forKeyPath:@"euhidehuud"]; |
|
|
|
|
|
|