mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-15 21:21:45 +00:00
now remove host from database when the user removes it
This commit is contained in:
@@ -20,5 +20,6 @@
|
|||||||
- (NSArray*) retrieveHosts;
|
- (NSArray*) retrieveHosts;
|
||||||
- (void) saveHosts;
|
- (void) saveHosts;
|
||||||
- (Host*) createHost;
|
- (Host*) createHost;
|
||||||
|
- (void) removeHost:(Host*)host;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -51,6 +51,10 @@
|
|||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) removeHost:(Host*)host {
|
||||||
|
[[self.appDelegate managedObjectContext] deleteObject:host];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) saveHosts {
|
- (void) saveHosts {
|
||||||
NSError* error;
|
NSError* error;
|
||||||
if (![[self.appDelegate managedObjectContext] save:&error]) {
|
if (![[self.appDelegate managedObjectContext] save:&error]) {
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ static StreamConfiguration* streamConfig;
|
|||||||
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Remove Host" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
|
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Remove Host" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
|
||||||
[hostList removeObject:host];
|
[hostList removeObject:host];
|
||||||
[_discMan removeHostFromDiscovery:host];
|
[_discMan removeHostFromDiscovery:host];
|
||||||
|
DataManager* dataMan = [[DataManager alloc] init];
|
||||||
|
[dataMan removeHost:host];
|
||||||
}]];
|
}]];
|
||||||
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
|
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
|
||||||
[self presentViewController:longClickAlert animated:YES completion:^{
|
[self presentViewController:longClickAlert animated:YES completion:^{
|
||||||
|
|||||||
Reference in New Issue
Block a user