summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MobileSafety.mm29
1 files 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];
}