Always show autotype notifications. Fixes #814

This commit is contained in:
Michael Starke
2018-07-12 22:55:22 +02:00
parent 1f7fb693a9
commit 1f2b0447e2
3 changed files with 17 additions and 3 deletions

View File

@@ -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;

View File

@@ -8,6 +8,9 @@
#import <Foundation/Foundation.h>
FOUNDATION_EXTERN NSString *const kMPUserNotificationInfoKeyNotificationType;
FOUNDATION_EXTERN NSString *const kMPUserNotificationTypeAutotype;
@interface MPUserNotificationCenterDelegate : NSObject <NSUserNotificationCenterDelegate>
@end

View File

@@ -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