mirror of
				https://github.com/opa334/TrollStore.git
				synced 2025-11-04 15:42:35 +08:00 
			
		
		
		
	Option to open apps in action sheet
This commit is contained in:
		
							parent
							
								
									92e4981ac0
								
							
						
					
					
						commit
						736a467588
					
				@ -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,27 @@
 | 
				
			|||||||
    [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:^(UIAlertAction* action)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        }];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        [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];
 | 
				
			||||||
@ -134,6 +155,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
 | 
				
			||||||
@ -148,6 +148,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
	
	Block a user