Only store last document, when MacPass is terminating

Moved code from MPDocument to MPDocumentController
This commit is contained in:
Michael Starke
2021-12-15 11:37:28 +01:00
parent 7376a5c887
commit 66ad8cee17
4 changed files with 20 additions and 9 deletions

View File

@@ -92,6 +92,7 @@ typedef NS_OPTIONS(NSInteger, MPAppStartupState) {
_userNotificationCenterDelegate = [[MPUserNotificationCenterDelegate alloc] init];
self.itemActionMenuDelegate = [[MPEntryContextMenuDelegate alloc] init];
_shouldOpenFile = NO;
_isTerminating = NO;
self.startupState = MPAppStartupStateNone;
[NSNotificationCenter.defaultCenter addObserver:self
@@ -185,6 +186,7 @@ typedef NS_OPTIONS(NSInteger, MPAppStartupState) {
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
_isTerminating = YES;
[self hideWelcomeWindow];
if(MPTemporaryFileStorageCenter.defaultCenter.hasPendingStorages) {
dispatch_async(dispatch_get_main_queue(), ^{