mirror of
				https://github.com/Burrit0z/kai
				synced 2025-11-04 15:26:21 +00:00 
			
		
		
		
	ALMOST WORK
This commit is contained in:
		@ -27,6 +27,6 @@
 | 
				
			|||||||
@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
 | 
				
			||||||
@ -3,8 +3,8 @@
 | 
				
			|||||||
KAIBattery *instance;
 | 
					KAIBattery *instance;
 | 
				
			||||||
@implementation KAIBattery
 | 
					@implementation KAIBattery
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-(instancetype)initWithFrame:(CGRect)arg1 {
 | 
					-(instancetype)init {
 | 
				
			||||||
    self = [super initWithFrame:arg1];
 | 
					    self = [super init];
 | 
				
			||||||
    instance = self;
 | 
					    instance = self;
 | 
				
			||||||
    if (self) {
 | 
					    if (self) {
 | 
				
			||||||
        /*self.translatesAutoresizingMaskIntoConstraints = NO;
 | 
					        /*self.translatesAutoresizingMaskIntoConstraints = NO;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										43
									
								
								Kai.xm
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								Kai.xm
									
									
									
									
									
								
							@ -13,7 +13,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@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;
 | 
				
			||||||
@ -29,14 +28,12 @@
 | 
				
			|||||||
@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 {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -48,38 +45,34 @@ CGRect originalBattery;
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-(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.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
 | 
				
			||||||
        [battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
 | 
							//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
 | 
				
			||||||
        [battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].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]]) {
 | 
						if(![arg1.subviews containsObject:battery]) {
 | 
				
			||||||
		[newView addArrangedSubview:[KAIBattery sharedInstance]];
 | 
							[newView addArrangedSubview:battery];
 | 
				
			||||||
		UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,359,80)];
 | 
							//UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,359,80)];
 | 
				
			||||||
		[view setBackgroundColor:[UIColor redColor]];
 | 
							//[view setBackgroundColor:[UIColor redColor]];
 | 
				
			||||||
		//[view setIntrinsicContentSize:CGSizeMake(359,80)];
 | 
							//[newView addArrangedSubview:view];
 | 
				
			||||||
		[newView addArrangedSubview:view];
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	%orig(newView);
 | 
						%orig(newView);
 | 
				
			||||||
	//%orig(arg1);
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%new
 | 
					%new
 | 
				
			||||||
@ -87,18 +80,16 @@ CGRect originalBattery;
 | 
				
			|||||||
	[[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.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
 | 
				
			||||||
        [battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
 | 
							//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
 | 
				
			||||||
        [battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;
 | 
					 | 
				
			||||||
		[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%new
 | 
					%new
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user