#development

1 messages · Page 231 of 1

magic hazel
#

Aight I’ve done it, $5 per tweak please

#

./j

#

so cool it works tho

manic forum
#

iproxy 2222 22, then ssh -p2222 root@0

crisp frost
#

Or just do

#

ssh -o 'ProxyCommand=inetcat 22' -o 'UserKnownHostsFile /dev/null' -o 'StrictHostKeyChecking no' root@frcoal

magic hazel
#

yeah i cant be assed to do allat

crisp frost
#

Yes

#

it will work

#

trust

magic hazel
#

i forgot linux goes off at me when i plug my device into it

#

ill run it

manic forum
crisp frost
#

make sure to have libimobiledevice installed for inetcat

manic forum
#

In a new Terminal window,```
sudo systemctl stop usbmuxd
sudo usbmuxd -f -p

magic hazel
#

its already installed but it still didnt run

manic forum
#

(I don't know what the flags f p do)

#

But they work

crisp frost
magic hazel
#

it says inetcat not found but that package is installed

crisp frost
#

-p is uhh

manic forum
magic hazel
manic forum
#

I think the package is called libimobiledevice-utils or something

#

Try dnf search libimobiledevice

magic hazel
#

there is a utils pkg

manic forum
#

Yeah

#

That

#

Install that

magic hazel
#

still didnt run

#

eh

#

its fine

crisp frost
#

@magic hazel libusbmuxd-utils

#

I think

magic hazel
#

sure ill try it

#

new error

#

Error connecting to device: Inappropriate ioctl for device

crisp frost
#

yeah idk what all that means

#

works for me

#

😭

manic forum
#

@crisp frost i love fedora

magic hazel
#

okay

#

now i combined 2 hooks

#

time to test

#

hmm thats not what i wanted

#

i shouldve run the green hook first

manic forum
#

Someone should make an ios daemon that automatically installs any package that is sent to a discord channel and resprings

magic hazel
#

@interface SBHomeScreenViewController : UIViewController
@end

@interface _UIStatusBarForegroundView : UIView
@end

%hook _UIStatusBarForegroundView

-(void)didMoveToWindow{
    %orig;
    self.alpha = 0.3;
}

%end

%hook SBHomeScreenViewController

-(void)viewDidLoad {
    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = CGRectMake(0, 0, 200, 50);
    ourView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:ourView];
}

%end```
#

my L code

#

how does one instead make a cicle

#

circle

#

instead of a rectangle

radiant idol
#

that's when you start using stackoverflow

magic hazel
#

oh boy oh boy oh boy

manic forum
#

You could play around with cornerRadius

#

Or use UIBezierPath

magic hazel
#

already arrived at stackoverflow

#

yuck all that code is beyond my current paygrade of debt

manic forum
magic hazel
#

oooh the swift code isn't

#

eh but i wont go into that yet

#

woeis i dont understand any of this

#

maybe i should take like

#

an obj c course

manic forum
magic hazel
#

alr

#

do these methods still work on modern ios btw

radiant idol
#

Objective-C really hasnt drastically changed in a long time

magic hazel
#

UIKit hasn't either?

radiant idol
#

the last "addition" was in 2019 with objc_direct which was a tiny change in retrospect

radiant idol
magic hazel
#

how far should i go into it

#

all the videos?

#

it has some uh

radiant idol
#

they're not directly applicable to tweaks since they're working on apps, so I'd say maybe lecture 8 or 9

magic hazel
#

interesting requirements

radiant idol
#

I just sat and watched them FYI, didnt follow along

magic hazel
#

i am not amazing with OOP

#

ah

radiant idol
#

so maybe get some popcorn and watch idk

magic hazel
#

how did you learn then

#

how did you test that knowledge

radiant idol
#

just trial and error

magic hazel
#

lmao

radiant idol
#

not even joking

magic hazel
#

is the cocoa touch shit relevant at all

radiant idol
#

that just refers to UIKit now pretty much

magic hazel
#

oh okay

#

do i skip the xcode video

radiant idol
#

tbh I don't remember the videos all too well

#

if you want to sure

magic hazel
#

where does wsl store files

vivid dew
#

under there

tepid olive
#

under where ?

vivid dew
magic hazel
#

ERROR: control directory has bad permissions 777 (must be >=0755 and <=0775)
make: *** [/home/jwalr/theos/makefiles/package/deb.mk:70: internal-package] Error 255

#

weird error on wsl

hasty ruin
#

search that error in this server

#

it's a pretty descriptive error though

magic hazel
#

Yeah I tried fixing the perms

#

It didn’t work

#

I might just switch to Linux

#

For iOS dev at least

cloud yacht
#

The same clock class is used in both iOS 7 and 16 for sure

#

Likely older builds too

orchid fulcrum
#

does that mean i have to hook posix_spawn again in the child process, because apparently the launchd spawn mechanism goes something like this
Launchd calls fork/posix_spawn -> the child becomes the generic process called xpcproxy (via xpc messages) -> idk how but that turns into the real process later, the last part is probably where the envs are lost.

tldr: can you clarify what that means

naive kraken
#

whereas the latter posix_spawn is called with the setexec flag

#

(if you hook posix_spawn using instruction replacements you do not need to worry about posix_spawnp, if you don't then you need to reimplement it and interpose it with your reimplementation)

magic hazel
acoustic imp
#

red box

magic hazel
#

indeed

#

alr ima try using some new headers now

#

nooo it didnt work

#

-(void)viewWillAppear {
    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = CGRectMake(0, 0, 200, 50);
    ourView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:ourView];
}

