From 7881801d12f92ff8263c6e81d7168417586f2beb Mon Sep 17 00:00:00 2001 From: Ryan Burke Date: Thu, 13 Nov 2014 12:37:19 +0000 Subject: [PATCH] When Activator is uninstalled, prompt the user to respring. - Eventually this should work for any application that depends on Cydia Substrate. --- CyDelete.xm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CyDelete.xm b/CyDelete.xm index 6f8f969..ae55255 100644 --- a/CyDelete.xm +++ b/CyDelete.xm @@ -39,7 +39,7 @@ static NSOperationQueue *uninstallQueue; } @end -@interface CDUninstallDpkgOperation : CDUninstallOperation { +@interface CDUninstallDpkgOperation : CDUninstallOperation { NSString *_package; } @property (nonatomic, retain) NSString *package; @@ -222,11 +222,28 @@ static id ownerForSBApplication(SBApplication *application) { [delView show]; } + -(void)displayRespring { + NSString *body = [NSString stringWithFormat:CDLocalizedString(@"PACKAGE_FINISH_BODY"), _package, @"respring"]; + UIAlertView *respring = [[UIAlertView alloc] initWithTitle:CDLocalizedString(@"PACKAGE_FINISH_RESTART") message:body delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil]; + respring.tag = 100; + [respring show]; + } + - (void)main { NSString *command = [NSString stringWithFormat:@"/usr/libexec/cydelete/setuid /usr/libexec/cydelete/uninstall_dpkg.sh %@", _package]; NSString *output = outputForShellCommand(command); if(!output) [self performSelectorOnMainThread:@selector(displayError) withObject:nil waitUntilDone:NO]; [self completeOperation]; + //Horrible code - need a way to detect if an application needs a respring after uninstall. ("apt-cache depends pkgname" contains mobilesubstrate?) + if([_package isEqualToString:@"libactivator"]) { + [self performSelectorOnMainThread:@selector(displayRespring) withObject:nil waitUntilDone:NO]; + } + } + + -(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ + if (alertView.tag == 100) { + outputForShellCommand(@"killall -9 SpringBoard"); + } } @end