From f7673201a860fde2a2fe6ee230dee94c9c4f3660 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 30 Aug 2011 02:04:02 -0700 Subject: Fix the silly info popup on iOS 4.3 Safe Mode. --- MobileSafety.mm | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/MobileSafety.mm b/MobileSafety.mm index d62cab4..a1d93cc 100644 --- a/MobileSafety.mm +++ b/MobileSafety.mm @@ -31,8 +31,12 @@ MSClassHook(UIStatusBar) MSClassHook(UIImage) MSMetaClassHook(UIImage) +MSClassHook(AAAccountManager) +MSMetaClassHook(AAAccountManager) + MSClassHook(SBAlertItemsController) MSClassHook(SBButtonBar) +MSClassHook(SBIconController) MSClassHook(SBStatusBar) MSClassHook(SBStatusBarDataManager) MSClassHook(SBStatusBarTimeView) @@ -156,14 +160,23 @@ MSInstanceMessageHook0(void, SBStatusBarDataManager, _updateTimeString) { strcpy(timeString, "Exit Safe Mode"); } -static void SBIconController$showInfoAlertIfNeeded(id self, SEL sel) { - static bool loaded = false; - if (loaded) +static bool alerted_; + +static void AlertIfNeeded() { + if (alerted_) return; - loaded = true; + alerted_ = true; MSAlert(); } +MSClassMessageHook0(void, AAAccountManager, showMobileMeOfferIfNecessary) { + AlertIfNeeded(); +} + +MSInstanceMessageHook0(void, SBIconController, showInfoAlertIfNeeded) { + AlertIfNeeded(); +} + MSInstanceMessageHook0(int, SBButtonBar, maxIconColumns) { static int max; if (max == 0) { @@ -244,13 +257,5 @@ MSInitialize { } } - $SBAlertItemsController = objc_getClass("SBAlertItemsController"); - - if (Class _class = objc_getClass("SBIconController")) { - SEL sel(@selector(showInfoAlertIfNeeded)); - if (Method method = class_getInstanceMethod(_class, sel)) - method_setImplementation(method, (IMP) &SBIconController$showInfoAlertIfNeeded); - } - [pool release]; } -- cgit v1.2.3