Skip to content

Commit facacb3

Browse files
authored
Merge pull request #803 from leminlimez/v7-more-bubfix
V7 more bubfix
2 parents eee2df5 + 804497d commit facacb3

File tree

6 files changed

+34
-40
lines changed

6 files changed

+34
-40
lines changed

devicemanagement/device_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def show_apply_error(e: Exception, update_label=lambda x: None, files_list: list
8383
return ApplyAlertMessage(QCoreApplication.tr("You must run the application as an administer to use BookRestore tweaks."), detailed_txt="Try running the program with sudo.")
8484
elif isinstance(e, InvalidServiceError):
8585
return ApplyAlertMessage(QCoreApplication.tr("You must enable developer mode on your device. You can do it in the Settings app."),
86-
detailed_txt=QCoreApplication.tr("BookRestore tweaks require developer mode to apply. You can enable this at the bottom of the Settings app on your iPhone or iPad."))
86+
detailed_txt=QCoreApplication.tr("BookRestore tweaks with the AFC method require developer mode to apply.\n\nYou can enable this at the bottom of Settings > Privacy & Security > Developer Mode on your iPhone or iPad."))
8787
elif isinstance(e, NuggetException):
8888
return ApplyAlertMessage(str(e), detailed_txt=e.detailed_text)
8989
else:
@@ -530,7 +530,7 @@ def apply_changes(self, update_label=lambda x: None, show_alert=lambda x: None):
530530
basic_plists = tweak.apply_tweak(basic_plists, self.allow_risky_tweaks)
531531
basic_plists_ownership[tweak.file_location] = tweak.owner
532532
if tweak.enabled and isinstance(tweak, RdarFixTweak) and Version(self.get_current_device_version()) >= Version("26.0"):
533-
uses_domains = True
533+
use_bookrestore = True
534534
elif isinstance(tweak, NullifyFileTweak):
535535
tweak.apply_tweak(files_data)
536536
if tweak.enabled and tweak.file_location.value.startswith("/var/mobile/"):
@@ -545,7 +545,7 @@ def apply_changes(self, update_label=lambda x: None, show_alert=lambda x: None):
545545
)
546546
if tweak.uses_domains():
547547
uses_domains = True
548-
else:
548+
elif not tweak.is_empty():
549549
use_bookrestore = True
550550
elif isinstance(tweak, StatusBarTweak):
551551
tweak.apply_tweak(files_to_restore=files_to_restore)

gui/main_window.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from tweaks.tweaks import tweaks, TweakID
2121

22-
App_Version = "7.0.1"
22+
App_Version = "7.0.2"
2323
App_Build = 0
2424

2525
class MainWindow(QtWidgets.QMainWindow):
@@ -149,6 +149,11 @@ def refresh_devices_finished(self):
149149
# clear the picker
150150
self.ui.devicePicker.clear()
151151
self.ui.restoreProgressBar.hide()
152+
self.pages[Page.Settings].set_risky_options_visible(
153+
visible=self.device_manager.allow_risky_tweaks,
154+
device_connected=(len(self.device_manager.devices) > 0)
155+
)
156+
152157
if len(self.device_manager.devices) == 0:
153158
self.ui.devicePicker.setEnabled(False)
154159
self.ui.devicePicker.addItem(self.noneText)
@@ -199,19 +204,6 @@ def refresh_devices_finished(self):
199204
self.ui.templatesPageBtn.show()
200205
self.ui.posterboardPageBtn.show()
201206
self.ui.miscOptionsBtn.show()
202-
203-
if self.device_manager.allow_risky_tweaks:
204-
try:
205-
self.ui.resetPBDrp.removeItem(4)
206-
except:
207-
pass
208-
self.ui.resetPBDrp.addItem("PB Extensions", "PB Extensions")
209-
else:
210-
self.ui.advancedPageBtn.hide()
211-
try:
212-
self.ui.resetPBDrp.removeItem(4)
213-
except:
214-
pass
215207

216208
self.ui.sidebarDiv2.show()
217209
self.ui.applyPageBtn.show()
@@ -309,8 +301,6 @@ def change_selected_device(self, index):
309301
self.ui.advancedPageBtn.show()
310302
else:
311303
self.ui.advancedPageBtn.hide()
312-
# toggle AtWakeUp checkbox with risky tweaks
313-
self.ui.atwakeupChk.setVisible(self.device_manager.allow_risky_tweaks)
314304

315305
# hide the ai content if not on
316306
if device_ver >= Version("18.1") and (not TweakID.AIGestalt in tweaks or not tweaks[TweakID.AIGestalt].enabled):
@@ -402,14 +392,6 @@ def loadSettings(self):
402392
else:
403393
self.ui.skipSetupOnLbl.hide()
404394

