[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
parent
51f8536943
commit
3d8f470206
|
@ -77,6 +77,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removePath:(NSString *)path {
|
- (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];
|
NSPersistentContainer *pc = [NSClassFromString(@"PlaylistController") sharedPersistentContainer];
|
||||||
|
|
||||||
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"path == %@", path];
|
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"path == %@", path];
|
||||||
|
@ -92,14 +101,10 @@
|
||||||
[pc.viewContext deleteObject:token];
|
[pc.viewContext deleteObject:token];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray *objects = [self arrangedObjects];
|
[pc.viewContext save:&error];
|
||||||
|
if(error) {
|
||||||
for(NSDictionary *obj in objects) {
|
ALog(@"Error deleting bookmark: %@", [error localizedDescription]);
|
||||||
if([[obj objectForKey:@"path"] isEqualToString:path]) {
|
|
||||||
[self removeObject:obj];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue