Browse Source

ios 12

pull/1/head
Burrit0z 4 years ago
parent
commit
38dce47564
3 changed files with 206 additions and 41 deletions
  1. +24
    -40
      Kai.xm
  2. +181
    -0
      build.ninja
  3. +1
    -1
      control

+ 24
- 40
Kai.xm View File

#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>


#import "KAIBattery.mm" #import "KAIBattery.mm"
#define KAISelf ((CSAdjunctListView *)self)


@interface UIApplication (Kai) @interface UIApplication (Kai)
+(id)sharedApplication; +(id)sharedApplication;
-(void)KaiUpdate; -(void)KaiUpdate;
@end @end


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

@interface CSMainPageView : UIView @interface CSMainPageView : UIView
-(void)updateForPresentation:(id)arg1; -(void)updateForPresentation:(id)arg1;
@end @end
+(id)constraintWithAnchor:(id)arg1 relatedBy:(long long)arg2 toAnchor:(id)arg3 multiplier:(double)arg4 constant:(double)arg5 ; +(id)constraintWithAnchor:(id)arg1 relatedBy:(long long)arg2 toAnchor:(id)arg3 multiplier:(double)arg4 constant:(double)arg5 ;
@end @end


//NSLayoutConstraint *globalC;

CGRect original = CGRectMake(0,0,0,0);
CGRect originalBattery;



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


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


-(void)setStackView:(UIStackView *)arg1 { -(void)setStackView:(UIStackView *)arg1 {


if(!self.hasKai) {
if(!KAISelf.hasKai) {
KAIBattery *battery = [[KAIBattery alloc] init]; KAIBattery *battery = [[KAIBattery alloc] init];
//when you setup your constraint:

//battery.translatesAutoresizingMaskIntoConstraints = NO;
//[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;
original = [self stackView].frame;
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(KaiInfo) selector:@selector(KaiInfo)
name:@"KaiInfoChanged" name:@"KaiInfoChanged"
object:nil]; object:nil];
self.hasKai = YES;
KAISelf.hasKai = YES;
[[KAIBattery sharedInstance] darkLightMode]; [[KAIBattery sharedInstance] darkLightMode];


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


if(![arg1.subviews containsObject:battery]) { if(![arg1.subviews containsObject:battery]) {
[newView addArrangedSubview: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);
-(void)KaiUpdate { -(void)KaiUpdate {
[[KAIBattery sharedInstance] darkLightMode]; [[KAIBattery sharedInstance] darkLightMode];
KAIBattery *battery = [KAIBattery sharedInstance]; KAIBattery *battery = [KAIBattery sharedInstance];
//battery.translatesAutoresizingMaskIntoConstraints = YES;
//[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
[UIView animateWithDuration:0.3 animations:^{

//to disable the constraint:
//battery.heightConstraint.active = NO;


//to change the constant:
//battery.heightConstraint.constant = (battery.number * 85);
[UIView animateWithDuration:0.3 animations:^{


if(!battery.heightConstraint) { if(!battery.heightConstraint) {


} else { } else {
int height = (battery.number * 85); int height = (battery.number * 85);
if(height!=0) {
battery.heightConstraint.active = NO;
NSLog(@"kai: setting to %d", height);
battery.heightConstraint.constant = height;
battery.heightConstraint.active = YES;

UIStackView *s = [self stackView];
s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1));
}
battery.heightConstraint.active = NO;
NSLog(@"kai: setting to %d", height);
battery.heightConstraint.constant = height;
battery.heightConstraint.active = YES;

UIStackView *s = [self stackView];
s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1));
} }


}]; }];


%new %new
-(void)KaiInfo { -(void)KaiInfo {
//NSLog(@"Kai: Updating Info");
[[KAIBattery sharedInstance] updateBattery]; [[KAIBattery sharedInstance] updateBattery];
[self KaiUpdate]; [self KaiUpdate];
} }
[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];


//[self setValue:@"crash" forKeyPath:@"euhidehuud"];

return %orig; return %orig;
} }


} }


%end %end

%ctor {
Class cls = kCFCoreFoundationVersionNumber > 1600 ? ([objc_getClass("CSAdjunctListView") class]) : ([objc_getClass("SBDashBoardAdjunctListView") class]);
%init(KAITarget = cls);
}

+ 181
- 0
build.ninja View File

name = kai
lowername = kai

# Build file for kai
# Generated at 05/20/20 09:51:19

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


+ 1
- 1
control View File

Package: com.burritoz.kai Package: com.burritoz.kai
Name: Kai Name: Kai
Version: 0.0.2
Version: 0.0.3
Architecture: iphoneos-arm Architecture: iphoneos-arm
Description: An awesome MobileSubstrate tweak! Description: An awesome MobileSubstrate tweak!
Maintainer: burrit0z Maintainer: burrit0z

Loading…
Cancel
Save