mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
Remove apps from the database when they are removed from the app list
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
- (void) updateAppsForExistingHost:(TemporaryHost *)host;
|
- (void) updateAppsForExistingHost:(TemporaryHost *)host;
|
||||||
- (void) updateIconForExistingApp:(TemporaryApp*)app;
|
- (void) updateIconForExistingApp:(TemporaryApp*)app;
|
||||||
- (void) removeHost:(TemporaryHost*)host;
|
- (void) removeHost:(TemporaryHost*)host;
|
||||||
|
- (void) removeApp:(TemporaryApp*)app;
|
||||||
|
|
||||||
- (TemporarySettings*) getSettings;
|
- (TemporarySettings*) getSettings;
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) removeApp:(TemporaryApp*)app {
|
||||||
|
[_managedObjectContext performBlockAndWait:^{
|
||||||
|
App* managedApp = [self getAppForTemporaryApp:app];
|
||||||
|
if (managedApp != nil) {
|
||||||
|
[_managedObjectContext deleteObject:managedApp];
|
||||||
|
[self saveData];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) removeHost:(TemporaryHost*)host {
|
- (void) removeHost:(TemporaryHost*)host {
|
||||||
[_managedObjectContext performBlockAndWait:^{
|
[_managedObjectContext performBlockAndWait:^{
|
||||||
Host* managedHost = [self getHostForTemporaryHost:host];
|
Host* managedHost = [self getHostForTemporaryHost:host];
|
||||||
|
|||||||
@@ -195,6 +195,11 @@ static NSMutableSet* hostList;
|
|||||||
|
|
||||||
[host.appList removeObject:app];
|
[host.appList removeObject:app];
|
||||||
|
|
||||||
|
// It's important to remove the app record from the database
|
||||||
|
// since we'll have a constraint violation now that appList
|
||||||
|
// doesn't have this app in it.
|
||||||
|
[database removeApp:app];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user