mirror of
https://github.com/opa334/TrollStore.git
synced 2026-08-17 07:26:08 +08:00
Add option to open app with JIT
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
- (NSAttributedString*)detailedInfoTitle;
|
||||
- (NSAttributedString*)detailedInfoDescription;
|
||||
//- (UIImage*)image;
|
||||
- (BOOL)isDebuggable;
|
||||
- (void)log;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1165,5 +1165,23 @@ extern UIImage* imageWithSize(UIImage* image, CGSize size);
|
||||
}];
|
||||
}
|
||||
|
||||
- (BOOL)isDebuggable
|
||||
{
|
||||
[self loadEntitlements];
|
||||
__block BOOL debuggable = NO;
|
||||
[self enumerateAllEntitlements:^(NSString *key, NSObject *value, BOOL *stop)
|
||||
{
|
||||
if([key isEqualToString:@"get-task-allow"])
|
||||
{
|
||||
NSNumber* valueNum = (NSNumber*)value;
|
||||
if(valueNum && [valueNum isKindOfClass:NSNumber.class])
|
||||
{
|
||||
debuggable = valueNum.boolValue;
|
||||
*stop = YES;
|
||||
}
|
||||
}
|
||||
}];
|
||||
return debuggable;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -187,7 +187,7 @@ UIImage* imageWithSize(UIImage* image, CGSize size)
|
||||
[TSInstallationController presentInstallationAlertIfEnabledForFile:pathToIPA isRemoteInstall:NO completion:nil];
|
||||
}
|
||||
|
||||
- (void)openAppPressedForRowAtIndexPath:(NSIndexPath*)indexPath
|
||||
- (void)openAppPressedForRowAtIndexPath:(NSIndexPath*)indexPath enableJIT:(BOOL)enableJIT
|
||||
{
|
||||
TSApplicationsManager* appsManager = [TSApplicationsManager sharedInstance];
|
||||
|
||||
@@ -211,6 +211,17 @@ UIImage* imageWithSize(UIImage* image, CGSize size)
|
||||
[didFailController addAction:cancelAction];
|
||||
[TSPresentationDelegate presentViewController:didFailController animated:YES completion:nil];
|
||||
}
|
||||
else if (enableJIT)
|
||||
{
|
||||
int ret = [appsManager enableJITForBundleID:appId];
|
||||
if (ret != 0)
|
||||
{
|
||||
UIAlertController* errorAlert = [UIAlertController alertControllerWithTitle:@"Error" message:[NSString stringWithFormat:@"Error enabling JIT: trollstorejithelper returned %d", ret] preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertAction* closeAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:nil];
|
||||
[errorAlert addAction:closeAction];
|
||||
[TSPresentationDelegate presentViewController:errorAlert animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showDetailsPressedForRowAtIndexPath:(NSIndexPath*)indexPath
|
||||
@@ -424,11 +435,21 @@ UIImage* imageWithSize(UIImage* image, CGSize size)
|
||||
|
||||
UIAlertAction* openAction = [UIAlertAction actionWithTitle:@"Open" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action)
|
||||
{
|
||||
[self openAppPressedForRowAtIndexPath:indexPath];
|
||||
[self openAppPressedForRowAtIndexPath:indexPath enableJIT:NO];
|
||||
[self deselectRow];
|
||||
}];
|
||||
[appSelectAlert addAction:openAction];
|
||||
|
||||
if ([appInfo isDebuggable])
|
||||
{
|
||||
UIAlertAction* openWithJITAction = [UIAlertAction actionWithTitle:@"Open with JIT" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action)
|
||||
{
|
||||
[self openAppPressedForRowAtIndexPath:indexPath enableJIT:YES];
|
||||
[self deselectRow];
|
||||
}];
|
||||
[appSelectAlert addAction:openWithJITAction];
|
||||
}
|
||||
|
||||
UIAlertAction* showDetailsAction = [UIAlertAction actionWithTitle:@"Show Details" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action)
|
||||
{
|
||||
[self showDetailsPressedForRowAtIndexPath:indexPath];
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
- (int)uninstallApp:(NSString*)appId;
|
||||
- (int)uninstallAppByPath:(NSString*)path;
|
||||
- (BOOL)openApplicationWithBundleID:(NSString *)appID;
|
||||
- (int)enableJITForBundleID:(NSString *)appID;
|
||||
- (int)changeAppRegistration:(NSString*)appPath toState:(NSString*)newState;
|
||||
|
||||
@end
|
||||
@@ -179,6 +179,11 @@ extern NSUserDefaults* trollStoreUserDefaults();
|
||||
return [[LSApplicationWorkspace defaultWorkspace] openApplicationWithBundleID:appId];
|
||||
}
|
||||
|
||||
- (int)enableJITForBundleID:(NSString *)appId
|
||||
{
|
||||
return spawnRoot(rootHelperPath(), @[@"enable-jit", appId], nil, nil);
|
||||
}
|
||||
|
||||
- (int)changeAppRegistration:(NSString*)appPath toState:(NSString*)newState
|
||||
{
|
||||
if(!appPath || !newState) return -200;
|
||||
|
||||
Reference in New Issue
Block a user