From c4222a3159b212ba3e49d88b7a14e4c5f4ecda69 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Fri, 24 Jan 2020 11:39:42 +0100 Subject: [PATCH] Fixed regression resulting in auto-type never timing out. --- MacPass/MPAutotypeDaemon.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m index 771fcef3..f910d3cb 100644 --- a/MacPass/MPAutotypeDaemon.m +++ b/MacPass/MPAutotypeDaemon.m @@ -215,11 +215,12 @@ static MPAutotypeDaemon *_sharedInstance; [NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:notification]; NSNotificationCenter * __weak nc = [NSNotificationCenter defaultCenter]; MPAutotypeDaemon * __weak welf = self; + NSTimeInterval requestTime = NSDate.date.timeIntervalSinceReferenceDate; id __block unlockToken = [nc addObserverForName:MPDocumentDidUnlockDatabaseNotification object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *notification) { - [welf _runAutotypeAfterDatabaseUnlockWithEnvironment:env requestedAt:NSDate.date.timeIntervalSinceReferenceDate]; + [welf _runAutotypeAfterDatabaseUnlockWithEnvironment:env requestedAt:requestTime]; [nc removeObserver:unlockToken]; }]; return; // Unlock should trigger autotype @@ -242,11 +243,12 @@ static MPAutotypeDaemon *_sharedInstance; [wc showPasswordInputWithMessage:NSLocalizedString(@"AUTOTYPE_MESSAGE_UNLOCK_DATABASE", @"Message displayed to the user to unlock the database to perform global autotype")]; NSNotificationCenter * __weak nc = [NSNotificationCenter defaultCenter]; MPAutotypeDaemon * __weak welf = self; + NSTimeInterval requestTime = NSDate.date.timeIntervalSinceReferenceDate; id __block unlockToken = [nc addObserverForName:MPDocumentDidUnlockDatabaseNotification object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *notification) { - [welf _runAutotypeAfterDatabaseUnlockWithEnvironment:env requestedAt:NSDate.date.timeIntervalSinceReferenceDate]; + [welf _runAutotypeAfterDatabaseUnlockWithEnvironment:env requestedAt:requestTime]; [nc removeObserver:unlockToken]; }];