From 1f2b0447e20d613d6318245cd657c64cdcaddb44 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Thu, 12 Jul 2018 22:55:22 +0200 Subject: [PATCH] Always show autotype notifications. Fixes #814 --- MacPass/MPAutotypeDaemon.m | 4 +--- MacPass/MPUserNotificationCenterDelegate.h | 3 +++ MacPass/MPUserNotificationCenterDelegate.m | 13 +++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m index 622f8d65..5bab9e6b 100644 --- a/MacPass/MPAutotypeDaemon.m +++ b/MacPass/MPAutotypeDaemon.m @@ -28,6 +28,7 @@ #import "MPPasteBoardController.h" #import "MPSettingsHelper.h" #import "MPAutotypeCandidateSelectionViewController.h" +#import "MPUserNotificationCenterDelegate.h" #import "NSApplication+MPAdditions.h" #import "NSUserNotification+MPAdditions.h" @@ -41,9 +42,6 @@ NSString *const kMPWindowTitleKey = @"kMPWindowTitleKey"; NSString *const kMPProcessIdentifierKey = @"kMPProcessIdentifierKey"; -NSString *const kMPUserNotificationInfoKeyNotificationType = @"kMPUserNotificationInfoKeyNotificationType"; -NSString *const kMPUserNotificationTypeAutotype = @"kMPUserNotificationTypeAutotype"; - @interface MPAutotypeDaemon () @property (nonatomic, assign) BOOL enabled; diff --git a/MacPass/MPUserNotificationCenterDelegate.h b/MacPass/MPUserNotificationCenterDelegate.h index b2690559..88799324 100644 --- a/MacPass/MPUserNotificationCenterDelegate.h +++ b/MacPass/MPUserNotificationCenterDelegate.h @@ -8,6 +8,9 @@ #import +FOUNDATION_EXTERN NSString *const kMPUserNotificationInfoKeyNotificationType; +FOUNDATION_EXTERN NSString *const kMPUserNotificationTypeAutotype; + @interface MPUserNotificationCenterDelegate : NSObject @end diff --git a/MacPass/MPUserNotificationCenterDelegate.m b/MacPass/MPUserNotificationCenterDelegate.m index 754d590e..af694e4e 100644 --- a/MacPass/MPUserNotificationCenterDelegate.m +++ b/MacPass/MPUserNotificationCenterDelegate.m @@ -8,6 +8,9 @@ #import "MPUserNotificationCenterDelegate.h" +NSString *const kMPUserNotificationInfoKeyNotificationType = @"kMPUserNotificationInfoKeyNotificationType"; +NSString *const kMPUserNotificationTypeAutotype = @"kMPUserNotificationTypeAutotype"; + @implementation MPUserNotificationCenterDelegate - (instancetype)init { @@ -22,4 +25,14 @@ NSLog(@"%@", notification); } +- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification { + NSDictionary *userInfo = notification.userInfo; + if(!userInfo) { + return NO; + } + NSString *value = userInfo[kMPUserNotificationInfoKeyNotificationType]; + return [value isEqualToString:kMPUserNotificationTypeAutotype]; +} + + @end