Jump to content

How To Make Enable Switch in preferences


Go to solution Solved by castix,

7 posts in this topic

Recommended Posts

Posted

Hello ,

 

in dida THEOS template

 

 

we can do siwtch for every funciton

%hook something
 
-(int)method {
if(GetPrefBool(@"kKey")) {
return 9999999;
}
return %orig;
}

-(int)gems {       
if(GetPrefBool(@"kGems")) {
return 9999999;
}
return %orig;
}

-(unsigned int)lives {
if(GetPrefBool(@"kLives")) {
return 9999999;
}
return %orig;
}

%end

%hook SomethingElse

-(BOOL)SomeMethod {
if(GetPrefBool(@"kKEY5")) {
return TRUE;
}
return %orig;
}

-(BOOL)SomeMethod2 {
if(GetPrefBool(@"kKEY6")) {
return FALSE;
}
return %orig;
}

%end

We have 6 funciton with 6 switcher

 

but i want make 1 switcher for 6 funciton

 

Enable/Disable

 

something like this

 

If All funciton ok

enable the tweak

 

 

else

disable

 

 

Thank U :)

 

 

Posted (edited)


%hook something

- (int)method {

if(GetPrefBool(@"enable")) {

return 9999999;

}

return %orig;

}

 

- (int)gems {

if(GetPrefBool(@"enable")) {

return 9999999;

}

return %orig;

}

 

- (unsigned int)lives {

if(GetPrefBool(@"enable")) {

return 9999999;

}

return %orig;

}

%end

 

%hook SomethingElse

- (BOOL)SomeMethod {

if(GetPrefBool(@"enable")) {

return true;

}

return %orig;

}

 

- (BOOL)SomeMethod2 {

if(GetPrefBool(@"enable")) {

return false;

}

return %orig;

}

%end


<dict>

    <key>cell</key>

    <string>PSGroupCell</string>

    <key>key</key>

    <string>enable</string>

    <key>defaults</key>

    <string>sampletext</string>

    <key>default</key>

    </false>

    <key>label</key>

    <string>sampletext</string>

    <key>icon</key>

    <string>icon.png</string>

</dict>

 

Updated by z0ne
Posted
%hook something
- (int)method {
    if(GetPrefBool(@"enable")) {
    return 9999999;
    }
    return %orig;
}

- (int)gems { 
    if(GetPrefBool(@"enable")) {
    return 9999999;
    }
    return %orig;
}

- (unsigned int)lives {
    if(GetPrefBool(@"enable")) {
    return 9999999;
    }
    return %orig;
}
%end

%hook SomethingElse
- (BOOL)SomeMethod {
    if(GetPrefBool(@"enable")) {
    return true;
    }
    return %orig;
}

- (BOOL)SomeMethod2 {
    if(GetPrefBool(@"enable")) {
    return false;
    }
    return %orig;
}
%end
<dict>
    <key>cell</key>
    <string>PSGroupCell</string>
    <key>key</key>
    <string>enable</string>
    <key>defaults</key>
    <string>sampletext</string>
    <key>default</key>
    </false>
    <key>label</key>
    <string>sampletext</string>
    <key>icon</key>
    <string>icon.png</string>
</dict>

 

 

Thank you for replay

 

 

I have problem when save plist file

 

vaule missing for key inside <dict> at line 16 .

 

my plist file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>items</key>
	<array>
	
	<dict>
    <key>cell</key>
    <string>PSGroupCell</string>
    <key>key</key>
    <string>enable</string>
    <key>defaults</key>
    <string>Disable</string>
    <key>default</key>
    </false>
    <key>label</key>
    <string>Enable</string>
    <key>icon</key>
    <string>icon.png</string>
</dict>
			<dict>
			<key>cell</key>
			<string>PSTextCell</string>
			<key>label</key>
			<string>Made by Yazeed Alotaibi.</string>
		</dict>
		<dict>
			<key>action</key>
			<string>link</string>
			<key>cell</key>
			<string>PSButtonCell</string>
			<key>icon</key>
			<string>[email protected]</string>
			<key>label</key>
			<string>Visit ZezBlog.com</string>
		</dict>
	</array>
	<key>title</key>
	<string>PlayYTinBG</string>
</dict>
</plist>

  • Solution
Posted

What's the plist name because

<key>defaults</key>
<string>Disable</string>
<key>default</key>
</false>
<key>label</key>
<string>Enable</string>
<key>icon</key>
<string>icon.png</string>
</dict>

you edited this part wrong

Posted

What's the plist name because

<key>defaults</key>
<string>Disable</string>
<key>default</key>
</false>
<key>label</key>
<string>Enable</string>
<key>icon</key>
<string>icon.png</string>
</dict>

you edited this part wrong

 

plist name PlayYTinBG.plist

 

 

package name : com.zezblog.playytinbg

Posted

Sloved

        <dict>
            <key>cell</key>
            <string>PSSwitchCell</string>
            <key>default</key>
            <false/>
            <key>defaults</key>
            <string>com.zezblog.playytinbg</string>
            <key>key</key>
            <string>enable</string>
            <key>label</key>
            <string>enable</string>
        </dict>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines