Browse Source

yes bro

pull/1/head
Burrit0z 4 years ago
parent
commit
b461e525f5
7 changed files with 38 additions and 21 deletions
  1. +1
    -0
      KAIBattery.h
  2. +5
    -7
      KAIBattery.mm
  3. +3
    -1
      Kai.h
  4. +11
    -7
      Kai.xm
  5. +1
    -1
      control
  6. +2
    -2
      kaiprefs/KAIRootListController.m
  7. +15
    -3
      kaiprefs/Resources/Root.plist

+ 1
- 0
KAIBattery.h View File

@interface MTMaterialView : UIView @interface MTMaterialView : UIView
@property (nonatomic, assign) BOOL recipeDynamic; @property (nonatomic, assign) BOOL recipeDynamic;
-(id)_initWithRecipe:(NSInteger)arg1 configuration:(NSInteger)arg2 initialWeighting:(CGFloat)arg3 scaleAdjustment:(id)arg4; -(id)_initWithRecipe:(NSInteger)arg1 configuration:(NSInteger)arg2 initialWeighting:(CGFloat)arg3 scaleAdjustment:(id)arg4;
+(id)materialViewWithRecipe:(NSInteger)arg1 options:(NSInteger)arg2 initialWeighting:(CGFloat)arg3 scaleAdjustment:(id)arg4;
@end @end


@interface BCBatteryDeviceController @interface BCBatteryDeviceController

+ 5
- 7
KAIBattery.mm View File

