Skip to content

Commit

Permalink
Allow deleting data folder when uninstalling. Removed some debug NSLog.
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeBlack committed Aug 19, 2024
1 parent f5bad50 commit 91529ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 1 addition & 3 deletions LiveContainerUI/LCAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
NSLog(@"[LiveContainer]got url to open: %@", url);
NSLog(@"[LiveContainer]host: %@", url.host);
// handle page open request from URL scheme
if([url.host isEqualToString:@"open-web-page"]) {
NSURLComponents* urlComponent = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
if(urlComponent.queryItems.count == 0){
Expand All @@ -31,7 +30,6 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(N

NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:urlComponent.queryItems[0].value options:0];
NSString *decodedUrl = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
NSLog(@"[LiveContainer]Webpage to open: %@", decodedUrl);
[((LCTabBarController*)_rootViewController) openWebPage:decodedUrl];
}
return [LCUtils launchToGuestAppWithURL:url];
Expand Down
14 changes: 14 additions & 0 deletions LiveContainerUI/LCAppListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,20 @@ - (void)deleteItemAtIndexPath:(NSIndexPath *)indexPath completionHandler:(void(^
} else {
[self.objects removeObjectAtIndex:indexPath.row];
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[self showConfirmationDialogTitle:@"Delete Data Folder"
message:[NSString stringWithFormat:@"Do you also want to delete data folder of %@? You can keep it for future use.", appInfo.displayName]
destructive:YES
confirmButtonTitle:@"Delete"
handler:^(UIAlertAction * action) {
if (action.style != UIAlertActionStyleCancel) {
NSError *error = nil;
NSString* dataFolderPath = [NSString stringWithFormat:@"%@/Data/Application/%@", self.docPath, [appInfo dataUUID]];
[NSFileManager.defaultManager removeItemAtPath:dataFolderPath error:&error];
if (error) {
[self showDialogTitle:@"Error" message:error.localizedDescription];
}
}
}];
}
}
handler(YES);
Expand Down

0 comments on commit 91529ad

Please sign in to comment.