break;
case 2:
+ // XXX: there are better ways of restarting SpringBoard that would actually save state
exit(0);
break;
void SafeModeAlertItem$configure$requirePasscodeForActions$(id self, SEL sel, BOOL configure, BOOL require) {
UIAlertView *sheet([self alertSheet]);
+
[sheet setDelegate:self];
[sheet setBodyText:@"We apologize for the inconvenience, but SpringBoard has just crashed.\n\nMobileSubstrate /did not/ cause this problem: it has protected you from it.\n\nYour device is now running in Safe Mode. All extensions that support this safety system are disabled.\n\nReboot (or restart SpringBoard) to return to the normal mode. To return to this dialog touch the status bar.\n\nTap \"Help\" below for more tips."];
[sheet addButtonWithTitle:@"OK"];
[sheet addButtonWithTitle:@"Restart"];
[sheet addButtonWithTitle:@"Help"];
[sheet setNumberOfRows:1];
+
if ([sheet respondsToSelector:@selector(setForceHorizontalButtonsLayout:)])
[sheet setForceHorizontalButtonsLayout:YES];
}
[[$SBAlertItemsController sharedInstance] activateAlertItem:[[[$SafeModeAlertItem alloc] init] autorelease]];
}
+
+// XXX: on iOS 5.0, we really would prefer avoiding
+
MSInstanceMessageHook2(void, SBStatusBar, touchesEnded,withEvent, id, touches, id, event) {
MSAlert();
MSOldCall(touches, event);
MSOldCall(touches, event);
}
+
+// this fairly complex code came from Grant, to solve the "it Safe Mode"-in-bar bug
+
MSInstanceMessageHook0(void, SBStatusBarDataManager, _updateTimeString) {
char *_data(&MSHookIvar<char>(self, "_data"));
if (_data == NULL)
strcpy(timeString, "Exit Safe Mode");
}
+
static bool alerted_;
static void AlertIfNeeded() {
MSAlert();
}
+
+// on iOS 4.3 and above we can use this advertisement, which seems to check every time the user unlocks
+// XXX: verify that this still works on iOS 5.0
+
MSClassMessageHook0(void, AAAccountManager, showMobileMeOfferIfNecessary) {
AlertIfNeeded();
}
+
+// -[SBIconController showInfoAlertIfNeeded] explains how to drag icons around the iPhone home screen
+// it used to be shown to users when they unlocked their screen for the first time, and happened every unlock
+// however, as of iOS 4.3, it got relegated to only appearing once the user installed an app or web clip
+
MSInstanceMessageHook0(void, SBIconController, showInfoAlertIfNeeded) {
AlertIfNeeded();
}
+
+// the icon state, including crazy configurations like Five Icon Dock, is stored in SpringBoard's defaults
+// unfortunately, SpringBoard on iOS 2.0 and 2.1 (maybe 2.2 as well) buffer overrun with more than 4 icons
+// there is a third party package called IconSupport that remedies this, but not everyone is using it yet
+
MSInstanceMessageHook0(int, SBButtonBar, maxIconColumns) {
static int max;
if (max == 0) {
} return max;
}
+
MSInstanceMessageHook0(id, SBUIController, init) {
if ((self = MSOldCall()) != nil) {
UIView *&_contentLayer(MSHookIvar<UIView *>(self, "_contentLayer"));
_textRect.origin.y = (frame.size.height - size.height) / 2;
}
+
+// notification widgets ("wee apps" or "bulletin board sections") are capable of crashing SpringBoard
+// unfortunately, which ones are in use are stored in SpringBoard's defaults, so we need to turn them off
+
MSInstanceMessageHook0(BOOL, BBSectionInfo, showsInNotificationCenter) {
return NO;
}