Skip to content

Commit

Permalink
Fix home button action crashing on iOS 15
Browse files Browse the repository at this point in the history
  • Loading branch information
DGh0st committed Feb 27, 2023
1 parent f6b758c commit feacb38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions DVirtualHome.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static NSInteger vibrationDuration = 30;
@interface SpringBoard : UIApplication
@property (nonatomic, retain) NSString *lastApplicationIdentifier;
@property (nonatomic, retain) NSString *currentApplicationIdentifier;
-(void)_simulateHomeButtonPressWithCompletion:(id)arg1;
-(void)_simulateHomeButtonPress;
-(void)_simulateLockButtonPress;
-(SBScreenshotManager *)screenshotManager;
Expand Down
10 changes: 8 additions & 2 deletions Tweak.xm
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ static NSString *currentApplicationIdentifier = nil;
return; // do nothing since we are in middle of authentication

if (action == home || ![[%c(SBBacklightController) sharedInstance] screenIsOn]) {
[(SpringBoard *)[UIApplication sharedApplication] _simulateHomeButtonPress];
SpringBoard *_springboard = (SpringBoard *)[UIApplication sharedApplication];
if ([_springboard respondsToSelector:@selector(_simulateHomeButtonPress)])
[(SpringBoard *)[UIApplication sharedApplication] _simulateHomeButtonPress];
else if ([_springboard respondsToSelector:@selector(_simulateHomeButtonPressWithCompletion:)])
[(SpringBoard *)[UIApplication sharedApplication] _simulateHomeButtonPressWithCompletion:nil];
} else if (action == lock) {
[(SpringBoard *)[UIApplication sharedApplication] _simulateLockButtonPress];
} else if (action == switcher) {
Expand Down Expand Up @@ -184,8 +188,10 @@ static NSString *currentApplicationIdentifier = nil;

SASRequestOptions *requestOptions = [[%c(SASRequestOptions) alloc] initWithRequestSource:1 uiPresentationIdentifier:@"com.apple.siri.Siriland"];
requestOptions.useAutomaticEndpointing = YES;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
AFApplicationInfo *applicationInfo = [[%c(AFApplicationInfo) alloc] initWithCoder:nil];
#pragma clang diagnostic pop
applicationInfo.pid = [NSProcessInfo processInfo].processIdentifier;
applicationInfo.identifier = [NSBundle mainBundle].bundleIdentifier;
requestOptions.contextAppInfosForSiriViewController = @[applicationInfo];
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: com.dgh0st.dvirtualhome
Name: DVirtualHome
Depends: mobilesubstrate, preferenceloader
Version: 0.0.15
Version: 0.0.16
Architecture: iphoneos-arm
Description: My attempt at making virtual home iOS 10 compatible.
Maintainer: DGh0st <deeppwnage@yahoo.com>
Expand Down

0 comments on commit feacb38

Please sign in to comment.