added user info to notfication

This commit is contained in:
Michael Starke
2018-07-12 18:22:32 +02:00
parent 0c2d08208c
commit 274a58b789

View File

@@ -41,6 +41,9 @@
NSString *const kMPWindowTitleKey = @"kMPWindowTitleKey";
NSString *const kMPProcessIdentifierKey = @"kMPProcessIdentifierKey";
NSString *const kMPUserNotificationInfoKeyNotificationType = @"kMPUserNotificationInfoKeyNotificationType";
NSString *const kMPUserNotificationTypeAutotype = @"kMPUserNotificationTypeAutotype";
@interface MPAutotypeDaemon ()
@property (nonatomic, assign) BOOL enabled;
@@ -194,6 +197,7 @@ static MPAutotypeDaemon *_sharedInstance;
if(!entryOrNil) {
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = NSApp.applicationName;
notification.userInfo = @{ kMPUserNotificationInfoKeyNotificationType: kMPUserNotificationTypeAutotype };
if(context) {
notification.informativeText = [NSString stringWithFormat:NSLocalizedString(@"AUTOTYPE_OVERLAY_SINGLE_MATCH_FOR_%@", "Notification: Autotype found a single match for %@ (string placeholder)."), self.targetWindowTitle];
}
@@ -313,7 +317,7 @@ static MPAutotypeDaemon *_sharedInstance;
#pragma mark MPDocument Notifications
- (void)_didUnlockDatabase:(NSNotification *)notification {
/* Remove ourselves and call again to search matches */
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSNotificationCenter.defaultCenter removeObserver:self name:MPDocumentDidUnlockDatabaseNotification object:nil];
[self _performAutotypeForEntry:nil];
}