user3551278
user3551278

Reputation: 1

Theos preference-bundle

I'm an amateur dev with some basic skills in objective C.

I made some small substrate tweaks -- the last tweak I made is fullscreen for Facebook. Now, I want to make a preference bundle for my tweak.

I read tons of guides online but none of them helped. I know that I should create a preference bundle in theos and modify the plist then put some sort of code to lead my tweak into to preferences path and make a condition for the toggle -- something like:

 if ((toggle = enabled )) (activate tweak) else ( return %orig) 

...or something like that. However, I can't seem to find an example anywhere of how to accomplish this or the condition I should make.

Here's my [code]:

#import<UIKit/UIKit.h>
%hook UIApplication -
(BOOL)isStatusBarHidden{return TRUE;}%end
%hook UIStatusBar -
(id)styleForRequestedStyle{return nil;}%end
%hook UIStatusBar -
(id)_forgroundStyleForStatusBarStyle{return nil;}%end
%hook UIStatusBar -
(id)_foregroundAlphaForStatusBarStyle{return nil;}%end
%hook UIStatusBar -
(id)initWithFrame:showForegroundView{return nil;}%end

Upvotes: 0

Views: 1613

Answers (1)

twodayslate
twodayslate

Reputation: 2833

You have to grab the values from the plist file.

NSMutableDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.your.package.plist"];

Check out examples from my Github or insanj's

https://github.com/twodayslate/ https://github.com/insanj/

Upvotes: 1

Related Questions