Browse Source

ALMOST WORK

pull/1/head
Burrit0z 4 years ago
parent
commit
70efe3ecb7
3 changed files with 20 additions and 29 deletions
  1. +1
    -1
      KAIBattery.h
  2. +2
    -2
      KAIBattery.mm
  3. +17
    -26
      Kai.xm

+ 1
- 1
KAIBattery.h View File

@property (nonatomic, assign) BOOL isUpdating; @property (nonatomic, assign) BOOL isUpdating;
+(KAIBattery *)sharedInstance; +(KAIBattery *)sharedInstance;
-(void)darkLightMode; -(void)darkLightMode;
-(instancetype)initWithFrame:(CGRect)arg1;
-(instancetype)init;
-(void)updateBattery; -(void)updateBattery;
@end @end

+ 2
- 2
KAIBattery.mm View File

KAIBattery *instance; KAIBattery *instance;
@implementation KAIBattery @implementation KAIBattery


-(instancetype)initWithFrame:(CGRect)arg1 {
self = [super initWithFrame:arg1];
-(instancetype)init {
self = [super init];
instance = self; instance = self;
if (self) { if (self) {
/*self.translatesAutoresizingMaskIntoConstraints = NO; /*self.translatesAutoresizingMaskIntoConstraints = NO;

+ 17
- 26
Kai.xm View File



@interface CSAdjunctListView : UIView @interface CSAdjunctListView : UIView
@property (nonatomic, assign) BOOL hasKai; @property (nonatomic, assign) BOOL hasKai;
@property (nonatomic, assign) NSInteger previousKaiCount;
-(UIStackView *)stackView; -(UIStackView *)stackView;
-(void)setStackView:(UIStackView *)arg1; -(void)setStackView:(UIStackView *)arg1;
-(void)KaiUpdate; -(void)KaiUpdate;
@interface NCNotificationListView : UIView @interface NCNotificationListView : UIView
@end @end


BOOL setFrame = NO;
CGRect original = CGRectMake(0,0,0,0); CGRect original = CGRectMake(0,0,0,0);
CGRect originalBattery; CGRect originalBattery;




%hook CSAdjunctListView %hook CSAdjunctListView
%property (nonatomic, assign) BOOL hasKai; %property (nonatomic, assign) BOOL hasKai;
%property (nonatomic, assign) NSInteger previousKaiCount;


-(void)_layoutStackView { -(void)_layoutStackView {


} }


-(void)setStackView:(UIStackView *)arg1 { -(void)setStackView:(UIStackView *)arg1 {
//NSLog(@"Kai: Updating setting stack view");


if(!self.hasKai) { if(!self.hasKai) {
KAIBattery *battery = [[KAIBattery alloc] initWithFrame:CGRectMake(8, 0, UIScreen.mainScreen.bounds.size.width, 85)];
KAIBattery *battery = [[KAIBattery alloc] init];
battery.translatesAutoresizingMaskIntoConstraints = NO; battery.translatesAutoresizingMaskIntoConstraints = NO;
[battery.leftAnchor constraintEqualToAnchor:battery.leftAnchor constant:0].active = YES;
[battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
[battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;
//[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
[battery.heightAnchor constraintEqualToConstant:100].active = YES;
originalBattery = battery.frame; originalBattery = battery.frame;
original = [self stackView].frame; original = [self stackView].frame;
setFrame = YES;
self.previousKaiCount = 0;
self.hasKai = YES;
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(KaiInfo) selector:@selector(KaiInfo)
name:@"KaiInfoChanged" name:@"KaiInfoChanged"
object:nil]; object:nil];
//[self addSubview:[KAIBattery sharedInstance]];
self.hasKai = YES;
[[KAIBattery sharedInstance] darkLightMode]; [[KAIBattery sharedInstance] darkLightMode];
}


UIStackView *newView = arg1; UIStackView *newView = arg1;


if(![arg1.subviews containsObject:[KAIBattery sharedInstance]]) {
[newView addArrangedSubview:[KAIBattery sharedInstance]];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,359,80)];
[view setBackgroundColor:[UIColor redColor]];
//[view setIntrinsicContentSize:CGSizeMake(359,80)];
[newView addArrangedSubview:view];
if(![arg1.subviews containsObject:battery]) {
[newView addArrangedSubview:battery];
//UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,359,80)];
//[view setBackgroundColor:[UIColor redColor]];
//[newView addArrangedSubview:view];
} }

%orig(newView); %orig(newView);
//%orig(arg1);

}
} }


%new %new
[[KAIBattery sharedInstance] darkLightMode]; [[KAIBattery sharedInstance] darkLightMode];
KAIBattery *battery = [KAIBattery sharedInstance]; KAIBattery *battery = [KAIBattery sharedInstance];
//battery.translatesAutoresizingMaskIntoConstraints = YES; //battery.translatesAutoresizingMaskIntoConstraints = YES;
battery.frame = CGRectMake(
/*battery.frame = CGRectMake(
originalBattery.origin.x, originalBattery.origin.x,
originalBattery.origin.y, originalBattery.origin.y,
originalBattery.size.width, originalBattery.size.width,
(battery.number * 85) (battery.number * 85)
);
);*/


battery.translatesAutoresizingMaskIntoConstraints = NO; battery.translatesAutoresizingMaskIntoConstraints = NO;
[battery.leftAnchor constraintEqualToAnchor:battery.leftAnchor constant:0].active = YES;
[battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
[battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;
[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
//[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
} }


%new %new

Loading…
Cancel
Save