self = [super init]; self = [super init];
instance = self; instance = self;
if (self) { if (self) {
/*self.translatesAutoresizingMaskIntoConstraints = NO;
[self.leftAnchor constraintEqualToAnchor:self.leftAnchor constant:8].active = YES;
[self.topAnchor constraintEqualToAnchor:self.topAnchor constant:arg1.origin.y].active = YES;
[self.widthAnchor constraintEqualToConstant:UIScreen.mainScreen.bounds.size.width - 16].active = YES;
[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;*/
[self updateBattery]; [self updateBattery];
self.userInteractionEnabled = NO; self.userInteractionEnabled = NO;
//[self addSubview:self.batteryLabel];
} }
return self; return self;
} }
if(shouldAdd) { if(shouldAdd) {
UIView *blank; UIView *blank;
if(bannerStyle==1) { if(bannerStyle==1) {
blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil];
if(kCFCoreFoundationVersionNumber > 1600) {
blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil];
} else if(kCFCoreFoundationVersionNumber < 1600) {
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
}
} else if(bannerStyle==2) { } else if(bannerStyle==2) {
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]]; blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
} else if(bannerStyle==3) { } else if(bannerStyle==3) {

+ 3
- 1
Kai.h View File

BOOL disableGlyphs; BOOL disableGlyphs;
BOOL hidePercent; BOOL hidePercent;
BOOL showAll; BOOL showAll;
BOOL belowMusic;
BOOL hideDeviceLabel; BOOL hideDeviceLabel;
NSInteger bannerStyle; NSInteger bannerStyle;
NSInteger bannerAlign; NSInteger bannerAlign;


enabled = boolValueForKey(@"enabled", YES); enabled = boolValueForKey(@"enabled", YES);
spacing = numberForValue(@"spacing", 5); spacing = numberForValue(@"spacing", 5);
glyphSize = numberForValue(@"glyphSize", 35);
glyphSize = numberForValue(@"glyphSize", 30);
bannerHeight = numberForValue(@"bannerHeight", 80); bannerHeight = numberForValue(@"bannerHeight", 80);
cornerRadius = numberForValue(@"cornerRadius", 13); cornerRadius = numberForValue(@"cornerRadius", 13);
disableGlyphs = boolValueForKey(@"disableGlyphs", NO); disableGlyphs = boolValueForKey(@"disableGlyphs", NO);
hideDeviceLabel = boolValueForKey(@"hideDeviceLabel", NO); hideDeviceLabel = boolValueForKey(@"hideDeviceLabel", NO);
bannerAlign = numberForValue(@"bannerAlign", 2); bannerAlign = numberForValue(@"bannerAlign", 2);
horizontalOffset = numberForValue(@"horizontalOffset", 0); horizontalOffset = numberForValue(@"horizontalOffset", 0);
belowMusic = boolValueForKey(@"belowMusic", NO);


if(disableGlyphs) { if(disableGlyphs) {
glyphSize = 0; glyphSize = 0;

+ 11
- 7
Kai.xm View File



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


//NSLog(@"Kai: Laying out stack view");
NSInteger lastSlot = [[self stackView].subviews count] -1;
if([[self stackView].subviews objectAtIndex:lastSlot] != [KAIBattery sharedInstance] && belowMusic) {
[[self stackView] removeArrangedSubview:[KAIBattery sharedInstance]];
[[self stackView] insertArrangedSubview:[KAIBattery sharedInstance] atIndex:lastSlot];
}
[self KaiUpdate]; [self KaiUpdate];


if(!battery.heightConstraint) { if(!battery.heightConstraint) {
battery.heightConstraint.active = NO; battery.heightConstraint.active = NO;
NSLog(@"kai: 1st time, assigning to %d", 500);
battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:500];
battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:85];
battery.heightConstraint.active = YES; battery.heightConstraint.active = YES;


} else { } else {
int height = (battery.number * (bannerHeight + spacing));
int height = (battery.number * ((bannerHeight + spacing) - spacing + 5));
battery.heightConstraint.active = NO; battery.heightConstraint.active = NO;
NSLog(@"kai: setting to %d", height);
battery.heightConstraint.constant = height; battery.heightConstraint.constant = height;
battery.heightConstraint.active = YES; battery.heightConstraint.active = YES;


%hook CSBatteryChargingView %hook CSBatteryChargingView


+(id)batteryChargingViewWithSingleBattery { +(id)batteryChargingViewWithSingleBattery {
//NSLog(@"kai: here bro: %@", [NSThread callStackSymbols]);
//[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"kai: here bro: %@", [NSThread callStackSymbols]];
NSLog(@"kai: here bro: %@", [NSThread callStackSymbols]);
[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"kai: here bro: %@", [NSThread callStackSymbols]];
return nil; return nil;
} }


+(id)batteryChargingViewWithDoubleBattery { +(id)batteryChargingViewWithDoubleBattery {
NSLog(@"kai: here bro: %@", [NSThread callStackSymbols]);
[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"kai: here bro: %@", [NSThread callStackSymbols]];
return nil; return nil;
} }



+ 1
- 1
control View File

Package: com.burritoz.kai Package: com.burritoz.kai
Name: Kai Name: Kai
Version: 0.1.1~alpha
Version: 0.1.2~alpha
Architecture: iphoneos-arm Architecture: iphoneos-arm
Description: Show charging banners on your lock screen! Description: Show charging banners on your lock screen!
Maintainer: burrit0z Maintainer: burrit0z

+ 2
- 2
kaiprefs/KAIRootListController.m View File

CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.burritoz.kaiprefs/reload"), nil, nil, true); CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.burritoz.kaiprefs/reload"), nil, nil, true);


UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Kai" UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Kai"
message:@"Your settings have been applied. You can now go back to your lockscreen (CoverSheet) to see the changes."
message:@"Your settings have been applied. You can now go back to your lockscreen (CoverSheet) to see the changes. \n Note the option to put kai below music requires a respring."
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];


UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Amazing!" style:UIAlertActionStyleDefault UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Amazing!" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}]; handler:^(UIAlertAction * action) {}];
[alert addAction:defaultAction]; [alert addAction:defaultAction];
[self presentViewController:alert animated:YES completion:nil]; [self presentViewController:alert animated:YES completion:nil];
} }



+ 15
- 3
kaiprefs/Resources/Root.plist View File

<string>Right</string> <string>Right</string>
</array> </array>
</dict> </dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.burritoz.kaiprefs</string>
<key>key</key>
<string>belowMusic</string>
<key>label</key>
<string>Show kai Below Music</string>
</dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>label</key> <key>label</key>
<string>Glyph Size (35)</string>
<string>Glyph Size (30)</string>
</dict> </dict>
<dict> <dict>
<key>default</key> <key>default</key>
<real>35</real>
<real>30</real>
<key>cell</key> <key>cell</key>
<string>PSSliderCell</string> <string>PSSliderCell</string>
<key>min</key> <key>min</key>
<real>10</real> <real>10</real>
<key>max</key> <key>max</key>
<real>100</real>
<real>60</real>
<key>isSegmented</key> <key>isSegmented</key>
<false/> <false/>
<key>showValue</key> <key>showValue</key>

Loading…
Cancel
Save