%end```
#

what did i do wrong

radiant idol
#

look closely at the declaration

magic hazel
#

so it draws the rectangle before it shoud?

#

when should i inject then

radiant idol
#

no no

#

look at the declaration

#

the signature of the method

magic hazel
#

wym

radiant idol
#
void viewWillAppear();
void viewWillAppear(bool animated);

in C++ these would these represent the same or different functions?

magic hazel
#

do i need viewWillAppear(true)

radiant idol
#

Right

magic hazel
#

the 2nd wants you to pass in 2 values

radiant idol
#

so in your hook

#

you have - (void)viewWillAppear

magic hazel
#

-(void)viewWillAppear:(true)

radiant idol
#

No, that's just the syntax of the method

#

- (void) viewWillAppear:(BOOL) animated

#

(BOOL) is the argument type

#

animated is the argument name

magic hazel
#

okay so its just viewWillAppear(true)

#

?

#

oh no

#

right

#

but i dont want it to be animated

radiant idol
#
%hook SBHomeScreenSpotlightViewController

-(void)viewWillAppear:(BOOL)animated {
    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = CGRectMake(0, 0, 200, 50);
    ourView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:ourView];
}

%end

it doesnt matter, you're just overriding the original method

#

the original method is - (void)viewWillAppear:(BOOL)animated

#

so you need to match the signature

magic hazel
#

lemme find

#

oh

#

i see

#

so the bool can be empty

#

and itll work

torn oriole
#

dingus

magic hazel
#

indeed

#

that would be me

#

IT WORKED

#

LETS GOOOO

#

W

#

so many of these custom headers seem a bit iffy tho

#

i dont know what 99% of them do

#

like wtf is SBHomeScreenSwitcherModifier.h

#

or SBIconDragPreviewContaining.h

#

idek

radiant idol
#

well look at the method names

#

that may help

magic hazel
#

also what are the "delegate" ones

radiant idol
magic hazel
#

so can i use NCNotificationViewControllerDelegate.h to inject into the noiftication centre

radiant idol
#

maybe try hooking NCNotificationViewController instead

magic hazel
magic hazel
magic hazel
#

cripes its long

#

lemme see if i can find a suitable place to inject

#

oh i can just use viewDidLoad again

#

oh boy

#

that is not what i wanted

#

its doing it on every notification

#

not on the actual view itself

#

although i could do some cool shit with that

#

does quartzcore still exist

#

apparently so

#

rounded corners!

torn oriole
magic hazel
torn oriole
#

youre doing it to the view responsible for being the individual notification cells trol

magic hazel
#

how can itell that

#

it doesn't seem to specifiy there

torn oriole
#

do you have FLEX

magic hazel
#

no

#

i probably should install it

#

ill do that after my lesson

#

Funni rounded corners

#

idk why the advice i see is "make a custom swift extention"

#

when you can literally just use quartzcore

#

and write a singular line

#

ourView.layer.cornerRadius = 5;

radiant idol
#

but dont bother with the naming

magic hazel
#

is there any advantage to writing it like this

#

    @IBInspectable public var cornerRadius: CGFloat {
        set {
            layer.cornerRadius = newValue
        }
        get {
            return layer.cornerRadius
        }
    }

    public func roundCorners(corners: UIRectCorner, radius: CGFloat) {
        let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
        let mask = CAShapeLayer()
        mask.path = path.cgPath
        layer.mask = mask
    }
}
#

ive seen this online quite a few times

radiant idol
#

not at all

magic hazel
#

LMAO ofc there isn't

#

i'm starting to like this

#

it's so fun being able to inject shit into whatever i want

#

feels like the OS is actually mine

#

i have an idea

#

for a tweak

#

but i need a little more knowledge to do it

radiant idol
#

whats ur idea

magic hazel
#

well it's basically knock off bloom but a singular colour

#

i wanna try it

#

but i need to know how to sort the layer so it goes behind the notification, and i need to know how to grab the length and height of each notification

#

idk how i should do that

#

-(void)viewDidLoad {
    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = CGRectMake(0, 0, 200, 50);
    ourView.backgroundColor = [UIColor greenColor];
    ourView.layer.cornerRadius = 5;
    [self.view insertSubview(ourView :belowSubview: )];
}

%end```
#

cooked

#

im so bad at this

#

lmao

#

thats definitely wrong

radiant idol
#

try this

#
%hook NCNotificationViewController

-(void)viewDidLoad {
    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = CGRectMake(0, 0, 200, 50);
    ourView.backgroundColor = [UIColor greenColor];
    ourView.layer.cornerRadius = 5;
    [self.view insertSubview:ourView atIndex:0];
}

%end
magic hazel
#

alr

#

i mean it compiled

#

i cant test it rn

radiant idol
#

L

magic hazel
#

can i just use @import quartzcore;

#

instead of #import <QuartzCore/QuartzCore.h>

magic hazel
#

how do i blur the rectangle

#

i see a method but it's only for 17.0+

#

so uselsss

magic hazel
#

well now i need to be able to do everything else

#

i need to blur, adapt rect to the size of the notif

#

just gonna do an approximation

#

until i can figure out

#

how to actually do it

#

lmao i way overshot

#

i think i got the corner radius close tho

#

grr this is hard without knowing how long it actually should be

#

huh

#

finally

#

thats the one

#

itll only work on my phone tho

#

since it doesn't properly scale to shit

#

i have this example code, is it correct?


-(void)viewDidLoad {
    %orig;

    // Create the blur effect
    UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
    blurView.frame = CGRectMake(0, 0, 300, 60);
    blurView.layer.cornerRadius = 20;
    blurView.clipsToBounds = YES; // Ensure rounded corners are respected

    // Add the blurred view to the main view
    [self.view insertSubview:blurView atIndex:0];
}

%end
#

mmmm no thats not what i wanted

#

oh well

#

i got it

#

lets go

#

it still not exactly what i want but the effect is correct

#

does anyone know how to get the dimensions of a notification at runtime?

acoustic imp
magic hazel
#

im estimating

#

its a fixed rectangle

#

i need the actual dimensions

acoustic imp
#

use flex

#

or jus get it programatically

magic hazel
#

? i can find the exact dimensions w flex, but i want it to adapt

#

depending on the size

acoustic imp
magic hazel
#

where is double ping

#

lmao

magic hazel
#

cant i just grab the dimensions of the current view

acoustic imp
#

no it should be, jus find a ref to the MTMaterial view and gets its dimentions & radius or wtv

magic hazel
#

would this work

#
    %orig;
    
    CGRect notificationFrame = self.view.frame;
    CGFloat width = notificationFrame.size.width;
    CGFloat height = notificationFrame.size.height;
}```
acoustic imp
#

looks like it would

magic hazel
#

idk how to send those values off to the next function tho

acoustic imp
#

setFrame?

magic hazel
#

i need it here:

    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = CGRectMake(0, 0, width, height);
    ourView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.7];
    ourView.layer.cornerRadius = 20;

    ourView.layer.shadowColor = [UIColor greenColor].CGColor;
    ourView.layer.shadowOpacity = 0.7;
    ourView.layer.shadowRadius = 15;
    ourView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:ourView atIndex:1];
}```
acoustic imp
#

so just get it there?

magic hazel
#

i can't because it doesn't grab the right dimensions

magic hazel
magic hazel
acoustic imp
#

how so

magic hazel
#

it literally displayed nothing

#

lol

#

how do i make global variables

#

objects*

acoustic imp
#

debug it with flex

#

jus objc CGFloat width = 0; in the top of the file

magic hazel
#

alr

acoustic imp
#

(idk if u can do th3 = 0 actully)

magic hazel
#
@import QuartzCore;

@interface NCNotificationViewController : UIViewController
@end

CGFloat notificationWidth;
CGFloat notificationHeight;

%hook NCNotificationViewController

-(void)viewDidLayoutSubviews {
    %orig;
    
    notificationWidth = self.view.frame.size.width;
    notificationHeight = self.view.frame.size.height;

    [self viewDidLoad];
}


-(void)viewDidLoad {
    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = CGRectMake(0, 0, notificationWidth, notificationHeight);
    ourView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.7];
    ourView.layer.cornerRadius = 20;

    ourView.layer.shadowColor = [UIColor greenColor].CGColor;
    ourView.layer.shadowOpacity = 0.7;
    ourView.layer.shadowRadius = 15;
    ourView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:ourView atIndex:1];
}

