From eedc8045584963e610aeed1b21bbe0c42686a963 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Wed, 3 Nov 2021 00:26:30 +0100 Subject: [PATCH] Fixed hotkeys being unregistered when changing tabs. Fixes #883 --- MacPass/MPIntegrationPreferencesController.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/MacPass/MPIntegrationPreferencesController.m b/MacPass/MPIntegrationPreferencesController.m index 8f6bb026..f6e57bf1 100644 --- a/MacPass/MPIntegrationPreferencesController.m +++ b/MacPass/MPIntegrationPreferencesController.m @@ -82,9 +82,13 @@ } - (void)willShowTab { - _hotKey = [DDHotKey hotKeyWithKeyData:[NSUserDefaults.standardUserDefaults dataForKey:kMPSettingsKeyGlobalAutotypeKeyDataKey]]; - /* Change any invalid hotkeys to valid ones? */ - self.hotKeyTextField.hotKey = self.hotKey; + if(!_hotKey) { + _hotKey = [DDHotKey hotKeyWithKeyData:[NSUserDefaults.standardUserDefaults dataForKey:kMPSettingsKeyGlobalAutotypeKeyDataKey]]; + } + /* Only call the setter if the hotkeys are different, otherwise the dealloc call will unregister them*/ + if(![self.hotKeyTextField.hotKey isEqual:self.hotKey]) { + self.hotKeyTextField.hotKey = self.hotKey; + } } #pragma mark -