405-
# hide/show the frame limit
406-
if risky_tweaks:
407-
self.ui.ignorePBFrameLimitChk.show()
408-
self.ui.disableTendiesLimitChk.show()
409-
else:
410-
self.ui.ignorePBFrameLimitChk.hide()
411-
self.ui.disableTendiesLimitChk.hide()
412-
413395
self.device_manager.apply_over_wifi = apply_over_wifi
414396
self.device_manager.auto_reboot = auto_reboot
415397
self.device_manager.allow_risky_tweaks = risky_tweaks

gui/pages/main/settings.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ def load_available_languages(self):
8282
idx = 0
8383
self.ui.langDrp.setCurrentIndex(idx)
8484

85+
# Toggle the risky options visibility
86+
def set_risky_options_visible(self, visible: bool, device_connected: bool=True):
87+
if device_connected:
88+
self.ui.advancedPageBtn.setVisible(visible)
89+
self.ui.ignorePBFrameLimitChk.setVisible(visible)
90+
self.ui.disableTendiesLimitChk.setVisible(visible)
91+
self.ui.atwakeupChk.setVisible(visible)
92+
self.ui.enableiPadOSChk.setVisible(visible)
93+
try:
94+
self.ui.resetPBDrp.removeItem(4)
95+
except:
96+
pass
97+
if visible:
98+
self.ui.resetPBDrp.addItem("PB Extensions")
99+
85100
## ACTIONS
86101
def on_langDrp_activated(self, index: int):
87102
new_lang = self.lang_indexes[index]
@@ -96,17 +111,7 @@ def on_showRiskyChk_toggled(self, checked: bool):
96111
self.window.device_manager.allow_risky_tweaks = checked
97112
# save the setting
98113
self.window.settings.setValue("show_risky_tweaks", checked)
99-
# toggle the button visibilities
100-
self.ui.advancedPageBtn.setVisible(checked)
101-
self.ui.ignorePBFrameLimitChk.setVisible(checked)
102-
self.ui.disableTendiesLimitChk.setVisible(checked)
103-
self.ui.atwakeupChk.setVisible(checked)
104-
try:
105-
self.ui.resetPBDrp.removeItem(4)
106-
except:
107-
pass
108-
if checked:
109-
self.ui.resetPBDrp.addItem("PB Extensions")
114+
self.set_risky_options_visible(checked)
110115
def on_ignorePBFrameLimitChk_toggled(self, checked: bool):
111116
set_ignore_frame_limit(checked)
112117
# save the setting

restore/bookrestore.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,9 @@ def perform_bookrestore(files: list[FileToRestore], lockdown_client: LockdownCli
399399
if not lockdown_client.developer_mode_status:
400400
# enable developer mode
401401
progress_callback("Enabling Developer Mode...")
402-
AmfiService(lockdown=lockdown_client).enable_developer_mode()
403-
raise NuggetException("Developer Mode Enabled. Please refresh the device list after reboot and apply again.")
402+
AmfiService(lockdown=lockdown_client).reveal_developer_mode_option_in_ui()
403+
raise NuggetException("You must enable developer mode on your device. You can do it in the Settings app.\n\nClick \"Show Details\" for more information.",
404+
detailed_text="BookRestore tweaks with the AFC method require developer mode to apply.\n\nYou can enable this at the bottom of Settings > Privacy & Security > Developer Mode on your iPhone or iPad.")
404405
if os.name == 'nt':
405406
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
406407
asyncio.run(create_connection_context(files, lockdown_client, current_device_books_uuid_callback, progress_callback, transfer_mode))

tweaks/posterboard/posterboard_tweak.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def __init__(self):
3434

3535
def uses_domains(self):
3636
return (len(self.tendies) > 0 or self.videoFile != None or len(self.resetModes) > 0)
37+
38+
def is_empty(self) -> bool:
39+
return not self.uses_domains()
3740

3841
def verify_tendie(self, new_tendie: TendieFile, is_template: bool = False) -> bool:
3942
if new_tendie.descriptor_cnt + self.get_descriptor_count() <= 10:

tweaks/posterboard/template_options/templates_tweak.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def uses_domains(self):
2323
return True
2424
return False
2525

26+
def is_empty(self) -> bool:
27+
return len(self.templates) == 0
28+
2629
def add_template(self, file: str, version: str = None):
2730
try:
2831
new_template = TemplateFile(path=file, device_version=version)

0 commit comments

Comments
 (0)