%end```
acoustic imp
#

yep

#

oh

#

does NCNotificationView exist?

magic hazel
#

unsure

acoustic imp
#

use flex rq

magic hazel
#

i dont have flex installed

acoustic imp
#

one sec

#

it doesnt :/

magic hazel
#

uhhhhhhhhhhh

#

my device has now frozen up

acoustic imp
#
@import UIKit;
@import QuartzCore;

@interface NCNotificationViewController : UIViewController
@property (nonatomic, strong) UIView *someTweakPrefix_borderView;
@end

%hook NCNotificationViewController
%property (nonatomic, strong) UIView *someTweakPrefix_borderView;

-(void)viewDidLayoutSubviews {
    %orig;
    
    //notificationWidth = self.view.frame.size.width;
    //notificationHeight = self.view.frame.size.height;
    self.someTweakPrefix_borderView.frame = self.view.bounds;

    [self viewDidLoad];
}


-(void)viewDidLoad {
    %orig;
    self.someTweakPrefix_borderView = [[UIView alloc] init];
    self.someTweakPrefix_borderView.frame = self.view.bounds;
    self.someTweakPrefix_borderView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.7];
    self.someTweakPrefix_borderView.layer.cornerRadius = 20;

    self.someTweakPrefix_borderView.layer.shadowColor = [UIColor greenColor].CGColor;
    self.someTweakPrefix_borderView.layer.shadowOpacity = 0.7;
    self.someTweakPrefix_borderView.layer.shadowRadius = 15;
    self.someTweakPrefix_borderView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:self.someTweakPrefix_borderView atIndex:1];
}

%end```
#

maybe try that idk

#

i jus wrote it in dc

#

@magic hazel

magic hazel
#

im trying to rejailbreak rn

#

idk what happened

acoustic imp
#

😭

magic hazel
#

dopa isnt v stable on a8x

#

seems theres a low success rate

acoustic imp
#

rip

pallid totem
#

i assume

magic hazel
#

probably yeah

acoustic imp
#

make sure to let the device boot up fully, ie: connect to wifi and open up an app

pallid totem
#

kfd try to be reliable challenge

magic hazel
#

landa is stable on my phone

pallid totem
#

alfie made it possible

acoustic imp
#

he still has me blocked :/

pallid totem
#

he has half of the server blocked

magic hazel
#

lmao

#

okay

#

i rejailbroken

#

im seeing now

acoustic imp
magic hazel
#

yep

#

it froze again

#

why is it freezing

acoustic imp
#

remove ur tweak

#

ssh in

#

killall -SEGV SpringBoard

#

dont quote me on 'SEGV'

magic hazel
#

okay it just went into safe mode

#

nvm

#

it just resprun

#

idk whats happening nl

acoustic imp
#

🤦‍♂️

magic hazel
#

it freezes sits there

#

then resprings

#

ill unistall the tweak

#

but idk why it's freezing

acoustic imp
#

remove/diable all other tweaks to

acoustic imp
#

cr4shed or krashkop

magic hazel
#

ima just comment out smthing and see if it fixes it, i cannot be assed to install a logger and attempt to extract it that way for such a basic tweak

acoustic imp
#

i mean if u gonna tweak dev might as well

magic hazel
#

no i havent yet but i also dont really know what you changed

acoustic imp
#

TLDR: added a prpoperty/referance to ur view on the viewcontroller and instead of storring the width/height just applied/set it

magic hazel
#

okay

#

i dont entirely understand what that does but alr

#

im sus it could be this [self viewDidLoad];

magic hazel
acoustic imp
#

~~jus install krashkop 😭 🙏 ~~

acoustic imp
magic hazel
#

its commented out

acoustic imp
magic hazel
#

yeah but then you make another rectangle

#

self.someTweakPrefix_borderView.frame = CGRectMake(0, 0, notificationWidth, notificationHeight);

acoustic imp
#

bounds are just the h/w with the x/y both 0, its the correct way to get the H/W of a view

magic hazel
#

using those variables

acoustic imp
#

self.someTweakPrefix_borderView is the referance to that view

acoustic imp
#

one sec

#

fixed* 😭

magic hazel
#

yeah it throws an error

acoustic imp
#

what

#

i probly spelled sm wrong

magic hazel
#

about those exact variables

acoustic imp
#

send it

magic hazel
#
    self.someTweakPrefix_borderView.frame = CGRectMake(0, 0, notificationWidth, notificationHeight);
                                                             ^
Tweak.x:25:81: error: use of undeclared identifier 'notificationHeight'
    self.someTweakPrefix_borderView.frame = CGRectMake(0, 0, notificationWidth, notificationHeight);
                                                                                ^
2 errors generated.
make[3]: *** [/home/jwalr/theos/makefiles/instance/rules.mk:404: /home/jwalr/tutorial/.theos/obj/debug/arm64/Tweak.x.d67574f8.o] Error 1
make[2]: *** [/home/jwalr/theos/makefiles/instance/library.mk:52: /home/jwalr/tutorial/.theos/obj/debug/arm64/tutorial.dylib] Error 2
make[1]: *** [/home/jwalr/theos/makefiles/instance/library.mk:37: internal-library-all_] Error 2
make: *** [/home/jwalr/theos/makefiles/master/rules.mk:146: tutorial.all.tweak.variables] Error ```
#

lmao

acoustic imp
#

why did u change it

#

jus copy paste what i sent

magic hazel
#

i didnt change shit

#

i copy pasted

#

lol

acoustic imp
#

(re copy paste)

#

CGRectMake(0, 0, notificationWidth, notificationHeight); != CGRectMake(self.view.bounds.size.width, self.view.bounds.size.height, 0, 0);

#

(ignore the placement)

magic hazel
#

same error

acoustic imp
#

send

magic hazel
#

literally word for word the same

acoustic imp
#

did u re copy paste?

magic hazel
#

yes

#

multiple times

#
@import QuartzCore;

@interface NCNotificationViewController : UIViewController
@property (nonatomic, strong) UIView *someTweakPrefix_borderView;
@end

%hook NCNotificationViewController
%property (nonatomic, strong) UIView *someTweakPrefix_borderView;

-(void)viewDidLayoutSubviews {
    %orig;
    
    //notificationWidth = self.view.frame.size.width;
    //notificationHeight = self.view.frame.size.height;
    self.someTweakPrefix_borderView.frame = CGRectMake(self.view.bounds.size.width, self.view.bounds.size.height, 0, 0);

    [self viewDidLoad];
}


-(void)viewDidLoad {
    %orig;
    self.someTweakPrefix_borderView = [[UIView alloc] init];
    self.someTweakPrefix_borderView.frame = CGRectMake(0, 0, notificationWidth, notificationHeight);
    self.someTweakPrefix_borderView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.7];
    self.someTweakPrefix_borderView.layer.cornerRadius = 20;

    self.someTweakPrefix_borderView.layer.shadowColor = [UIColor greenColor].CGColor;
    self.someTweakPrefix_borderView.layer.shadowOpacity = 0.7;
    self.someTweakPrefix_borderView.layer.shadowRadius = 15;
    self.someTweakPrefix_borderView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:self.someTweakPrefix_borderView atIndex:1];
}

%end```
acoustic imp
#

oh shit

#

set self.someTweakPrefix_borderView.frame = CGRectMake(0, 0, notificationWidth, notificationHeight); to self.someTweakPrefix_borderView.frame = CGRectMake(self.view.bounds.size.width, self.view.bounds.size.height, 0, 0);

#

