Created
December 11, 2011 20:31
-
-
Save kylehowells/1462582 to your computer and use it in GitHub Desktop.
Launch SBApplication's (iOS 5.x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* References: | |
* http://iky1e.tumblr.com/post/13985531616/raw-log-sbdisplay-settings | |
* http://iphonedevwiki.net/index.php/SBDisplay | |
* http://iphonedevwiki.net/index.php/SBDisplayStack | |
* http://code.google.com/p/iphone-tweaks/wiki/DevelopmentNotes | |
*/ | |
#pragma mark - Active and deactivate applications | |
-(void)activateApplication:(SBApplication *)toApp animated:(BOOL)animated{ | |
// Get the currently open application. | |
SBApplication *fromApp = [self topApplication]; | |
// Check if it's the same as the currently open application, if it is there's nothing todo. | |
if ([[toApp displayIdentifier] isEqualToString:[fromApp displayIdentifier]]) | |
return; | |
// If animated they want the system default (app to app transition, or zoom on homescreen). | |
if (animated && toApp) { | |
[(SBUIController*)[objc_getClass("SBUIController") sharedInstance] activateApplicationFromSwitcher:toApp]; | |
return; // Done, wasn't that easy. | |
} | |
// Now, if we were asked to, open the other app. | |
if (toApp) { | |
[toApp clearDisplaySettings]; | |
[toApp clearActivationSettings]; | |
[toApp clearDeactivationSettings]; | |
// 20 = appToApp | |
[toApp setActivationSetting:20 flag:YES]; | |
// Note if it's a large application the user might see a brief flash of the homescreen. | |
[[self SBWPreActivateDisplayStack] pushDisplay:toApp]; | |
} | |
// If another app is open then close it | |
if (fromApp) { | |
// Clear any animation settings the app may have | |
[fromApp clearDisplaySettings]; | |
[fromApp clearActivationSettings]; | |
[fromApp clearDeactivationSettings]; | |
// Now pop is from the Active displayStack | |
[[self SBWActiveDisplayStack] popDisplay:fromApp]; | |
// And push it onto the Suspending displayStack | |
[[self SBWSuspendingDisplayStack] pushDisplay:fromApp]; | |
} | |
if (!toApp) { | |
// The user should now be on the homescreen. | |
// There's a bug above 4.? (4.1 or 4.2 I think) where the status bar won't be there. | |
SBUIController *uiController = (SBUIController*)[objc_getClass("SBUIController") sharedInstance]; | |
if ([uiController respondsToSelector:@selector(createFakeSpringBoardStatusBar)]) { | |
[uiController createFakeSpringBoardStatusBar]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment