[Sandbox Configuration] Delete from storage later

Only delete from storage after deleting it from the UI list.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-21 16:15:50 -07:00
parent 51f8536943
commit 3d8f470206
1 changed files with 13 additions and 8 deletions

View File

@ -77,6 +77,15 @@
}
- (void)removePath:(NSString *)path {
NSArray *objects = [[self arrangedObjects] copy];
for(NSDictionary *obj in objects) {
if([[obj objectForKey:@"path"] isEqualToString:path]) {
[self removeObject:obj];
break;
}
}
NSPersistentContainer *pc = [NSClassFromString(@"PlaylistController") sharedPersistentContainer];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"path == %@", path];
@ -93,13 +102,9 @@
}
}
NSArray *objects = [self arrangedObjects];
for(NSDictionary *obj in objects) {
if([[obj objectForKey:@"path"] isEqualToString:path]) {
[self removeObject:obj];
break;
}
[pc.viewContext save:&error];
if(error) {
ALog(@"Error deleting bookmark: %@", [error localizedDescription]);
}
}