Fix auto parse url if app is closed

This commit is contained in:
relikd
2019-02-11 20:28:03 +01:00
parent 9bb1b23d8c
commit 5ed99a6e51
3 changed files with 24 additions and 16 deletions

View File

@@ -60,12 +60,14 @@
url = [url substringFromIndex:5];
if ([url hasPrefix:@"//"])
url = [url substringFromIndex:2];
[FeedDownload autoDownloadAndParseURL:url];
[FeedDownload autoDownloadAndParseURL:url successBlock:^{
[self reopenPreferencesIfOpen];
}];
}
}
#pragma mark - Handle Menu Interaction
#pragma mark - App Preferences
/// Called whenever the user activates the preferences (either through menu click or hotkey).
@@ -87,6 +89,16 @@
[FeedDownload scheduleUpdateForUpcomingFeeds];
}
/// Close previous preferences window and re-open at the same position (will drop undo manager stack!)
- (void)reopenPreferencesIfOpen {
if (self.prefWindow) {
CGPoint screenPoint = self.prefWindow.window.frame.origin;
[self.prefWindow close];
[self openPreferences];
[self.prefWindow.window setFrameOrigin:screenPoint];
}
}
#pragma mark - Core Data stack
@@ -109,10 +121,6 @@
return _persistentContainer;
}
#pragma mark - Core Data Saving and Undo support
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
// Save changes in the application's managed object context before the application terminates.
NSManagedObjectContext *context = self.persistentContainer.viewContext;