]> git.saurik.com Git - safemode-ios.git/blobdiff - Tweak.xm
Fix display of dialog (very large font) on iOS 8.
[safemode-ios.git] / Tweak.xm
index 9b4a1338a6ef9a5a166400554af628b6c2f2047a..f5b48163dd25bc8b2a6ad8fa7fd5409f1971b773 100644 (file)
--- a/Tweak.xm
+++ b/Tweak.xm
@@ -88,6 +88,7 @@ void SafeModeAlertItem$configure$requirePasscodeForActions$(id self, SEL sel, BO
     UIAlertView *sheet([self alertSheet]);
 
     [sheet setDelegate:self];
+    [sheet setTitle:@""];
     [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"];
@@ -205,24 +206,33 @@ static void AlertIfNeeded() {
     MSAlert();
 }
 
-// on iOS 7 (maybe also iOS 6) we should really just hook the unlock mechanism
-// XXX: deterine where this works and maybe unify this code
-
+// iOS 7
 %hook SBLockScreenManager
 - (void) _finishUIUnlockFromSource:(int)source withOptions:(id)options {
     %orig;
     AlertIfNeeded();
 } %end
 
+// iOS 6
+%hook SBAwayController
+- (void) _finishUnlockWithSound:(BOOL)sound unlockSource:(int)source isAutoUnlock:(BOOL)is {
+    %orig;
+    AlertIfNeeded();
+} %end
 
-// 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
-
-%hook AAAccountManager
-+ (void) showMobileMeOfferIfNecessary {
+// iOS 5
+%hook SBAwayController
+- (void) _unlockWithSound:(BOOL)sound isAutoUnlock:(BOOL)is unlockSource:(int)source {
+    %orig;
     AlertIfNeeded();
 } %end
 
+// iOS 4.3 XXX: check lower versions
+%hook SBAwayController
+- (void) _unlockWithSound:(BOOL)sound isAutoUnlock:(BOOL)is unlockType:(int)type {
+    %orig;
+    AlertIfNeeded();
+} %end
 
 // -[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
@@ -278,6 +288,11 @@ static void AlertIfNeeded() {
 
 #define Paper_ "/Library/MobileSubstrate/MobileSafety.png"
 
+%hook SBWallpaperImage
++ (id) alloc {
+    return nil;
+} %end
+
 %hook UIImage
 + (UIImage *) defaultDesktopImage {
     return [UIImage imageWithContentsOfFile:@Paper_];