From 8a5966fdbb4bb6d2bac393aafd327ed55111dfd0 Mon Sep 17 00:00:00 2001 From: leminlimez <59540996+leminlimez@users.noreply.github.com> Date: Fri, 27 Sep 2024 20:23:49 -0400 Subject: [PATCH] ai enabler --- .DS_Store | Bin 14340 -> 10244 bytes cli_app.py | 7 ++- devicemanagement/device_manager.py | 7 ++- gui/main_window.py | 37 ++++++++++- qt/mainwindow.ui | 96 ++++++++++++++++++++++++++--- qt/mainwindow_ui.py | 72 +++++++++++++++++++--- qt/ui_mainwindow.py | 72 +++++++++++++++++++--- tweaks/eligibility_tweak.py | 42 ++++++++++++- tweaks/tweaks.py | 7 ++- 9 files changed, 306 insertions(+), 34 deletions(-) diff --git a/.DS_Store b/.DS_Store index a9edf0fff977c288f9c18626531cf53d549a861f..fc39c7b49f085713747f51bc9858a1526fae1c8e 100644 GIT binary patch delta 238 zcmZoEXbF&DU|?W$DortDU{C-uIe-{M3-C-V6q~3gIoZI3MH0woFa=^ppg4nPPJVJy zPJR+d(Z-8r>=Pg4Zf56T;b1hK%%gC4GOJ?Tr1$PBU>=pb$& y;R76DLMFs1I_{!An9$l}R1?!i zrr%yjM2TcPSvtv(p%Qm6izW+NlqN##5ZOl_9(I=-Zl&CC%PJSR$@Awg^#P(ZaY;P0 z-iZt8=OW6O(Uu{$TyXRI(7C(__&&>s3sVe4MqSH&d%x|BI8t}(VnV#J{tAqaV%gJi&(-6O1Q?;rWIn7e~q)`Ig3ZDGK|1n;N`$9XGGpC?Ae&Z zJZl`DQeUL@xU@P^0xu|E4LgC)%JWzwL&k{QM1ebSnHAFJ{^>80dq64R27S3X8I`YN zf2T6T<#hWME#}I5Cxa@Bc4-cdP+&tv@AP5xRwO+!ZC;iSZc0w1JruW0Yiww9QP+GC z7k<_|u!H;hq|Q2i&M4K=;B)V{zmJGxx!I%gIlres6jPSColEHR%JXtP;g4sd;_= Version("18.0"): + self.ui.enableAIChk.show() + else: + self.ui.enableAIChk.hide() + self.ui.languageLbl.hide() + self.ui.languageTxt.hide() + self.ui.aiInfoLabel.hide() + self.ui.spoofModelChk.hide() if Version(self.device_manager.data_singleton.current_device.version) >= Version("18.0"): self.ui.aodChk.show() self.ui.sleepApneaChk.show() @@ -388,15 +401,33 @@ class MainWindow(QtWidgets.QMainWindow): tweaks["AI"].set_enabled(checked) - ## EU ENABLER PAGE + ## ELIGIBILITY PAGE def on_euEnablerEnabledChk_toggled(self, checked: bool): tweaks["EUEnabler"].set_enabled(checked) - self.ui.euEnablerPageContent.setDisabled(not checked) def on_methodChoiceDrp_activated(self, index: int): tweaks["EUEnabler"].set_selected_option(index) def on_regionCodeTxt_textEdited(self, text: str): tweaks["EUEnabler"].set_region_code(text) + def on_enableAIChk_toggled(self, checked: bool): + tweaks["AIEligibility"].set_enabled(checked) + tweaks["AIGestalt"].set_enabled(checked) + # change the visibility of stuff + if checked: + self.ui.languageLbl.show() + self.ui.languageTxt.show() + self.ui.aiInfoLabel.show() + self.ui.spoofModelChk.show() + else: + self.ui.languageLbl.hide() + self.ui.languageTxt.hide() + self.ui.aiInfoLabel.hide() + self.ui.spoofModelChk.hide() + def on_languageTxt_textEdited(self, text: str): + tweaks["AIEligibility"].set_language_code(text) + def on_spoofModelChk_toggled(self, checked: bool): + tweaks["SpoofModel"].set_enabled(checked) + ## SPRINGBOARD OPTIONS PAGE def on_footnoteTxt_textEdited(self, text: str): diff --git a/qt/mainwindow.ui b/qt/mainwindow.ui index 3e8051d..11bd4ea 100644 --- a/qt/mainwindow.ui +++ b/qt/mainwindow.ui @@ -593,7 +593,7 @@ QSlider::tick:horizontal { - EU Enabler + Eligibility @@ -2372,7 +2372,7 @@ QComboBox QAbstractItemView::item:hover { 0 - + -1 @@ -2380,16 +2380,25 @@ QComboBox QAbstractItemView::item:hover { - EU Enabler + Eligibility Tweaks - - - Enabled + + + Qt::Vertical - + + QSizePolicy::Fixed + + + + 20 + 16 + + + @@ -2425,6 +2434,13 @@ QComboBox QAbstractItemView::item:hover { + + + + Enable EU Enabler + + + @@ -2518,6 +2534,72 @@ QComboBox QAbstractItemView::item:hover { + + + + false + + + QFrame { + color: #414141; +} + + + QFrame::Plain + + + Qt::Horizontal + + + + + + + Enable Apple Intelligence (for Unsupported Devices) + + + + + + + Language Code (not needed for English) + + + + + + + Language Code (i.e. en) + + + + + + + + 0 + 0 + + + + In order to download the AI model, you must spoof the device model. This will break Face ID until +you revert. + +Once the model has downloaded, disable "Spoof Device Model" and click the "Apply Tweaks" +button on the "Apply" page again to fix Face ID. + + + Qt::AutoText + + + + + + + Spoof Device Model + + + diff --git a/qt/mainwindow_ui.py b/qt/mainwindow_ui.py index 3bf4315..c091846 100644 --- a/qt/mainwindow_ui.py +++ b/qt/mainwindow_ui.py @@ -1286,16 +1286,15 @@ class Ui_Nugget(object): self.verticalLayout_15.setSpacing(6) self.verticalLayout_15.setObjectName(u"verticalLayout_15") self.verticalLayout_15.setContentsMargins(0, 0, 0, 0) - self.setupOptionsLbl = QLabel(self.verticalWidget_5) - self.setupOptionsLbl.setObjectName(u"setupOptionsLbl") - self.setupOptionsLbl.setFont(font1) + self.eligibilityLbl = QLabel(self.verticalWidget_5) + self.eligibilityLbl.setObjectName(u"eligibilityLbl") + self.eligibilityLbl.setFont(font1) - self.verticalLayout_15.addWidget(self.setupOptionsLbl) + self.verticalLayout_15.addWidget(self.eligibilityLbl) - self.euEnablerEnabledChk = QCheckBox(self.verticalWidget_5) - self.euEnablerEnabledChk.setObjectName(u"euEnablerEnabledChk") + self.verticalSpacer_20 = QSpacerItem(20, 16, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) - self.verticalLayout_15.addWidget(self.euEnablerEnabledChk) + self.verticalLayout_15.addItem(self.verticalSpacer_20) self.horizontalLayout_21.addWidget(self.verticalWidget_5) @@ -1317,6 +1316,11 @@ class Ui_Nugget(object): self.verticalLayout_17.addWidget(self.line_13) + self.euEnablerEnabledChk = QCheckBox(self.euEnablerPage) + self.euEnablerEnabledChk.setObjectName(u"euEnablerEnabledChk") + + self.verticalLayout_17.addWidget(self.euEnablerEnabledChk) + self.euEnablerPageContent = QWidget(self.euEnablerPage) self.euEnablerPageContent.setObjectName(u"euEnablerPageContent") self.euEnablerPageContent.setEnabled(False) @@ -1378,6 +1382,45 @@ class Ui_Nugget(object): self.verticalLayout_16.addWidget(self.regionCodeTxt) + self.line_16 = QFrame(self.euEnablerPageContent) + self.line_16.setObjectName(u"line_16") + self.line_16.setEnabled(False) + self.line_16.setStyleSheet(u"QFrame {\n" +" color: #414141;\n" +"}") + self.line_16.setFrameShadow(QFrame.Plain) + self.line_16.setFrameShape(QFrame.HLine) + + self.verticalLayout_16.addWidget(self.line_16) + + self.enableAIChk = QCheckBox(self.euEnablerPageContent) + self.enableAIChk.setObjectName(u"enableAIChk") + + self.verticalLayout_16.addWidget(self.enableAIChk) + + self.languageLbl = QLabel(self.euEnablerPageContent) + self.languageLbl.setObjectName(u"languageLbl") + + self.verticalLayout_16.addWidget(self.languageLbl) + + self.languageTxt = QLineEdit(self.euEnablerPageContent) + self.languageTxt.setObjectName(u"languageTxt") + + self.verticalLayout_16.addWidget(self.languageTxt) + + self.aiInfoLabel = QLabel(self.euEnablerPageContent) + self.aiInfoLabel.setObjectName(u"aiInfoLabel") + sizePolicy1.setHeightForWidth(self.aiInfoLabel.sizePolicy().hasHeightForWidth()) + self.aiInfoLabel.setSizePolicy(sizePolicy1) + self.aiInfoLabel.setTextFormat(Qt.AutoText) + + self.verticalLayout_16.addWidget(self.aiInfoLabel) + + self.spoofModelChk = QCheckBox(self.euEnablerPageContent) + self.spoofModelChk.setObjectName(u"spoofModelChk") + + self.verticalLayout_16.addWidget(self.spoofModelChk) + self.verticalSpacer_7 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.verticalLayout_16.addItem(self.verticalSpacer_7) @@ -2475,7 +2518,7 @@ class Ui_Nugget(object): self.gestaltPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) self.featureFlagsPageBtn.setText(QCoreApplication.translate("Nugget", u" Feature Flags", None)) self.featureFlagsPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) - self.euEnablerPageBtn.setText(QCoreApplication.translate("Nugget", u" EU Enabler", None)) + self.euEnablerPageBtn.setText(QCoreApplication.translate("Nugget", u" Eligibility", None)) self.euEnablerPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) self.springboardOptionsPageBtn.setText(QCoreApplication.translate("Nugget", u" Springboard Options", None)) self.springboardOptionsPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) @@ -2541,14 +2584,23 @@ class Ui_Nugget(object): self.lockscreenChk.setText(QCoreApplication.translate("Nugget", u"Enable Duplicate Lockscreen Button and Lockscreen Quickswitch", None)) self.photosChk.setText(QCoreApplication.translate("Nugget", u"Enable Old Photo UI", None)) self.aiChk.setText(QCoreApplication.translate("Nugget", u"Enable Apple Intelligence", None)) - self.setupOptionsLbl.setText(QCoreApplication.translate("Nugget", u"EU Enabler", None)) - self.euEnablerEnabledChk.setText(QCoreApplication.translate("Nugget", u"Enabled", None)) + self.eligibilityLbl.setText(QCoreApplication.translate("Nugget", u"Eligibility Tweaks", None)) + self.euEnablerEnabledChk.setText(QCoreApplication.translate("Nugget", u"Enable EU Enabler", None)) self.label_5.setText(QCoreApplication.translate("Nugget", u"Method Type", None)) self.methodChoiceDrp.setItemText(0, QCoreApplication.translate("Nugget", u"Method 1", None)) self.methodChoiceDrp.setItemText(1, QCoreApplication.translate("Nugget", u"Method 2", None)) self.label_6.setText(QCoreApplication.translate("Nugget", u"Region Code (Should be 2 letters)", None)) self.regionCodeTxt.setPlaceholderText(QCoreApplication.translate("Nugget", u"Region Code (Default: US)", None)) + self.enableAIChk.setText(QCoreApplication.translate("Nugget", u"Enable Apple Intelligence (for Unsupported Devices)", None)) + self.languageLbl.setText(QCoreApplication.translate("Nugget", u"Language Code (not needed for English)", None)) + self.languageTxt.setPlaceholderText(QCoreApplication.translate("Nugget", u"Language Code (i.e. en)", None)) + self.aiInfoLabel.setText(QCoreApplication.translate("Nugget", u"In order to download the AI model, you must spoof the device model. This will break Face ID until\n" +"you revert.\n" +"\n" +"Once the model has downloaded, disable \"Spoof Device Model\" and click the \"Apply Tweaks\"\n" +"button on the \"Apply\" page again to fix Face ID.", None)) + self.spoofModelChk.setText(QCoreApplication.translate("Nugget", u"Spoof Device Model", None)) self.springboardOptionsLbl.setText(QCoreApplication.translate("Nugget", u"Springboard Options", None)) self.label_13.setText(QCoreApplication.translate("Nugget", u"Lock Screen Footnote Text", None)) self.footnoteTxt.setPlaceholderText(QCoreApplication.translate("Nugget", u"Footnote Text", None)) diff --git a/qt/ui_mainwindow.py b/qt/ui_mainwindow.py index 1f68bd7..d1ea245 100644 --- a/qt/ui_mainwindow.py +++ b/qt/ui_mainwindow.py @@ -1286,16 +1286,15 @@ class Ui_Nugget(object): self.verticalLayout_15.setSpacing(6) self.verticalLayout_15.setObjectName(u"verticalLayout_15") self.verticalLayout_15.setContentsMargins(0, 0, 0, 0) - self.setupOptionsLbl = QLabel(self.verticalWidget_5) - self.setupOptionsLbl.setObjectName(u"setupOptionsLbl") - self.setupOptionsLbl.setFont(font1) + self.eligibilityLbl = QLabel(self.verticalWidget_5) + self.eligibilityLbl.setObjectName(u"eligibilityLbl") + self.eligibilityLbl.setFont(font1) - self.verticalLayout_15.addWidget(self.setupOptionsLbl) + self.verticalLayout_15.addWidget(self.eligibilityLbl) - self.euEnablerEnabledChk = QCheckBox(self.verticalWidget_5) - self.euEnablerEnabledChk.setObjectName(u"euEnablerEnabledChk") + self.verticalSpacer_20 = QSpacerItem(20, 16, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed) - self.verticalLayout_15.addWidget(self.euEnablerEnabledChk) + self.verticalLayout_15.addItem(self.verticalSpacer_20) self.horizontalLayout_21.addWidget(self.verticalWidget_5) @@ -1317,6 +1316,11 @@ class Ui_Nugget(object): self.verticalLayout_17.addWidget(self.line_13) + self.euEnablerEnabledChk = QCheckBox(self.euEnablerPage) + self.euEnablerEnabledChk.setObjectName(u"euEnablerEnabledChk") + + self.verticalLayout_17.addWidget(self.euEnablerEnabledChk) + self.euEnablerPageContent = QWidget(self.euEnablerPage) self.euEnablerPageContent.setObjectName(u"euEnablerPageContent") self.euEnablerPageContent.setEnabled(False) @@ -1378,6 +1382,45 @@ class Ui_Nugget(object): self.verticalLayout_16.addWidget(self.regionCodeTxt) + self.line_16 = QFrame(self.euEnablerPageContent) + self.line_16.setObjectName(u"line_16") + self.line_16.setEnabled(False) + self.line_16.setStyleSheet(u"QFrame {\n" +" color: #414141;\n" +"}") + self.line_16.setFrameShadow(QFrame.Plain) + self.line_16.setFrameShape(QFrame.Shape.HLine) + + self.verticalLayout_16.addWidget(self.line_16) + + self.enableAIChk = QCheckBox(self.euEnablerPageContent) + self.enableAIChk.setObjectName(u"enableAIChk") + + self.verticalLayout_16.addWidget(self.enableAIChk) + + self.languageLbl = QLabel(self.euEnablerPageContent) + self.languageLbl.setObjectName(u"languageLbl") + + self.verticalLayout_16.addWidget(self.languageLbl) + + self.languageTxt = QLineEdit(self.euEnablerPageContent) + self.languageTxt.setObjectName(u"languageTxt") + + self.verticalLayout_16.addWidget(self.languageTxt) + + self.aiInfoLabel = QLabel(self.euEnablerPageContent) + self.aiInfoLabel.setObjectName(u"aiInfoLabel") + sizePolicy1.setHeightForWidth(self.aiInfoLabel.sizePolicy().hasHeightForWidth()) + self.aiInfoLabel.setSizePolicy(sizePolicy1) + self.aiInfoLabel.setTextFormat(Qt.AutoText) + + self.verticalLayout_16.addWidget(self.aiInfoLabel) + + self.spoofModelChk = QCheckBox(self.euEnablerPageContent) + self.spoofModelChk.setObjectName(u"spoofModelChk") + + self.verticalLayout_16.addWidget(self.spoofModelChk) + self.verticalSpacer_7 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.verticalLayout_16.addItem(self.verticalSpacer_7) @@ -2475,7 +2518,7 @@ class Ui_Nugget(object): self.gestaltPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) self.featureFlagsPageBtn.setText(QCoreApplication.translate("Nugget", u" Feature Flags", None)) self.featureFlagsPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) - self.euEnablerPageBtn.setText(QCoreApplication.translate("Nugget", u" EU Enabler", None)) + self.euEnablerPageBtn.setText(QCoreApplication.translate("Nugget", u" Eligibility", None)) self.euEnablerPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) self.springboardOptionsPageBtn.setText(QCoreApplication.translate("Nugget", u" Springboard Options", None)) self.springboardOptionsPageBtn.setProperty("cls", QCoreApplication.translate("Nugget", u"sidebarBtn", None)) @@ -2541,14 +2584,23 @@ class Ui_Nugget(object): self.lockscreenChk.setText(QCoreApplication.translate("Nugget", u"Enable Duplicate Lockscreen Button and Lockscreen Quickswitch", None)) self.photosChk.setText(QCoreApplication.translate("Nugget", u"Enable Old Photo UI", None)) self.aiChk.setText(QCoreApplication.translate("Nugget", u"Enable Apple Intelligence", None)) - self.setupOptionsLbl.setText(QCoreApplication.translate("Nugget", u"EU Enabler", None)) - self.euEnablerEnabledChk.setText(QCoreApplication.translate("Nugget", u"Enabled", None)) + self.eligibilityLbl.setText(QCoreApplication.translate("Nugget", u"Eligibility Tweaks", None)) + self.euEnablerEnabledChk.setText(QCoreApplication.translate("Nugget", u"Enable EU Enabler", None)) self.label_5.setText(QCoreApplication.translate("Nugget", u"Method Type", None)) self.methodChoiceDrp.setItemText(0, QCoreApplication.translate("Nugget", u"Method 1", None)) self.methodChoiceDrp.setItemText(1, QCoreApplication.translate("Nugget", u"Method 2", None)) self.label_6.setText(QCoreApplication.translate("Nugget", u"Region Code (Should be 2 letters)", None)) self.regionCodeTxt.setPlaceholderText(QCoreApplication.translate("Nugget", u"Region Code (Default: US)", None)) + self.enableAIChk.setText(QCoreApplication.translate("Nugget", u"Enable Apple Intelligence (for Unsupported Devices)", None)) + self.languageLbl.setText(QCoreApplication.translate("Nugget", u"Language Code (not needed for English)", None)) + self.languageTxt.setPlaceholderText(QCoreApplication.translate("Nugget", u"Language Code (i.e. en)", None)) + self.aiInfoLabel.setText(QCoreApplication.translate("Nugget", u"In order to download the AI model, you must spoof the device model. This will break Face ID until\n" +"you revert.\n" +"\n" +"Once the model has downloaded, disable \"Spoof Device Model\" and click the \"Apply Tweaks\"\n" +"button on the \"Apply\" page again to fix Face ID.", None)) + self.spoofModelChk.setText(QCoreApplication.translate("Nugget", u"Spoof Device Model", None)) self.springboardOptionsLbl.setText(QCoreApplication.translate("Nugget", u"Springboard Options", None)) self.label_13.setText(QCoreApplication.translate("Nugget", u"Lock Screen Footnote Text", None)) self.footnoteTxt.setPlaceholderText(QCoreApplication.translate("Nugget", u"Footnote Text", None)) diff --git a/tweaks/eligibility_tweak.py b/tweaks/eligibility_tweak.py index 42da131..c2bf966 100644 --- a/tweaks/eligibility_tweak.py +++ b/tweaks/eligibility_tweak.py @@ -89,4 +89,44 @@ class EligibilityTweak(Tweak): # return the new files to restore return files_to_restore - \ No newline at end of file + + +class AITweak(Tweak): + def __init__(self): + super().__init__(label="Enable Apple Intelligence (for Unsupported Devices) (Eligibility)", key=None, value="", min_version=Version("18.1")) + + def set_language_code(self, lang: str): + self.value = lang + + def apply_tweak(self) -> FileToRestore: + if not self.enabled: + return None + langs = ["en"] + if self.value != "": + langs.append(self.value) + plist = { + "OS_ELIGIBILITY_DOMAIN_CALCIUM": { + "os_eligibility_answer_source_t": 1, + "os_eligibility_answer_t": 2, + "status": { + "OS_ELIGIBILITY_INPUT_CHINA_CELLULAR": 2 + } + }, + "OS_ELIGIBILITY_DOMAIN_GREYMATTER": { + "context": { + "OS_ELIGIBILITY_CONTEXT_ELIGIBLE_DEVICE_LANGUAGES": langs + }, + "os_eligibility_answer_source_t": 1, + "os_eligibility_answer_t": 4, + "status": { + "OS_ELIGIBILITY_INPUT_DEVICE_LANGUAGE": 3, + "OS_ELIGIBILITY_INPUT_DEVICE_REGION_CODE": 3, + "OS_ELIGIBILITY_INPUT_EXTERNAL_BOOT_DRIVE": 3, + "OS_ELIGIBILITY_INPUT_GENERATIVE_MODEL_SYSTEM": 3, + "OS_ELIGIBILITY_INPUT_SHARED_IPAD": 3, + "OS_ELIGIBILITY_INPUT_SIRI_LANGUAGE": 3 + } + } + } + + return FileToRestore(contents=plistlib.dumps(plist), restore_path="/var/db/eligibilityd/eligibility.plist") \ No newline at end of file diff --git a/tweaks/tweaks.py b/tweaks/tweaks.py index 549afd5..7b3a512 100644 --- a/tweaks/tweaks.py +++ b/tweaks/tweaks.py @@ -1,6 +1,6 @@ from devicemanagement.constants import Version from .tweak_classes import MobileGestaltTweak, MobileGestaltMultiTweak, MobileGestaltPickerTweak, FeatureFlagTweak, TweakModifyType, BasicPlistTweak -from .eligibility_tweak import EligibilityTweak +from .eligibility_tweak import EligibilityTweak, AITweak from .basic_plist_locations import FileLocation @@ -37,6 +37,11 @@ tweaks = { "PhotoUI": FeatureFlagTweak("Enable Old Photo UI", flag_category='Photos', flag_names=['Lemonade'], is_list=False, inverted=True, min_version=Version("18.0")), "AI": FeatureFlagTweak("Enable Apple Intelligence", flag_category='SpringBoard', flag_names=['Domino', 'SuperDomino'], min_version=Version("18.1"), divider_below=True), + ## AI Enabler + "AIEligibility": AITweak(), + "AIGestalt": MobileGestaltTweak("Enable Apple Intelligence (for Unsupported Devices) (Gestalt)", "A62OafQ85EJAiiqKn4agtg", min_version=Version("18.1")), + "SpoofModel": MobileGestaltTweak("Spoof Device Model", "h9jDsbgj7xIVeIQ8S3/X3Q", value="iPhone17,3", min_version=Version("18.1"), divider_below=True), + ## Springboard Tweaks "LockScreenFootnote": BasicPlistTweak( "Set Lock Screen Footnote Text",