mirror of https://github.com/opa334/TrollStore.git
Merge pull request #148 from SerenaKit/serena/open-opt
Option to open apps in action sheet
This commit is contained in:
commit
b766a8586f
|
@ -23,6 +23,7 @@
|
||||||
- (BOOL)unregisterApplication:(id)arg1;
|
- (BOOL)unregisterApplication:(id)arg1;
|
||||||
- (BOOL)_LSPrivateRebuildApplicationDatabasesForSystemApps:(BOOL)arg1 internal:(BOOL)arg2 user:(BOOL)arg3;
|
- (BOOL)_LSPrivateRebuildApplicationDatabasesForSystemApps:(BOOL)arg1 internal:(BOOL)arg2 user:(BOOL)arg3;
|
||||||
- (BOOL)uninstallApplication:(NSString*)arg1 withOptions:(id)arg2;
|
- (BOOL)uninstallApplication:(NSString*)arg1 withOptions:(id)arg2;
|
||||||
|
- (BOOL)openApplicationWithBundleID:(NSString *)arg1 ;
|
||||||
- (void)enumerateApplicationsOfType:(NSUInteger)type block:(void (^)(LSApplicationProxy*))block;
|
- (void)enumerateApplicationsOfType:(NSUInteger)type block:(void (^)(LSApplicationProxy*))block;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,25 @@
|
||||||
[self presentViewController:errorAlert animated:YES completion:nil];
|
[self presentViewController:errorAlert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)openAppPressedForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
|
TSApplicationsManager* appsManager = [TSApplicationsManager sharedInstance];
|
||||||
|
|
||||||
|
NSString* appPath = [appsManager installedAppPaths][indexPath.row];
|
||||||
|
NSString* appId = [appsManager appIdForAppPath:appPath];
|
||||||
|
BOOL didOpen = [appsManager openApplicationWithBundleID:appId];
|
||||||
|
|
||||||
|
// if we failed to open the app, show an alert
|
||||||
|
if (!didOpen) {
|
||||||
|
NSString *failMessage = [NSString stringWithFormat: @"Failed to open %@", appId];
|
||||||
|
UIAlertController* didFailController = [UIAlertController alertControllerWithTitle:failMessage message: nil preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
|
||||||
|
|
||||||
|
[didFailController addAction: cancelAction];
|
||||||
|
[self presentViewController:didFailController animated:YES completion:nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)uninstallPressedForRowAtIndexPath:(NSIndexPath*)indexPath
|
- (void)uninstallPressedForRowAtIndexPath:(NSIndexPath*)indexPath
|
||||||
{
|
{
|
||||||
TSApplicationsManager* appsManager = [TSApplicationsManager sharedInstance];
|
TSApplicationsManager* appsManager = [TSApplicationsManager sharedInstance];
|
||||||
|
@ -141,6 +160,13 @@
|
||||||
}];
|
}];
|
||||||
[appSelectAlert addAction:detachAction];*/
|
[appSelectAlert addAction:detachAction];*/
|
||||||
|
|
||||||
|
|
||||||
|
UIAlertAction* openAction = [UIAlertAction actionWithTitle: @"Open" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action)
|
||||||
|
{
|
||||||
|
[self openAppPressedForRowAtIndexPath:indexPath];
|
||||||
|
}];
|
||||||
|
[appSelectAlert addAction: openAction];
|
||||||
|
|
||||||
UIAlertAction* uninstallAction = [UIAlertAction actionWithTitle:@"Uninstall App" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action)
|
UIAlertAction* uninstallAction = [UIAlertAction actionWithTitle:@"Uninstall App" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action)
|
||||||
{
|
{
|
||||||
[self uninstallPressedForRowAtIndexPath:indexPath];
|
[self uninstallPressedForRowAtIndexPath:indexPath];
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
- (int)installIpa:(NSString*)pathToIpa;
|
- (int)installIpa:(NSString*)pathToIpa;
|
||||||
- (int)uninstallApp:(NSString*)appId;
|
- (int)uninstallApp:(NSString*)appId;
|
||||||
- (int)uninstallAppByPath:(NSString*)path;
|
- (int)uninstallAppByPath:(NSString*)path;
|
||||||
|
- (BOOL)openApplicationWithBundleID:(NSString *)appID;
|
||||||
//- (int)detachFromApp:(NSString*)appId;
|
//- (int)detachFromApp:(NSString*)appId;
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -156,6 +156,11 @@
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)openApplicationWithBundleID:(NSString *)appId
|
||||||
|
{
|
||||||
|
return [[LSApplicationWorkspace defaultWorkspace] openApplicationWithBundleID:appId];
|
||||||
|
}
|
||||||
|
|
||||||
/*- (int)detachFromApp:(NSString*)appId
|
/*- (int)detachFromApp:(NSString*)appId
|
||||||
{
|
{
|
||||||
if(!appId) return -200;
|
if(!appId) return -200;
|
||||||
|
|
Loading…
Reference in New Issue