Created
November 9, 2014 13:30
-
-
Save farfromrefug/46dd16e3dad3839e1db5 to your computer and use it in GitHub Desktop.
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
static void runBlockWithLocked(LockedActionBlock block) | |
{ | |
if ([[objc_getClass("SBDeviceLockController") sharedController] isPasscodeLocked]) { | |
SBLockScreenManager *manager = (SBLockScreenManager *)[objc_getClass("SBLockScreenManager") sharedInstance]; | |
if ([manager isUILocked]) | |
{ | |
if ([objc_getClass("SBControlCenterController") sharedInstance]) [(SBControlCenterController *)[objc_getClass("SBControlCenterController") sharedInstance] dismissAnimated:YES]; | |
void (^action)() = ^() { | |
Log(@"runBlockWithLocked test"); | |
block(); | |
}; | |
SBLockScreenViewControllerBase *controller = [(SBLockScreenManager *)[objc_getClass("SBLockScreenManager") sharedInstance] lockScreenViewController]; | |
SBUnlockActionContext *context = [[objc_getClass("SBUnlockActionContext") alloc] initWithLockLabel:nil shortLockLabel:nil unlockAction:action identifier:nil]; | |
[context setDeactivateAwayController:YES]; | |
[controller setUnlockActionContext:context]; | |
[controller setPasscodeLockVisible:YES animated:YES completion:nil]; | |
return; | |
} | |
} | |
block(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment