@property (nonatomic, strong) NSLayoutConstraint *heightConstraint; | @property (nonatomic, strong) NSLayoutConstraint *heightConstraint; | ||||
@property (nonatomic, assign) BOOL isUpdating; | @property (nonatomic, assign) BOOL isUpdating; | ||||
+(KAIBattery *)sharedInstance; | +(KAIBattery *)sharedInstance; | ||||
-(void)darkLightMode; | |||||
-(instancetype)init; | -(instancetype)init; | ||||
-(void)updateBattery; | -(void)updateBattery; | ||||
@end | @end |
[self.widthAnchor constraintEqualToConstant:UIScreen.mainScreen.bounds.size.width - 16].active = YES; | [self.widthAnchor constraintEqualToConstant:UIScreen.mainScreen.bounds.size.width - 16].active = YES; | ||||
[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;*/ | [self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;*/ | ||||
[self updateBattery]; | [self updateBattery]; | ||||
[self darkLightMode]; | |||||
self.userInteractionEnabled = NO; | self.userInteractionEnabled = NO; | ||||
//[self addSubview:self.batteryLabel]; | //[self addSubview:self.batteryLabel]; | ||||
} | } | ||||
BOOL charging = MSHookIvar<long long>(device, "_charging"); | BOOL charging = MSHookIvar<long long>(device, "_charging"); | ||||
BOOL LPM = MSHookIvar<BOOL>(device, "_batterySaverModeActive"); | BOOL LPM = MSHookIvar<BOOL>(device, "_batterySaverModeActive"); | ||||
if(charging) { | |||||
BOOL shouldAdd = NO; | |||||
/*UIVisualEffectView *blank; | |||||
if(@available(iOS 12.0, *)) { | |||||
if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { | |||||
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]]; | |||||
} else { | |||||
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; | |||||
} | |||||
} else { | |||||
if(showAll) { | |||||
shouldAdd = YES; | |||||
} else if(!showAll && charging) { | |||||
shouldAdd = YES; | |||||
} | |||||
if(shouldAdd) { | |||||
UIView *blank; | |||||
if(bannerStyle==1) { | |||||
blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil]; | |||||
} else if(bannerStyle==2) { | |||||
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]]; | |||||
} else if(bannerStyle==3) { | |||||
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; | blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; | ||||
}*/ | |||||
MTMaterialView *blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil]; | |||||
//blank.recipeDynamic = NO; //makes it stay light | |||||
blank.frame = CGRectMake(0, 0 + y, self.superview.bounds.size.width - 16, bannerHeight); | |||||
} | |||||
blank.layer.masksToBounds = YES; | blank.layer.masksToBounds = YES; | ||||
blank.layer.continuousCorners = YES; | blank.layer.continuousCorners = YES; | ||||
blank.layer.cornerRadius = cornerRadius; | blank.layer.cornerRadius = cornerRadius; | ||||
//[blank setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1]]; | |||||
NSString *labelText = [NSString stringWithFormat:@"%@", deviceName]; | NSString *labelText = [NSString stringWithFormat:@"%@", deviceName]; | ||||
UILabel *label = [[UILabel alloc] init]; | UILabel *label = [[UILabel alloc] init]; | ||||
if(!hideDeviceLabel) { | |||||
[label setFont:[UIFont systemFontOfSize:16]]; | [label setFont:[UIFont systemFontOfSize:16]]; | ||||
} else if(hideDeviceLabel) { | |||||
[label setFont:[UIFont systemFontOfSize:0]]; | |||||
} | |||||
[label setTextColor:[UIColor whiteColor]]; | [label setTextColor:[UIColor whiteColor]]; | ||||
label.lineBreakMode = NSLineBreakByWordWrapping; | label.lineBreakMode = NSLineBreakByWordWrapping; | ||||
label.numberOfLines = 0; | label.numberOfLines = 0; | ||||
[self addSubview:battery]; | [self addSubview:battery]; | ||||
[self addSubview:glyphView]; | [self addSubview:glyphView]; | ||||
blank.translatesAutoresizingMaskIntoConstraints = NO; | |||||
if(bannerAlign==2) { //center | |||||
[blank.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = YES; | |||||
} else if(bannerAlign==1) { //left | |||||
[blank.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES; | |||||
} else if(bannerAlign==3) { //right | |||||
[blank.rightAnchor constraintEqualToAnchor:self.rightAnchor].active = YES; | |||||
} | |||||
[blank.topAnchor constraintEqualToAnchor:self.topAnchor constant:y].active = YES; | |||||
[blank.widthAnchor constraintEqualToConstant:((self.superview.bounds.size.width - 16) + bannerWidthFactor)].active = YES; | |||||
[blank.heightAnchor constraintEqualToConstant:bannerHeight].active = YES; | |||||
//percentLabel.frame = CGRectMake(self.superview.bounds.size.width - 16 - 94,35 + y,36,12); | |||||
percentLabel.translatesAutoresizingMaskIntoConstraints = NO; | |||||
[percentLabel.leftAnchor constraintEqualToAnchor:blank.rightAnchor constant:(- 94)].active = YES; | |||||
[percentLabel.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; | |||||
[percentLabel.widthAnchor constraintEqualToConstant:36].active = YES; | |||||
[percentLabel.heightAnchor constraintEqualToConstant:12].active = YES; | |||||
//label.frame = CGRectMake(65.5,27.5 + y,275,25); | //label.frame = CGRectMake(65.5,27.5 + y,275,25); | ||||
label.translatesAutoresizingMaskIntoConstraints = NO; | label.translatesAutoresizingMaskIntoConstraints = NO; | ||||
[label.leftAnchor constraintEqualToAnchor:glyphView.rightAnchor constant:4.5].active = YES; | [label.leftAnchor constraintEqualToAnchor:glyphView.rightAnchor constant:4.5].active = YES; | ||||
[label.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; | [label.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; | ||||
[label.widthAnchor constraintEqualToConstant:275].active = YES; | |||||
[label.rightAnchor constraintEqualToAnchor:percentLabel.leftAnchor constant:7].active = YES; | |||||
[label.heightAnchor constraintEqualToConstant:25].active = YES; | [label.heightAnchor constraintEqualToConstant:25].active = YES; | ||||
//glyphView.frame = CGRectMake(20.5,18.5 + y,40,40); | //glyphView.frame = CGRectMake(20.5,18.5 + y,40,40); | ||||
//battery.frame = CGRectMake(self.superview.bounds.size.width - 16 - 49,35 + y,20,10); | //battery.frame = CGRectMake(self.superview.bounds.size.width - 16 - 49,35 + y,20,10); | ||||
battery.translatesAutoresizingMaskIntoConstraints = NO; | battery.translatesAutoresizingMaskIntoConstraints = NO; | ||||
[battery.leftAnchor constraintEqualToAnchor:self.rightAnchor constant:(- 49)].active = YES; | |||||
[battery.leftAnchor constraintEqualToAnchor:blank.rightAnchor constant:(- 49)].active = YES; | |||||
[battery.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; | [battery.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; | ||||
[battery.widthAnchor constraintEqualToConstant:20].active = YES; | [battery.widthAnchor constraintEqualToConstant:20].active = YES; | ||||
[battery.heightAnchor constraintEqualToConstant:10].active = YES; | [battery.heightAnchor constraintEqualToConstant:10].active = YES; | ||||
//percentLabel.frame = CGRectMake(self.superview.bounds.size.width - 16 - 94,35 + y,36,12); | |||||
percentLabel.translatesAutoresizingMaskIntoConstraints = NO; | |||||
[percentLabel.leftAnchor constraintEqualToAnchor:self.rightAnchor constant:(- 94)].active = YES; | |||||
[percentLabel.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; | |||||
[percentLabel.widthAnchor constraintEqualToConstant:36].active = YES; | |||||
[percentLabel.heightAnchor constraintEqualToConstant:12].active = YES; | |||||
y+=bannerHeight + spacing; | y+=bannerHeight + spacing; | ||||
self.number +=1; | self.number +=1; | ||||
//blank.alpha = 0.8; | //blank.alpha = 0.8; | ||||
} | } | ||||
//[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES; | //[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES; | ||||
self.isUpdating = NO; | self.isUpdating = NO; | ||||
[self darkLightMode]; | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
return instance; | return instance; | ||||
} | } | ||||
-(void)darkLightMode { | |||||
/*for(UIVisualEffectView *view in self.subviews) { | |||||
if(@available(iOS 12.0, *)) { | |||||
if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { | |||||
if([view respondsToSelector:@selector(setEffect:)]) view.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; | |||||
} | |||||
else { | |||||
if([view respondsToSelector:@selector(setEffect:)]) view.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; | |||||
} | |||||
} | |||||
}*/ | |||||
} | |||||
@end | @end |
@property (nonatomic, assign) BOOL continuousCorners; | @property (nonatomic, assign) BOOL continuousCorners; | ||||
@end | @end | ||||
BOOL isUpdating = NO; | |||||
//prefs | //prefs | ||||
BOOL enabled; | BOOL enabled; | ||||
BOOL disableGlyphs; | BOOL disableGlyphs; | ||||
BOOL hidePercent; | BOOL hidePercent; | ||||
BOOL showAll; | |||||
BOOL hideDeviceLabel; | |||||
NSInteger bannerStyle; | |||||
NSInteger bannerAlign; | |||||
double spacing; | double spacing; | ||||
double glyphSize; | double glyphSize; | ||||
double bannerHeight; | double bannerHeight; | ||||
double cornerRadius; | double cornerRadius; | ||||
double bannerWidthFactor; | |||||
#import "KAIBattery.mm" | #import "KAIBattery.mm" | ||||
cornerRadius = numberForValue(@"cornerRadius", 13); | cornerRadius = numberForValue(@"cornerRadius", 13); | ||||
disableGlyphs = boolValueForKey(@"disableGlyphs", NO); | disableGlyphs = boolValueForKey(@"disableGlyphs", NO); | ||||
hidePercent = boolValueForKey(@"hidePercent", NO); | hidePercent = boolValueForKey(@"hidePercent", NO); | ||||
bannerStyle = numberForValue(@"bannerStyle", 1); | |||||
showAll = boolValueForKey(@"showAll", NO); | |||||
bannerWidthFactor = numberForValue(@"bannerWidthFactor", 0); | |||||
hideDeviceLabel = boolValueForKey(@"hideDeviceLabel", NO); | |||||
bannerAlign = numberForValue(@"bannerAlign", 2); | |||||
if(disableGlyphs) { | if(disableGlyphs) { | ||||
glyphSize = 0; | glyphSize = 0; | ||||
} | } | ||||
} | |||||
static void applyPrefs() | |||||
{ | |||||
preferencesChanged(); | |||||
isUpdating = YES; | |||||
[UIView animateWithDuration:0.3 animations:^{ | |||||
[KAIBattery sharedInstance].alpha = 0; | |||||
} completion:^(BOOL finished){ | |||||
[[KAIBattery sharedInstance] updateBattery]; | |||||
[(CSAdjunctListView *)([KAIBattery sharedInstance].superview.superview) KaiUpdate]; | |||||
[UIView animateWithDuration:0.35 animations:^{ | |||||
[KAIBattery sharedInstance].alpha = 1; | |||||
} completion:^(BOOL finished){ | |||||
isUpdating = NO; | |||||
}]; | |||||
}]; | |||||
} | } |
#import "Kai.h" | #import "Kai.h" | ||||
%hook KAITarget | %hook KAITarget | ||||
%property (nonatomic, assign) BOOL hasKai; | %property (nonatomic, assign) BOOL hasKai; | ||||
name:@"KaiInfoChanged" | name:@"KaiInfoChanged" | ||||
object:nil]; | object:nil]; | ||||
KAISelf.hasKai = YES; | KAISelf.hasKai = YES; | ||||
[[KAIBattery sharedInstance] darkLightMode]; | |||||
UIStackView *newView = arg1; | UIStackView *newView = arg1; | ||||
%new | %new | ||||
-(void)KaiUpdate { | -(void)KaiUpdate { | ||||
[[KAIBattery sharedInstance] darkLightMode]; | |||||
KAIBattery *battery = [KAIBattery sharedInstance]; | KAIBattery *battery = [KAIBattery sharedInstance]; | ||||
[UIView animateWithDuration:0.3 animations:^{ | [UIView animateWithDuration:0.3 animations:^{ | ||||
battery.heightConstraint.active = YES; | battery.heightConstraint.active = YES; | ||||
} else { | } else { | ||||
int height = (battery.number * (80 + spacing)); | |||||
int height = (battery.number * (bannerHeight + spacing)); | |||||
battery.heightConstraint.active = NO; | battery.heightConstraint.active = NO; | ||||
NSLog(@"kai: setting to %d", height); | NSLog(@"kai: setting to %d", height); | ||||
battery.heightConstraint.constant = height; | battery.heightConstraint.constant = height; | ||||
%new | %new | ||||
-(void)KaiInfo { | -(void)KaiInfo { | ||||
[UIView animateWithDuration:0.3 animations:^{ | |||||
[KAIBattery sharedInstance].alpha = 0; | |||||
} completion:^(BOOL finished){ | |||||
[[KAIBattery sharedInstance] updateBattery]; | |||||
[self KaiUpdate]; | |||||
[UIView animateWithDuration:0.35 animations:^{ | |||||
[KAIBattery sharedInstance].alpha = 1; | |||||
if(!isUpdating) { | |||||
isUpdating = YES; | |||||
[UIView animateWithDuration:0.3 animations:^{ | |||||
[KAIBattery sharedInstance].alpha = 0; | |||||
} completion:^(BOOL finished){ | |||||
[[KAIBattery sharedInstance] updateBattery]; | |||||
[self KaiUpdate]; | |||||
[UIView animateWithDuration:0.35 animations:^{ | |||||
[KAIBattery sharedInstance].alpha = 1; | |||||
} completion:^(BOOL finished){ | |||||
isUpdating = NO; | |||||
}]; | |||||
}]; | }]; | ||||
}]; | |||||
[[KAIBattery sharedInstance] updateBattery]; | |||||
[self KaiUpdate]; | |||||
} | |||||
} | } | ||||
%end | %end | ||||
- (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:@"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:@"powerSourceState" options:NSKeyValueObservingOptionNew context:nil]; | |||||
[self addObserver:self forKeyPath:@"batterySaverModeActive" options:NSKeyValueObservingOptionNew context:nil]; | [self addObserver:self forKeyPath:@"batterySaverModeActive" options:NSKeyValueObservingOptionNew context:nil]; | ||||
[self addObserver:self forKeyPath:@"percentCharge" options:NSKeyValueObservingOptionNew context:nil]; | [self addObserver:self forKeyPath:@"percentCharge" options:NSKeyValueObservingOptionNew context:nil]; | ||||
%ctor { | %ctor { | ||||
preferencesChanged(); | preferencesChanged(); | ||||
CFNotificationCenterAddObserver( | |||||
CFNotificationCenterGetDarwinNotifyCenter(), | |||||
&observer, | |||||
(CFNotificationCallback)applyPrefs, | |||||
kSettingsChangedNotification, | |||||
NULL, | |||||
CFNotificationSuspensionBehaviorDeliverImmediately | |||||
); | |||||
Class cls = kCFCoreFoundationVersionNumber > 1600 ? ([objc_getClass("CSAdjunctListView") class]) : ([objc_getClass("SBDashBoardAdjunctListView") class]); | Class cls = kCFCoreFoundationVersionNumber > 1600 ? ([objc_getClass("CSAdjunctListView") class]) : ([objc_getClass("SBDashBoardAdjunctListView") class]); | ||||
if(enabled) { | if(enabled) { | ||||
%init(KAITarget = cls); | %init(KAITarget = cls); |
name = kai | |||||
lowername = kai | |||||
# Build file for kai | |||||
# Generated at 05/20/20 13:44:10 | |||||
pdirname = .dragon | |||||
location = /Library/MobileSubstrate/DynamicLibraries/ | |||||
resource_dir = Resources | |||||
target = $pdirname/_$location$name.dylib | |||||
stage2 = cp $name.plist $ | |||||
.dragon/_/Library/MobileSubstrate/DynamicLibraries/$name.plist | |||||
builddir = $pdirname/build | |||||
objdir = $pdirname/obj | |||||
signdir = $pdirname/sign | |||||
signtarget = $signdir/$target.unsigned | |||||
symtarget = $signdir/$target.unsym | |||||
dragondir = $$DRAGONBUILD | |||||
pwd = . | |||||
sysroot = $dragondir/sdks/iPhoneOS.sdk | |||||
fwSearch = -F$sysroot/System/Library/Frameworks $ | |||||
-F$sysroot/System/Library/PrivateFrameworks -F$dragondir/frameworks | |||||
libSearch = -L$dragondir/lib -L. | |||||
cc = clang++ | |||||
ccpp = clang++ | |||||
ld = clang++ | |||||
ldid = ldid | |||||
dsym = dsymutil | |||||
logos = $dragondir/bin/logos.pl | |||||
plutil = plutil | |||||
stage = true; | |||||
targetios = 10.0 | |||||
frameworks = -framework BatteryCenter -framework CoreFoundation -framework $ | |||||
Foundation -framework UIKit -framework CoreGraphics -framework $ | |||||
QuartzCore -framework CoreImage -framework AudioToolbox | |||||
libs = -lsubstrate -lobjc -lc++ | |||||
arc = -fobjc-arc | |||||
btarg = -DTARGET_IPHONE=1 | |||||
warnings = -Wall | |||||
optim = -O0 | |||||
debug = -fcolor-diagnostics | |||||
header_includes = | |||||
cinclude = -I$dragondir/include -I$dragondir/vendor/include $ | |||||
-I$dragondir/include/_fallback -I$DRAGONBUILD/headers/ -I$pwd | |||||
usrCflags = | |||||
usrLDflags = | |||||
usrLDIDFlags = -S | |||||
lopt = -dynamiclib -ggdb -Xlinker -segalign -Xlinker 4000 | |||||
typeldflags = -install_name $location$name | |||||
cflags = $cinclude -fmodules -fcxx-modules -fmodule-name=$name $ | |||||
-fbuild-session-file=.dragon/modules/ -fmodules-prune-after=345600 $ | |||||
-fmodules-prune-interval=86400 $ | |||||
-fmodules-validate-once-per-build-session $arc $fwSearch $ | |||||
-miphoneos-version-min=$targetios -isysroot $sysroot $btarg $warnings $ | |||||
$optim $debug $usrCflags $header_includes | |||||
lflags = $cflags $typeldflags $frameworks $libs $lopt $libSearch $usrLDflags | |||||
ldflags = $usrLDFlags | |||||
pool solo | |||||
depth = 1 | |||||
rule prelogos | |||||
command = cat $in | python3 $$DRAGONBUILD/bin/prelogos.py > $out | |||||
description = Processing $in with Pre/Logos | |||||
rule logos | |||||
command = $logos $in > $out | |||||
description = Processing $in with Logos | |||||
rule compilearm64 | |||||
command = $cc -arch arm64 $cflags -c $in -o $out | |||||
description = Compiling $in for arm64 | |||||
rule compilexxarm64 | |||||
command = $cxx -arch arm64 $cflags -c $in -o $out | |||||
description = Compiling $in for arm64 | |||||
rule linkarm64 | |||||
command = $ld -arch arm64 $lflags -o $out $in | |||||
description = Linking $name for arm64 | |||||
rule compilearm64e | |||||
command = $cc -arch arm64e $cflags -c $in -o $out | |||||
description = Compiling $in for arm64e | |||||
rule compilexxarm64e | |||||
command = $cxx -arch arm64e $cflags -c $in -o $out | |||||
description = Compiling $in for arm64e | |||||
rule linkarm64e | |||||
command = $ld -arch arm64e $lflags -o $out $in | |||||
description = Linking $name for arm64e | |||||
rule compilearmv7 | |||||
command = $cc -arch armv7 $cflags -c $in -o $out | |||||
description = Compiling $in for armv7 | |||||
rule compilexxarmv7 | |||||
command = $cxx -arch armv7 $cflags -c $in -o $out | |||||
description = Compiling $in for armv7 | |||||
rule linkarmv7 | |||||
command = $ld -arch armv7 $lflags -o $out $in | |||||
description = Linking $name for armv7 | |||||
rule compilex86_64 | |||||
command = $cc -arch x86_64 $cflags -c $in -o $out | |||||
description = Compiling $in for x86_64 | |||||
rule compilexxx86_64 | |||||
command = $cxx -arch x86_64 $cflags -c $in -o $out | |||||
description = Compiling $in for x86_64 | |||||
rule linkx86_64 | |||||
command = $ld -arch x86_64 $lflags -o $out $in | |||||
description = Linking $name for x86_64 | |||||
rule lipo | |||||
command = lipo -create $in -output $out | |||||
description = Merging architectures | |||||
rule bundle | |||||
command = mkdir -p ".dragon/_$location/" && cp -r "$resource_dir/" $ | |||||
".dragon/_$location" && cp $in $out | |||||
description = Copying Bundle Resources | |||||
pool = solo | |||||
rule plist | |||||
command = $plutil -convert binary1 $in -o $out | |||||
description = Converting $in | |||||
rule debug | |||||
command = $dsym "$in" 2&> /dev/null; cp $in $out | |||||
description = Generating Debug Symbols for $name | |||||
rule sign | |||||
command = $ldid $usrLDIDFlags $in && cp $in $target | |||||
description = Signing $name | |||||
rule stage | |||||
command = $stage $stage2 | |||||
description = Running Stage for $name | |||||
build $builddir/logos/Kai.xm.mm: logos Kai.xm | |||||
build $builddir/armv7/Kai.xm.mm.o: compilearmv7 $builddir/logos/Kai.xm.mm | |||||
build $builddir/$name.armv7: linkarmv7 $builddir/armv7/Kai.xm.mm.o | |||||
build $builddir/arm64/Kai.xm.mm.o: compilearm64 $builddir/logos/Kai.xm.mm | |||||
build $builddir/$name.arm64: linkarm64 $builddir/arm64/Kai.xm.mm.o | |||||
build $builddir/arm64e/Kai.xm.mm.o: compilearm64e $builddir/logos/Kai.xm.mm | |||||
build $builddir/$name.arm64e: linkarm64e $builddir/arm64e/Kai.xm.mm.o | |||||
build $builddir/trash/stage: stage $target | |||||
build $symtarget: lipo $builddir/$name.armv7 $builddir/$name.arm64 $ | |||||
$builddir/$name.arm64e | |||||
build $signtarget: debug $symtarget | |||||
build $target: sign $signtarget | |||||
default $target $builddir/trash/stage | |||||
-(void)viewDidLoad { | -(void)viewDidLoad { | ||||
[super viewDidLoad]; | [super viewDidLoad]; | ||||
UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Respring" style:UIBarButtonItemStylePlain target:self action:@selector(respring:)]; | |||||
UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Apply" style:UIBarButtonItemStylePlain target:self action:@selector(respring:)]; | |||||
self.navigationItem.rightBarButtonItem = applyButton; | self.navigationItem.rightBarButtonItem = applyButton; | ||||
self.navigationItem.titleView = [UIView new]; | self.navigationItem.titleView = [UIView new]; | ||||
} | } | ||||
-(void)respring:(id)sender { | -(void)respring:(id)sender { | ||||
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.burritoz.kaiprefs/reload"), nil, nil, true); | |||||
tweakBundle = [NSBundle bundleWithPath:@"/Library/PreferenceBundles/MultiplaPrefs.bundle"]; | |||||
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Kai" | |||||
message:@"Your settings have been applied. You can now go back to your lockscreen (CoverSheet) to see the changes." | |||||
preferredStyle:UIAlertControllerStyleAlert]; | |||||
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Respring" | |||||
message:@"Are you sure you want to respring now?" | |||||
preferredStyle:UIAlertControllerStyleActionSheet]; | |||||
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel | |||||
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Amazing!" style:UIAlertActionStyleDefault | |||||
handler:^(UIAlertAction * action) {}]; | handler:^(UIAlertAction * action) {}]; | ||||
UIAlertAction* yes = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive | |||||
handler:^(UIAlertAction * action) { | |||||
NSTask *t = [[NSTask alloc] init]; | |||||
[t setLaunchPath:@"usr/bin/killall"]; | |||||
[t setArguments:[NSArray arrayWithObjects:@"backboardd", nil]]; | |||||
[t launch]; | |||||
}]; | |||||
[alert addAction:defaultAction]; | [alert addAction:defaultAction]; | ||||
[alert addAction:yes]; | |||||
[self presentViewController:alert animated:YES completion:nil]; | [self presentViewController:alert animated:YES completion:nil]; | ||||
} | } | ||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSGroupCell</string> | <string>PSGroupCell</string> | ||||
</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>showAll</string> | |||||
<key>label</key> | |||||
<string>Show all devices</string> | |||||
</dict> | |||||
<dict> | <dict> | ||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSwitchCell</string> | <string>PSSwitchCell</string> | ||||
<key>label</key> | <key>label</key> | ||||
<string>Hide Percent Label</string> | <string>Hide Percent Label</string> | ||||
</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>hideDeviceLabel</string> | |||||
<key>label</key> | |||||
<string>Hide Device Name Label</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
<key>label</key> | |||||
<string>Banner Style</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSSegmentCell</string> | |||||
<key>defaults</key> | |||||
<string>com.burritoz.kaiprefs</string> | |||||
<key>default</key> | |||||
<string>1</string> | |||||
<key>key</key> | |||||
<string>bannerStyle</string> | |||||
<key>validValues</key> | |||||
<array> | |||||
<string>1</string> | |||||
<string>2</string> | |||||
<string>3</string> | |||||
</array> | |||||
<key>validTitles</key> | |||||
<array> | |||||
<string>Automatic</string> | |||||
<string>Dark</string> | |||||
<string>Light</string> | |||||
</array> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
<key>label</key> | |||||
<string>Banner Alignment</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSSegmentCell</string> | |||||
<key>defaults</key> | |||||
<string>com.burritoz.kaiprefs</string> | |||||
<key>default</key> | |||||
<string>2</string> | |||||
<key>key</key> | |||||
<string>bannerAlign</string> | |||||
<key>validValues</key> | |||||
<array> | |||||
<string>1</string> | |||||
<string>2</string> | |||||
<string>3</string> | |||||
</array> | |||||
<key>validTitles</key> | |||||
<array> | |||||
<string>Left</string> | |||||
<string>Center</string> | |||||
<string>Right</string> | |||||
</array> | |||||
</dict> | |||||
<dict> | <dict> | ||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSGroupCell</string> | <string>PSGroupCell</string> | ||||
<key>min</key> | <key>min</key> | ||||
<real>20</real> | <real>20</real> | ||||
<key>max</key> | <key>max</key> | ||||
<real>200</real> | |||||
<real>400</real> | |||||
<key>isSegmented</key> | <key>isSegmented</key> | ||||
<false/> | <false/> | ||||
<key>showValue</key> | <key>showValue</key> | ||||
<key>key</key> | <key>key</key> | ||||
<string>bannerHeight</string> | <string>bannerHeight</string> | ||||
</dict> | </dict> | ||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
<key>label</key> | |||||
<string>Banner Width Adjustment (0)</string> | |||||
</dict> | |||||
<dict> | |||||
<key>default</key> | |||||
<real>0</real> | |||||
<key>cell</key> | |||||
<string>PSSliderCell</string> | |||||
<key>min</key> | |||||
<real>-400</real> | |||||
<key>max</key> | |||||
<real>400</real> | |||||
<key>isSegmented</key> | |||||
<false/> | |||||
<key>showValue</key> | |||||
<true/> | |||||
<key>defaults</key> | |||||
<string>com.burritoz.kaiprefs</string> | |||||
<key>key</key> | |||||
<string>bannerWidthFactor</string> | |||||
</dict> | |||||
<dict> | <dict> | ||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSGroupCell</string> | <string>PSGroupCell</string> | ||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSliderCell</string> | <string>PSSliderCell</string> | ||||
<key>min</key> | <key>min</key> | ||||
<real>0.0</real> | |||||
<real>-100.0</real> | |||||
<key>max</key> | <key>max</key> | ||||
<real>100</real> | |||||
<real>300</real> | |||||
<key>isSegmented</key> | <key>isSegmented</key> | ||||
<false/> | <false/> | ||||
<key>showValue</key> | <key>showValue</key> | ||||
<key>cell</key> | <key>cell</key> | ||||
<string>PSSliderCell</string> | <string>PSSliderCell</string> | ||||
<key>min</key> | <key>min</key> | ||||
<real>0.1</real> | |||||
<real>0.0</real> | |||||
<key>max</key> | <key>max</key> | ||||
<real>100</real> | <real>100</real> | ||||
<key>isSegmented</key> | <key>isSegmented</key> |
name = kaiPrefs | |||||
lowername = kaiprefs | |||||
# Build file for kaiPrefs | |||||
# Generated at 05/20/20 13:44:10 | |||||
pdirname = .dragon | |||||
location = /Library/PreferenceBundles/$name.bundle/ | |||||
resource_dir = Resources | |||||
target = $pdirname/_$location$name | |||||
stage2 = | |||||
builddir = $pdirname/build | |||||
objdir = $pdirname/obj | |||||
signdir = $pdirname/sign | |||||
signtarget = $signdir/$target.unsigned | |||||
symtarget = $signdir/$target.unsym | |||||
dragondir = $$DRAGONBUILD | |||||
pwd = . | |||||
sysroot = $dragondir/sdks/iPhoneOS.sdk | |||||
fwSearch = -F$sysroot/System/Library/Frameworks $ | |||||
-F$sysroot/System/Library/PrivateFrameworks -F$dragondir/frameworks | |||||
libSearch = -L$dragondir/lib -L. | |||||
cc = clang++ | |||||
ccpp = clang++ | |||||
ld = clang++ | |||||
ldid = ldid | |||||
dsym = dsymutil | |||||
logos = $dragondir/bin/logos.pl | |||||
plutil = plutil | |||||
stage = mkdir -p .dragon/_/Library/PreferenceLoader/Preferences/ && cp $ | |||||
entry.plist .dragon/_/Library/PreferenceLoader/Preferences/$name.plist | |||||
targetios = 10.0 | |||||
frameworks = -framework Preferences -framework CoreFoundation -framework $ | |||||
Foundation -framework UIKit -framework CoreGraphics -framework $ | |||||
QuartzCore -framework CoreImage -framework AudioToolbox | |||||
libs = -lobjc -lc++ | |||||
arc = -fobjc-arc | |||||
btarg = -DTARGET_IPHONE=1 | |||||
warnings = -Wall | |||||
optim = -O0 | |||||
debug = -fcolor-diagnostics | |||||
header_includes = | |||||
cinclude = -I$dragondir/include -I$dragondir/vendor/include $ | |||||
-I$dragondir/include/_fallback -I$DRAGONBUILD/headers/ -I$pwd | |||||
usrCflags = | |||||
usrLDflags = | |||||
usrLDIDFlags = -S | |||||
lopt = -dynamiclib -ggdb -Xlinker -segalign -Xlinker 4000 | |||||
typeldflags = -install_name $location$name | |||||
cflags = $cinclude -fmodules -fcxx-modules -fmodule-name=$name $ | |||||
-fbuild-session-file=.dragon/modules/ -fmodules-prune-after=345600 $ | |||||
-fmodules-prune-interval=86400 $ | |||||
-fmodules-validate-once-per-build-session $arc $fwSearch $ | |||||
-miphoneos-version-min=$targetios -isysroot $sysroot $btarg $warnings $ | |||||
$optim $debug $usrCflags $header_includes | |||||
lflags = $cflags $typeldflags $frameworks $libs $lopt $libSearch $usrLDflags | |||||
ldflags = $usrLDFlags | |||||
pool solo | |||||
depth = 1 | |||||
rule prelogos | |||||
command = cat $in | python3 $$DRAGONBUILD/bin/prelogos.py > $out | |||||
description = Processing $in with Pre/Logos | |||||
rule logos | |||||
command = $logos $in > $out | |||||
description = Processing $in with Logos | |||||
rule compilearm64 | |||||
command = $cc -arch arm64 $cflags -c $in -o $out | |||||
description = Compiling $in for arm64 | |||||
rule compilexxarm64 | |||||
command = $cxx -arch arm64 $cflags -c $in -o $out | |||||
description = Compiling $in for arm64 | |||||
rule linkarm64 | |||||
command = $ld -arch arm64 $lflags -o $out $in | |||||
description = Linking $name for arm64 | |||||
rule compilearm64e | |||||
command = $cc -arch arm64e $cflags -c $in -o $out | |||||
description = Compiling $in for arm64e | |||||
rule compilexxarm64e | |||||
command = $cxx -arch arm64e $cflags -c $in -o $out | |||||
description = Compiling $in for arm64e | |||||
rule linkarm64e | |||||
command = $ld -arch arm64e $lflags -o $out $in | |||||
description = Linking $name for arm64e | |||||
rule compilearmv7 | |||||
command = $cc -arch armv7 $cflags -c $in -o $out | |||||
description = Compiling $in for armv7 | |||||
rule compilexxarmv7 | |||||
command = $cxx -arch armv7 $cflags -c $in -o $out | |||||
description = Compiling $in for armv7 | |||||
rule linkarmv7 | |||||
command = $ld -arch armv7 $lflags -o $out $in | |||||
description = Linking $name for armv7 | |||||
rule compilex86_64 | |||||
command = $cc -arch x86_64 $cflags -c $in -o $out | |||||
description = Compiling $in for x86_64 | |||||
rule compilexxx86_64 | |||||
command = $cxx -arch x86_64 $cflags -c $in -o $out | |||||
description = Compiling $in for x86_64 | |||||
rule linkx86_64 | |||||
command = $ld -arch x86_64 $lflags -o $out $in | |||||
description = Linking $name for x86_64 | |||||
rule lipo | |||||
command = lipo -create $in -output $out | |||||
description = Merging architectures | |||||
rule bundle | |||||
command = mkdir -p ".dragon/_$location/" && cp -r "$resource_dir/" $ | |||||
".dragon/_$location" && cp $in $out | |||||
description = Copying Bundle Resources | |||||
pool = solo | |||||
rule plist | |||||
command = $plutil -convert binary1 $in -o $out | |||||
description = Converting $in | |||||
rule debug | |||||
command = $dsym "$in" 2&> /dev/null; cp $in $out | |||||
description = Generating Debug Symbols for $name | |||||
rule sign | |||||
command = $ldid $usrLDIDFlags $in && cp $in $target | |||||
description = Signing $name | |||||
rule stage | |||||
command = $stage $stage2 | |||||
description = Running Stage for $name | |||||
build $builddir/arm64/KAIRootListController.m.o: compilearm64 $ | |||||
KAIRootListController.m | |||||
build $builddir/$name.arm64: linkarm64 $ | |||||
$builddir/arm64/KAIRootListController.m.o | |||||
build $builddir/arm64e/KAIRootListController.m.o: compilearm64e $ | |||||
KAIRootListController.m | |||||
build $builddir/$name.arm64e: linkarm64e $ | |||||
$builddir/arm64e/KAIRootListController.m.o | |||||
build $builddir/trash/bundles: bundle build.ninja | |||||
build $builddir/trash/stage: stage $target | |||||
build $symtarget: lipo $builddir/$name.arm64 $builddir/$name.arm64e | |||||
build $signtarget: debug $symtarget | |||||
build $target: sign $signtarget | |||||
default $target $builddir/trash/bundles $builddir/trash/stage | |||||