mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-08 04:23:05 +08:00
disabling ota
This commit is contained in:
@@ -49,13 +49,15 @@ class BasicPlistTweak(Tweak):
|
||||
value: any = True,
|
||||
edit_type: TweakModifyType = TweakModifyType.TOGGLE,
|
||||
min_version: Version = Version("1.0"),
|
||||
is_risky: bool = False,
|
||||
divider_below: bool = False
|
||||
):
|
||||
super().__init__(label=label, key=key, subkey=None, value=value, edit_type=edit_type, min_version=min_version, divider_below=divider_below)
|
||||
self.file_location = file_location
|
||||
self.is_risky = is_risky
|
||||
|
||||
def apply_tweak(self, other_tweaks: dict) -> dict:
|
||||
if not self.enabled:
|
||||
def apply_tweak(self, other_tweaks: dict, risky_allowed: bool = False) -> dict:
|
||||
if not self.enabled or (self.is_risky and not risky_allowed):
|
||||
return other_tweaks
|
||||
if self.file_location in other_tweaks:
|
||||
other_tweaks[self.file_location][self.key] = self.value
|
||||
@@ -63,6 +65,27 @@ class BasicPlistTweak(Tweak):
|
||||
other_tweaks[self.file_location] = {self.key: self.value}
|
||||
return other_tweaks
|
||||
|
||||
class AdvancedPlistTweak(BasicPlistTweak):
|
||||
def __init__(
|
||||
self, label: str,
|
||||
file_location: FileLocation,
|
||||
keyValues: dict,
|
||||
edit_type: TweakModifyType = TweakModifyType.TOGGLE,
|
||||
min_version: Version = Version("1.0"),
|
||||
is_risky: bool = False,
|
||||
divider_below: bool = False
|
||||
):
|
||||
super().__init__(label=label, file_location=file_location, key=None, value=keyValues, edit_type=edit_type, min_version=min_version, is_risky=is_risky, divider_below=divider_below)
|
||||
|
||||
def apply_tweak(self, other_tweaks: dict, risky_allowed: bool = False) -> dict:
|
||||
if not self.enabled or (self.is_risky and not risky_allowed):
|
||||
return other_tweaks
|
||||
plist = {}
|
||||
for key in self.value:
|
||||
plist[key] = self.value[key]
|
||||
other_tweaks[self.file_location] = plist
|
||||
return other_tweaks
|
||||
|
||||
|
||||
class RdarFixTweak(BasicPlistTweak):
|
||||
def __init__(self, divider_below: bool = False):
|
||||
@@ -97,7 +120,7 @@ class RdarFixTweak(BasicPlistTweak):
|
||||
def set_di_type(self, type: int):
|
||||
self.di_type = type
|
||||
|
||||
def apply_tweak(self, other_tweaks: dict) -> dict:
|
||||
def apply_tweak(self, other_tweaks: dict, risky_allowed: bool = False) -> dict:
|
||||
if not self.enabled:
|
||||
return other_tweaks
|
||||
if self.di_type == -1:
|
||||
|
||||
Reference in New Issue
Block a user