i hate doing this thru discord

magic hazel
#

it compiled but seems really sketch

#

lemme test

acoustic imp
#

😭

magic hazel
#

i still dont really understand the code

#

is the variable you made of type uiview

#

and then you set its dimensions to that of the notif

#

and then pass that

acoustic imp
#

yes its defined here

magic hazel
#

into the next function

magic hazel
#

it froze

acoustic imp
#

see why please

#

of wait

#
@import UIKit;
@import QuartzCore;

@interface NCNotificationViewController : UIViewController
@property (nonatomic, strong) UIView *someTweakPrefix_borderView;
@end

%hook NCNotificationViewController
%property (nonatomic, strong) UIView *someTweakPrefix_borderView;

-(void)viewDidLayoutSubviews {
    %orig;
    
    //notificationWidth = self.view.frame.size.width;
    //notificationHeight = self.view.frame.size.height;
    if(self.someTweakPrefix_borderView){
       self.someTweakPrefix_borderView.frame = self.view.bounds;
    }
}


-(void)viewDidLoad {
    %orig;
    self.someTweakPrefix_borderView = [[UIView alloc] init];
    self.someTweakPrefix_borderView.frame = self.view.bounds;
    self.someTweakPrefix_borderView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.7];
    self.someTweakPrefix_borderView.layer.cornerRadius = 20;

    self.someTweakPrefix_borderView.layer.shadowColor = [UIColor greenColor].CGColor;
    self.someTweakPrefix_borderView.layer.shadowOpacity = 0.7;
    self.someTweakPrefix_borderView.layer.shadowRadius = 15;
    self.someTweakPrefix_borderView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:self.someTweakPrefix_borderView atIndex:1];
}

%end```
magic hazel
#

what did you change

acoustic imp
#

added a check for the view

#

oh no

radiant idol
#

I go away and you’re already teaching him %property

magic hazel
#

lmaoo

magic hazel
#

i have absolutely no idea whats going on

#

with that part

#

my code is making my ipad freeze

radiant idol
#

Just add a borderWidth and borderColor on the original view and be done with it

acoustic imp
magic hazel
#

i tried to grab the width and length of the og view

acoustic imp
radiant idol
#

My head hurts too much for this rn

acoustic imp
#

go take a nap

magic hazel
#

^

acoustic imp
#

and drink water

radiant idol
#

I just woke up from a nap

acoustic imp
#

🤦‍♂️

#

drink some caffine

magic hazel
#

no

#

it bloody well froze again

#

its because we're calling viewdid load

#

you're not supposed to call that function aagin

#

it's not our function

acoustic imp
#

omg dont do that

magic hazel
#

lmao you had it in your code skully so did i

acoustic imp
#

i didnt read it all

magic hazel
#

lmao

#

i claled it because

#

at least in c++

#

you need to call the function to do jack

#

it wont keep going

#

itll just end operation

acoustic imp
#

dw ab that in logos

magic hazel
#

so itll just continue the program?

acoustic imp
#

%orig takes are of it (idrk rly how it works)

#

yes

#

ok i gtg, homework time :/

magic hazel
#

alr

#

i wish it didnt freeze and i could just uninstall without rebooting twice

#

it no longer freezes

#

but it also does not grab the correct values

#

at least my code doesn't

#

ill try yours

#

your code works

#

i just don't understand it

#

what is self.view.bounds

#

lmao

torn oriole
#

the bounds of the view

magic hazel
#

alr thats not too bad

#

uhh

#

wtf is this property business

magic hazel
#

also why do you run self.someTweakPrefix_borderView.frame = self.view.bounds;
twice

torn oriole
magic hazel
#

i see

#

strong

torn oriole
#

🦾

#

Strong trolley

magic hazel
#

also why do you use "self" in front of everything

radiant idol
#

It’s like “this” in c++

magic hazel
#

do i need it

#

why am i declaring the property twice, once in the hook, and once in the obj c code

radiant idol
#

Because it’s a new property

#

Not existing

radiant idol
magic hazel
#

it looks like exactly the same property

#

%property (nonatomic, strong) UIView *ourView;
@property (nonatomic, strong) UIView *ourView;

#

the only thing that changed was the @ and %

radiant idol
#

The %property is needed if you’re creating a new property

#

That one didn’t exist originally

magic hazel
#

so this line: @property (nonatomic, strong) UIView *ourView;
is irrelevant

#
@import QuartzCore;

@interface NCNotificationViewController : UIViewController
@property (nonatomic, strong) UIView *ourView;
@end

%hook NCNotificationViewController
%property (nonatomic, strong) UIView *ourView;
-(void)viewDidLayoutSubviews {
    %orig;
    
    self.ourView.frame = self.view.bounds;
}


-(void)viewDidLoad {
    %orig;
    UIView *ourView = [[UIView alloc] init];
    ourView.frame = self.view.bounds;
    ourView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.7];
    ourView.layer.cornerRadius = 20;

    ourView.layer.shadowColor = [UIColor greenColor].CGColor;
    ourView.layer.shadowOpacity = 0.7;
    ourView.layer.shadowRadius = 15;
    ourView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:ourView atIndex:1];
}

%end```
radiant idol
#

No, it’s needed to compile it

magic hazel
#

so i need to declare every property twice, once outside the hook, and once inside?

radiant idol
#

At first you’re lying to the compiler to say that that property exists, and then you’re adding it yourself to make sure it exists

magic hazel
#

i see

torn oriole
#

i just saw that as "property property" "tweak property" when i was fucking around with tweaks trolley

radiant idol
magic hazel
#

okay cool, and why is it a property and not just an object

radiant idol
#

this isn’t that prevalent, teslaman just seems to have an obsession with them

magic hazel
#

also, i seem to run this " self.ourView.frame = self.view.bounds;
" in both functions. if that's the code that grabs the size, then surely i tshould grab zero when i run it again in the second function

radiant idol
#

What

magic hazel
#
    %orig;
    
    self.ourView.frame = self.view.bounds;
}``` and
```-(void)viewDidLoad {
    %orig;
    self.ourView = [[UIView alloc] init];
    self.ourView.frame = self.view.bounds;```
radiant idol
#

See this is where I’ll suggest you to start reading UIKit documentation — in the viewDidLoad the bounds will likely be 0, but in viewDidLayoutSubviews they’ll be defined

magic hazel
#

that i understand

#

but why do i run it twice

radiant idol
#

You shouldn’t need to

#

Only have it in viewDidLayoutSubviews

magic hazel
#

so i can just delete that line?

radiant idol
magic hazel
#

kk

#

so far this is just a lot to keep track of but i'm wrapping my head around it

#

i see next in the tutorial we go onto preferences

#

i think my first tweak will just be to have a glow behind notifs that can be toggled on and off

#

maybe with options to change the colour

#

it worked!

radiant idol
magic hazel
#

kk

radiant idol
#

Nice

magic hazel
#

Indeed

#

idk if its bad that im still refering to a lot of the documentation

#

idk if i should try and memorise all this

radiant idol
#

that's encouraged

#

and please please please look at open source tweaks

#

not just you specifically, I'm talking about all new devs

magic hazel
#

i know i've trying to but a lot of them are just overwhelming

#

so much stuff i have absolutely 0 clue what it does

#

how to i grab the corner offset asw

#

bounds grabs the bounds thats cool

#

but it's not a perfect fit since my corner radius

#

isnt

#

ahhhh im lost

#

@implementation EXMRootListController

- (NSArray *)specifiers {
    if (!_specifiers) {
        _specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self];
    }

    return _specifiers;
}

@end```
#

i don't understand this code

#

i dont undertsand how to make an on/off siwtch

#

i read the other gh page

magic hazel
#

i setup a gh repo

#

idk how to do this preference shit tho

#

how do i do this but also just have it respring

#

this notification metho dseems wack

#

is there a simpler way?

#

ive used chatgpt to hack somethign together

#

i dont understand it tho

#

not even that is working

#

aight ima take a break

#

im so lost

#

YOOOO

#

IT WORKS

#

i understand kinda

#

i dont understand the code

#

specifically this

#
    NSUserDefaults *prefs = [[NSUserDefaults alloc] initWithSuiteName:@"com.dingus.TutorialPrefs"];
    testSwitchKey = [prefs objectForKey:@"testSwitchKey"] ? [prefs boolForKey:@"testSwitchKey"] : YES;
}```
#

UGHHH

#

i cant get it to respring

#

grr so much i dont understand

#

i have absolutely 0 clue what the respring code does

acoustic imp
#

add /var/jb/ to the front of the path

magic hazel
#
@import UIKit;
@import QuartzCore;
#import <spawn.h>

@interface NCNotificationViewController : UIViewController
@property (nonatomic, strong) UIView *ourView;
@end

static BOOL testSwitchKey;

//Preference code, don't understand it yet
static void preferencesChanged() {
    NSUserDefaults *prefs = [[NSUserDefaults alloc] initWithSuiteName:@"com.dingus.TutorialPrefs"];
    testSwitchKey = [prefs objectForKey:@"testSwitchKey"] ? [prefs boolForKey:@"testSwitchKey"] : YES;
}
//Code that searches for a change in preference
%ctor {
    preferencesChanged();
}

//Respring code from Chat-GPT, no idea what it actually does but hopefully it works
extern void respring() {
    NSLog(@"[TutorialPrefs] Respring button pressed");
    pid_t pid;
    int status;
    const char *args[] = { "killall", "-9", "SpringBoard", NULL };
    posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char * const *)args, NULL);
    waitpid(pid, &status, 0);
}


%hook NCNotificationViewController
%property (nonatomic, strong) UIView *ourView;
//Grab notification bounds
-(void)viewDidLayoutSubviews {
    %orig;
    self.ourView.frame = self.view.bounds;
}

//Create notification glow and set colour and size
-(void)viewDidLoad {
    %orig;
    //Doesn't run if the switch is off
    if (!testSwitchKey) return;
    //Initilise the property from last function
    self.ourView = [[UIView alloc] init];
    self.ourView.backgroundColor = [[UIColor clearColor] colorWithAlphaComponent:0.7];
    self.ourView.layer.cornerRadius = 20;
    //Code for glow parameters
    self.ourView.layer.shadowColor = [UIColor greenColor].CGColor;
    self.ourView.layer.shadowOpacity = 0.7;
    self.ourView.layer.shadowRadius = 10;
    self.ourView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:self.ourView atIndex:0];
}

%end```
#

how do i do it with obj c highlight shit

acoustic imp
magic hazel
#

there we go

#

idk i might ditch the respring

#

i have no clue what im doing when it comes to preferences

#

what if i put respring in %ctor

radiant idol
#

Why

magic hazel
#

i dont know

radiant idol
#

That’ll cause the phone to respring loop

magic hazel
#

ah

#

i thought so

radiant idol
#

Every time the tweak loads it’ll respring the phone

magic hazel
#

well i have no idea how to get it to work then

#

ima comment out that respring code for now and try and understand the preference bs

acoustic imp
#

but like

#

u cant remove it from sileo

radiant idol
#

Bad

magic hazel
#
extern void respring() {
    system("killall -9 SpringBoard");
}
#

what about that

acoustic imp
#

is that ai

magic hazel
#

yep

#

all of the respring stuff is

#

i have no idea how to respring a device

acoustic imp
#

teslaman 2.0:

radiant idol
#

Why do you want to respring the device

magic hazel
#

to update the change to the notification glow toggle

#

the notification based system is way way over my head

#

i cannot follow what it is doing whatsoever

radiant idol
#

So you want a button in the settings of the tweak that will cause a respring when pressed?

magic hazel
#

yes

#

so i can apply the settings

#

a lot of tweaks do that anyways

radiant idol
#

Right

#

But you’re adding the respring code in the main tweak right now

#

You don’t need it there

#

You need it in the prefs

acoustic imp
#

^

magic hazel
#

what where

#

what file

radiant idol
#

Go to my github user and look up posix_spawn

acoustic imp
#

(yourtweakprefprefix)rootlistcontroller.m

#

make some method

magic hazel
#

so in my header file

acoustic imp
#

@radiant idol random question for CC18, yay or nay for doing the like wifi/bt modules to ios 18.0.1(easy and lazy) or copy it from latest

magic hazel
#

so i put it in my header file but when am i supposed to call it

#

how do i make it call that function when i click the button

magic hazel
#

maybe itll just work

acoustic imp
magic hazel
#

nope

#

ooooh

#

no i have an idea

#

what if instead of letting the user do it

#

i just force it to happen

#

once you've made a change

#

bcus i cannot seem to get this button working

#

i hate preferences

radiant idol
acoustic imp
#

yay

#

me too

radiant idol
#

wrong link

acoustic imp
#

?

radiant idol
magic hazel
#

ive read it

#

already

#

the whole thing

#

multiple times

radiant idol
#

just change MobilePhone to SpringBoard

magic hazel
#

does that go within the implementation

acoustic imp
#

yes

