Skip to content

Commit

Permalink
disable appview’s automatic lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanArbuckle committed Jul 15, 2024
1 parent fc7e12f commit 5fd270d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/CRCarplayWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ - (void)setupLiveAppView
self.appViewController = objcInvoke_2([objc_getClass("SBAppViewController") alloc], @"initWithIdentifier:andApplicationSceneEntity:", appIdentifier, appSceneEntity);
assertGotExpectedObject(self.appViewController, @"SBAppViewController");
objcInvoke_1(self.appViewController, @"setIgnoresOcclusions:", 0);
setIvar(self.appViewController, @"_currentMode", @(2));
objcInvoke_1(self.appViewController, @"setAutomatesLifecycle:", 0);
objcInvoke_1(self.appViewController, @"setRequestedMode:", @(2));
objcInvoke(getIvar(self.appViewController, @"_activationSettings"), @"clearActivationSettings");

id sceneUpdateTransaction = objcInvoke_2(self.appViewController, @"_createSceneUpdateTransactionForApplicationSceneEntity:deliveringActions:", appSceneEntity, 1);
Expand Down
14 changes: 12 additions & 2 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <objc/message.h>
#include <dlfcn.h>
#include "CRPreferences.h"
#include <substrate.h>

#define BAIL_IF_UNSUPPORTED_IOS { \
if ([[[UIDevice currentDevice] systemVersion] compare:@"14.0" options:NSNumericSearch] == NSOrderedAscending) \
Expand All @@ -16,9 +17,18 @@
if ([func containsString:@"_method$"]) \
{ \
NSArray *components = [func componentsSeparatedByString:@"$"]; \
func = [NSString stringWithFormat:@"[%@ %@]", components[2], components[3]]; \
NSString *className = components[2]; \
NSMutableArray *methodComponents = [NSMutableArray array]; \
for (NSUInteger i = 3; i < components.count; i++) { \
[methodComponents addObject:components[i]]; \
if (i < components.count - 1) { \
[methodComponents addObject:@":"]; \
} \
} \
NSString *formattedMethod = [methodComponents componentsJoinedByString:@""]; \
func = [NSString stringWithFormat:@"[%@ %@]", className, formattedMethod]; \
} \
NSLog(@"carplayenable LOG_LIFECYCLE_EVENT %@", func); \
NSLog(@"[carplayenable] %@", func); \
}

#define getIvar(object, ivar) [object valueForKey:ivar]
Expand Down
1 change: 0 additions & 1 deletion src/hooks/SpringBoard.xm
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ Is this a main-screen scene view for an application that is being hosted on the
}

- (id)homeGrabberView {
LOG_LIFECYCLE_EVENT;

id homeGrabberView = %orig;
if (!homeGrabberView) {
Expand Down

0 comments on commit 5fd270d

Please sign in to comment.