]> git.saurik.com Git - safemode-ios.git/commitdiff
Fix the silly info popup on iOS 4.3 Safe Mode.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 30 Aug 2011 09:04:02 +0000 (02:04 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 12 Oct 2011 22:14:24 +0000 (15:14 -0700)
MobileSafety.mm

index d62cab444f068cdbee1ad173b556de89fcf7a043..a1d93cc84a0d35b91fd725e2a11fcb5b1244fc99 100644 (file)
@@ -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];
 }