magic hazel
#
        posix_spawn(&pid, ROOT_PATH("/usr/bin/killall"), NULL, NULL, (char* const*)args, NULL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jwalr/theos/sdks/iPhoneOS16.5.sdk/usr/include/spawn.h:60:64: note: passing argument to parameter here
int     posix_spawn(pid_t * __restrict, const char * __restrict,
                                                               ^
2 errors generated.
make[4]: *** [/home/jwalr/theos/makefiles/instance/rules.mk:305: /home/jwalr/tutorial/.theos/obj/debug/arm64e/JWIRootListController.m.a29e5e37.o] Error 1
==> Compiling JWIRootListController.m (arm64)…
/home/jwalr/theos/toolchain/linux/iphone/bin/clang: /lib64/libtinfo.so.6: no version information available (required by /home/jwalr/theos/toolchain/linux/iphone/bin/clang)
JWIRootListController.m:17:20: error: call to undeclared function 'ROOT_PATH'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        posix_spawn(&pid, ROOT_PATH("/usr/bin/killall"), NULL, NULL, (char* const*)args, NULL);
                          ^
JWIRootListController.m:17:20: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Werror,-Wint-conversion]
        posix_spawn(&pid, ROOT_PATH("/usr/bin/killall"), NULL, NULL, (char* const*)args, NULL);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jwalr/theos/sdks/iPhoneOS16.5.sdk/usr/include/spawn.h:60:64: note: passing argument to parameter here
int     posix_spawn(pid_t * __restrict, const char * __restrict,
                                                               ^
2 errors generated.
make[4]: *** [/home/jwalr/theos/makefiles/instance/rules.mk:305: /home/jwalr/tutorial/.theos/obj/debug/arm64/JWIRootListController.m.b3878261.o] Error 1
make[3]: *** [/home/jwalr/theos/makefiles/instance/bundle.mk:37: /home/jwalr/tutorial/.theos/obj/debug/arm64/TutorialPrefs.bundle/TutorialPrefs] Error 2
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [/home/jwalr/theos/makefiles/instance/bundle.mk:37: /home/jwalr/tutorial/.theos/obj/debug/arm64e/TutorialPrefs.bundle/TutorialPrefs] Error 2
make[2]: *** [/home/jwalr/theos/makefiles/instance/bundle.mk:26: internal-bundle-all_] Error 2
make[1]: *** [/home/jwalr/theos/makefiles/master/rules.mk:146: TutorialPrefs.all.bundle.variables] Error 2
make: *** [/home/jwalr/theos/makefiles/master/aggregate.mk:12: internal-all] Error 2
radiant idol
#

add these to the top:

#import <spawn.h>
#import <rootless.h>
magic hazel
granite frigate
#

ROOT_PATH is jbroot

#

til

radiant idol
#

well JBROOT_PATH

magic hazel
#

i dont know what any of this means

acoustic imp
#

oh

radiant idol
#

"jbroot" is the roothide version

#

just ignore

acoustic imp
#

i use the NS one

radiant idol
#

posix_spawn takes in a C string

#

not an NSString

acoustic imp
#

i lied then

magic hazel
#

well it works

#

idk why it works

#

but it does work

radiant idol
#

hence why you use ROOT_PATH instead of ROOT_PATH_NS

#

@magic hazel dont worry I didnt understand what posix_spawn actually did until like last year

#

and I started making tweaks in 2021

acoustic imp
magic hazel
#

im less concerned about the respring stuff

#

idgaf what that does

#

im more concerned abt the preference stuff

acoustic imp
magic hazel
#

i should know

#

lemme push changes

#

its public right

#

not private

radiant idol
#

yes

magic hazel
#

nice

#
static void preferencesChanged() {
    NSUserDefaults *prefs = [[NSUserDefaults alloc] initWithSuiteName:@"com.dingus.TutorialPrefs"];
    testSwitchKey = [prefs objectForKey:@"testSwitchKey"] ? [prefs boolForKey:@"testSwitchKey"] : YES;
}
#

what is this doing

radiant idol
#

NSUserDefaults stores the settings of the tweak

#

do you know what ternary operators are?

magic hazel
#

no

acoustic imp
#

(boolean value) ? (return1) : (return2);

dense lily
radiant idol
#
bool A = true;
int B = A == true ? 4 : 2;

B will be 4 if A is true and 2 if not

magic hazel
#

what

acoustic imp
#

these always confuse my ap CS principals teacher lol

magic hazel
#

okay i understand the first line now

#

its just like a property

#

or the UIView

#

a NSUserDefaults called "prefs" is allocated and initialised, with the suite name of com.dingus.TutorialPrefs

acoustic imp
#

finished my LA hw 🙏

radiant idol
#

yes

#

that's right

magic hazel
#

i still dont quite get that second line

#

why does it ask for an objectkey

#

and a boolkey

#

my object is a bool

magic hazel
#

not particularly

#

idk why theres == or ?

radiant idol
#

that's just the syntax

magic hazel
#

i assume the : means else

radiant idol
#

it can be written like this:

bool A = true;
int B;
if (A == true) {
    B = 4;
} else {
    B = 2;
}
acoustic imp
#
testSwitchKey = [prefs objectForKey:@"testSwitchKey"] ? [prefs boolForKey:@"testSwitchKey"] : YES;```

is jus like  (sorta)

```objc

BOOL testSwitchKey = nil;

if([prefs objectForKey:@"testSwitchKey"]){
  testSwitchKey = [prefs boolForKey:@"testSwitchKey"];
}else{
  testSwitchKey = YES;
}

testSwitchKey = testSwitchKey;
magic hazel
#

LMAO

#

okay i get that now

#

but why is there prefs objectForKey:@"testSwitchKey"]){
var = [prefs boolForKey:@"testSwitchKey

acoustic imp
#

ik ik

torn oriole
acoustic imp
#

it should be bool

#

oopsies

radiant idol
magic hazel
#

yep

radiant idol
#

if they have set a value, we use the boolForKey

magic hazel
#

okay

#

so

radiant idol
#

if not, we use the default

magic hazel
#

? is and?

radiant idol
#

whar

acoustic imp
#

huh

radiant idol
#

teslaman v2

#

I'm telling you

acoustic imp
#

no i like understand tho

#

no i dont what am i saying

magic hazel
#

im in way over my head 😭

#

lemme try an dundertsnad

acoustic imp
torn oriole
magic hazel
#
testSwitchKey = [prefs objectForKey:@"testSwitchKey"] ? [prefs boolForKey:@"testSwitchKey"] : YES;

okay so if i have this crrect, this code uses that first part tere about objectforkey purely to detect if the user has or hasnt changed it, and then if that first part is true, and they have changed it, then it sets the boolforkey to be whatever it is the user changed it to

radiant idol
#
testSwitchKey = /* if user has set the setting to some value */ ? /* use the user's setting */ : /* use the default value */;

/* same thing as: */
if (/* user has set the setting to some value */) {
    testSwitchKey = /* use the user's setting */;
} else {
    testSwitchKey = /* use the default value */;
}
magic hazel
#

looks like i got it right

#

awesome

acoustic imp
#

if testSwitchKey is set from prefs or wtv [prefs objectForKey:@"testSwitchKey"] will return a vlaue, the first part just sees if there is a value, and if there is set that var as the value as a boolean and if not set it as the "default'

radiant idol
#

yea

magic hazel
#

cool now i have to somehow remember all this

#

i wont but i can just reread this

#

lmao

#

ima put comments there

acoustic imp
#

i just copy paste every time, ive learned it over time tho

radiant idol
#

you'll just put it to muscle memory

magic hazel
#

yeah

#

well

#

i think i have a functional tweak now

#

i can enable and disable the glow

#

and apply it with a respring

acoustic imp
#

good thing to do is type everything out by hand when learning NO COPY PASTE

magic hazel
#

i know

#

ill be redoing this tweak

#

yes

#

i know

#

but it doesnt matter im learning

acoustic imp
#

wrd

magic hazel
#

i actually didnt think id get this far

radiant idol
#

I think something cool you could then do is make the glow match the icon of the app

magic hazel
#

sounds doable

#

shut up

#

well my tweak will be open source and free

#

so

#

shush

radiant idol
#

so is velvet2

magic hazel
#

WHAt

#

i thought it was paid

#

😭

radiant idol
#

not anymore

magic hazel
#

oh okay

acoustic imp
magic hazel
#

great

#

NO

#

nope

#

delete that

#

i dont want to cheat lmao

radiant idol
#

ok

radiant idol
magic hazel
#

blud deletes more messages than he sends

magic hazel
#

that'll be useful

radiant idol
#

no I sent that for you to see how I did it teslaman lol

magic hazel
#

no

#

i get that

#

but im also stealing it

#

i need an icon colour grabber

#

idk if that works for notifications tho

radiant idol
#

MIT license

magic hazel
#

im jk i wont actually copy paste ur code i just wanted to take a look

#

mmm

#

still way over my head

#

wait

#

no i can read most of it

#

nice

#

ima make a to-do file

#

and add that suggestiong

#

I think something cool you could then do is make the glow match the icon of the app

acoustic imp
#

bro mac os just ate one of my windows i cant find it

radiant idol
#

it was me

#

I ate it

magic hazel
acoustic imp
#

fatty, it had alot of tabs open too Sadge

magic hazel
#

LMAO

acoustic imp
#

why did i just find 2 long lost windows 😭

magic hazel
#

okay so ima take a break

#

so i can let it sit

#

maybe tmrw or later today ill redo the tweak

#

from scratch

#

new repo

#

see if i remember anything

#

i will probably have to keep refering back to my current tweak

#

which isn't great (i think)

magic hazel
#

itll come w practice ig

#

what do i have to make to get the dev role trolley (purple is kinda ugly)

radiant idol
#

a decently big tweak

magic hazel
#

bootlooper

#

./j

#
-(void)viewDidLoad {
    %orig;
    //Doesn't run if the switch is off
    if (!testSwitchKey) {
        return;
    }
    else {
    //Initilise the property from last function
    self.ourView = [[UIView alloc] init];
    self.ourView.backgroundColor = [[UIColor clearColor] colorWithAlphaComponent:0.7];
    self.ourView.layer.cornerRadius = 20;
    //Code for glow parameters
    self.ourView.layer.shadowColor = [UIColor greenColor].CGColor;
    self.ourView.layer.shadowOpacity = 0.7;
    self.ourView.layer.shadowRadius = 10;
    self.ourView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:self.ourView atIndex:0];
    }
}```
#

is this if else statement okay

#

just tryna clean some stuff up

radiant idol
#

you dont need the else

#

you can just have the if

#

once you return, the rest of the code will be ignored

magic hazel
#

im gonna add an elif later

#

for toggling icon colour

acoustic imp
radiant idol
#

why

acoustic imp
#

idk, jus feels weird

radiant idol
#

how so

acoustic imp
#

idk

#

like let the func breath and end gracefully, not just RETURN

#

idk

radiant idol
#

pov the assembly does just that

#

ret

acoustic imp
#

well it easier to read

#

ha

radiant idol
#

not really

acoustic imp
#

if else > if return

radiant idol
#

¯_(ツ)_/¯

magic hazel
#

maybe i should try remaking it rn

#

i kinda want to

#

but im a bit tired

#

this is the most fun ive had writing any code

#

probably because i can actually get help when shit goes wrong

#
  • its small proj
#

easy to iterate

kind yew
#

hey i need some help with something, i've got a jailbroken iphone 11 with dopamine, ios 16.3.1, and i was trying to get kernel read working through kfd, but whenever i run the exploit it crashes my phone, i've been debugging it a bit with lldb and i found it crashed whenever it got to this line. I've also tried using opa334's fork but got the same result. Any help would be appreciated.

GitHub

kfd, short for kernel file descriptor, is a project to read and write kernel memory on Apple devices. - opa334/kfd

GitHub

kfd, short for kernel file descriptor, is a project to read and write kernel memory on Apple devices. - opa334/kfd

sonic totem
#

That fork doesn’t work on ios 16

kind yew
#

is there one that works on ios 16 or should i just try taking it directly from dopamine?

sonic totem
#

Wait, are you using IOSurface method or not? Otherwise it should work actually

kind yew
#

nope

sonic totem
#

Nonetheless, stock kfd will work for you

kind yew
kind yew
#

aight ill give that a try later

#

thx

sonic totem
#

No problem

fathom snow
#

does anyone here have a paid apple dev account

orchid fulcrum
#

why

torn oriole
#

why

weary heath
#

why

slim bramble
#

why

magic hazel
#

rewrote my code mostly from memory

#

i'm pretty happy with what i remembered

#
@import UIKit;
@import QuartzCore;    

@interface NCNotificationViewController : UIViewController
@property (nonatomic, strong) UIView *notificationView;
@end

//Main Hook
%hook NCNotificationViewController
%property (nonatomic, strong) UIView *notificationView;

//Obtain notification dimensions
-(void)viewDidLayoutSubviews {
    %orig
    self.notificationView.frame = self.view.bounds;
}

//Inject glow behind each notification
-(void)viewDidLoad {
    %orig
    //Create a rectangle that matches the shape of the notification
    self.notificationView = [[UIView alloc] init];
    self.notificationView.backgroundColor = [UIColor clearColor]
    self.notificationView.cornerRadius = 20;

    //Make and outer edge glow for the final effect
    self.notificationView.shadowColor = [UIColor greenColor].CGColor;
    self.notificationView.shadowOpacity = 0.7;
    self.notificationView.shadowRadius = 10;
    self.notificationView.shadowOffset = CGSizeZero;
    [self.view insertSubview:self.notificationView atIndex:0];
}

%end```
#

time to make it more complex

radiant idol
#

nowadays

magic hazel
#

how so

#

i use corner radius

radiant idol
#

it was integrated into UIKit iirc

magic hazel
#

oh okay

radiant idol
#

remove it and you'll see

magic hazel
#

new repo

magic hazel
#

instead of manually specifying via the command line each time i build

radiant idol
#

add THEOS_PACKAGE_SCHEME=rootless to the makefile

#

anywhere

#

but I would personally not do this, it goes against conventions

magic hazel
#

got it

radiant idol
#

but if it's easier then sure you can

magic hazel
#

i'm not gonna be compiling for rootful either way

#

not at this stage at least

#

i have no rootful devices to test on

#

i'd only compile for rootful once i have a big enough tweak that i'm happy publishing to my own repo

radiant idol
#

I see

magic hazel
#

i got it to work on wsl btw

#

you need to add a mount command to your wsl file

#

ill send it in a sec in case anyone else needs it

#

[automount]
options="metadata"

#

go to the root directory and add it via sudo nano /etc/wsl.conf

#

you need to use sudo or it won't save properly

slim bramble
radiant idol
#

thats even worse

#

dont do that 😭

magic hazel
#

i need quartzcore

#

for shadow stuff

radiant idol
#

no

#

everything in quartzcore should be in uikit now

magic hazel
#

what am i doing wrong then

radiant idol
#

show the error

magic hazel
#

^
Tweak.x:28:24: error: property 'shadowOpacity' not found on object of type 'UIView *'
self.notificationView.shadowOpacity = 0.7;
^
Tweak.x:29:24: error: property 'shadowRadius' not found on object of type 'UIView *'
self.notificationView.shadowRadius = 10;
^
Tweak.x:30:24: error: property 'shadowOffset' not found on object of type 'UIView *'
self.notificationView.shadowOffset = CGSizeZero;

#

i have nearly identical code

radiant idol
#

self.notificationView.layer.

magic hazel
#

OH

#

knew i forgot something

#

ty

#

what does layer actually specify?

slim bramble
radiant idol
magic hazel
#

huh im missing a ";" somwhere

#

i cant see it though

#

if only VSCode could actually show me

orchid fulcrum
#

Error logs in the terminal should tell it

magic hazel
#

can't use 2.0

#

grrr

#

i ahve to redo the whole thing

#

fixed

#

new gh

magic hazel
#

also yeah i didnt need quartzcore

#

cripes chatgpt says grabbing the colour is very hard

#
- (UIColor *)mostProminentColorOfImage:(UIImage *)image {
    // Resize the image to reduce processing time
    CGSize newSize = CGSizeMake(40, 40); // Small size for faster processing
    UIGraphicsBeginImageContextWithOptions(newSize, YES, 0);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    CGImageRef cgImage = resizedImage.CGImage;
    CFDataRef imageData = CGDataProviderCopyData(CGImageGetDataProvider(cgImage));
    const UInt8 *pixels = CFDataGetBytePtr(imageData);

    NSMutableDictionary<NSString *, NSNumber *> *colourCounts = [NSMutableDictionary dictionary];

    for (int x = 0; x < newSize.width; x++) {
        for (int y = 0; y < newSize.height; y++) {
            int pixelIndex = ((newSize.width * y) + x) * 4;

            int red = pixels[pixelIndex];
            int green = pixels[pixelIndex + 1];
            int blue = pixels[pixelIndex + 2];
            int alpha = pixels[pixelIndex + 3];

            // Ignore transparent pixels
            if (alpha < 128) continue;

            NSString *key = [NSString stringWithFormat:@"%d,%d,%d", red, green, blue];
            NSNumber *count = [colourCounts objectForKey:key];
            if (count) {
                colourCounts[key] = @(count.integerValue + 1);
            } else {
                colourCounts[key] = @1;
            }
        }
    }

    CFRelease(imageData);

    // Find the most common colour
    NSString *mostCommonKey = nil;
    NSInteger highestCount = 0;

    for (NSString *key in colourCounts) {
        NSInteger count = colourCounts[key].integerValue;
        if (count > highestCount) {
            highestCount = count;
            mostCommonKey = key;
        }
    }

    if (mostCommonKey) {
        NSArray<NSString *> *components = [mostCommonKey componentsSeparatedByString:@","];
        UIColor *prominentColor = [UIColor colorWithRed:[components[0] intValue] / 255.0
                                                  green:[components[1] intValue] / 255.0
                                                   blue:[components[2] intValue] / 255.0
                                                  alpha:1.0];
        return prominentColor;
    }

    return nil;
}
#

i have no idea what most of this means

radiant idol
#

I did it in one of thje tweaks

#

matchingiconlabels

magic hazel
#

does it work for any UIImage

radiant idol
#

yes

magic hazel
#

k lemme see

#

hmm

#

seems a bit off

#

wallet is the worst offender

#

how did it grab orange 😭

radiant idol
#

well its the average color

magic hazel
#

hmmm

radiant idol
#

not the dominant color

magic hazel
#

i dont understand your code yet

#

but ima try and learn

#

i assume the app icon is grabbed from a different place for notifications

radiant idol
magic hazel
#

ohboy

#

where was that link to the notificatoinviewcontroller header

#

i cant see it

magic hazel
#

nothing about a uiimage

#

okay

#

moving on

#

chatgpt gave me this

#
%hook NCNotificationListCell

- (void)layoutSubviews {
    %orig;

    // Attempt to directly access the image view if it's a private property
    UIImageView *iconImageView = [self valueForKey:@"_iconImageView"]; // May not exist, depending on iOS version

    if (!iconImageView) {
        // If the direct access fails, search the subviews for an UIImageView
        for (UIView *subview in self.subviews) {
            if ([subview isKindOfClass:[UIImageView class]]) {
                iconImageView = (UIImageView *)subview;
                break;
            }
        }
    }

    if (iconImageView && [iconImageView isKindOfClass:[UIImageView class]]) {
        UIImage *iconImage = iconImageView.image;
        if (iconImage) {
            UIColor *prominentColor = [self mostProminentColorOfImage:iconImage];
            NSLog(@"Most Prominent Colour: %@", prominentColor);
        }
    }
}

%end
radiant idol
#

They all just say id

magic hazel
#

well i have no idea what any of this codes means lmaoo

#

i probably have to start learning more objc

#
@import UIKit;
@import QuartzCore;    

@interface NCNotificationViewController : UIViewController
@property (nonatomic, strong) UIView *notificationView;
@end

static BOOL enableGlow;

//Create a preference file that contains a BOOL value from the on/off switch
static void preferencesChanged() {
    NSUserDefaults *prefs = [[NSUserDefaults alloc] initWithSuiteName:@"com.jwi.NotificationGlow2Prefs"];
    enableGlow = [prefs objectForKey:@"enableGlow"] ? [prefs boolForKey:@"enableGlow"] : YES;
}

//Constantly check if any preference has changed
%ctor {
    preferencesChanged();
}

//Main Hook
%hook NCNotificationViewController
%property (nonatomic, strong) UIView *notificationView;

//Obtain notification dimensions
-(void)viewDidLayoutSubviews {
    %orig;
    self.notificationView.frame = self.view.bounds;
}

//Inject glow behind each notification
-(void)viewDidLoad {
    %orig;
    if (!enableGlow) {
        return;
    }
    //Create a rectangle that matches the shape of the notification
    self.notificationView = [[UIView alloc] init];
    self.notificationView.backgroundColor = [UIColor clearColor];
    self.notificationView.layer.cornerRadius = 20;

    //Make and outer edge glow for the final effect
    self.notificationView.layer.shadowColor = [UIColor greenColor].CGColor;
    self.notificationView.layer.shadowOpacity = 0.7;
    self.notificationView.layer.shadowRadius = 10;
    self.notificationView.layer.shadowOffset = CGSizeZero;
    [self.view insertSubview:self.notificationView atIndex:0];
}

%end

#

got the pref code working again

#

havent done the respring stuff yet but

#

ima see if i can understand your notif code

#

i seem to be getting a better hang of this

#

it wont wok

#

bruh

#

lemme try without prefs

#

huh

#

nothing

#

nvm i fixed it

orchid fulcrum
#

didnt read all the messages but if you need average color of app icon function this is pretty good (or so i remember)

kind yew
magic hazel
#

wher can i get a rootless version of flexing

orchid fulcrum
magic hazel
#

i'm not sure how to install a dylib manually

orchid fulcrum
#

oh sorry, i dont have a deb package (you can use the dylib via tools like trollfools or opainject, or create a deb package from it but idrk how to do it)

radiant idol
magic hazel
#

how do you use flexing

#

i dont see a setting for it

#

nor an app

pallid totem
#

so

magic hazel
#

so how do you use it

radiant idol
#

you hold on the screen with 3 fingers

faint timber
#

theres this thing called a README

magic hazel
#

man am i lost