From 32b31a3ea85b2357bbdf03105b3a3ba7f517d7e6 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Thu, 15 Apr 2021 17:09:44 +0200 Subject: [PATCH] Only leave one autotype notification in the stacke to prevent polution. --- MacPass/MPUserNotificationCenterDelegate.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MacPass/MPUserNotificationCenterDelegate.m b/MacPass/MPUserNotificationCenterDelegate.m index be3de356..ed9e1d9e 100644 --- a/MacPass/MPUserNotificationCenterDelegate.m +++ b/MacPass/MPUserNotificationCenterDelegate.m @@ -39,6 +39,19 @@ NSString *const MPUserNotificationTypeRunAutotypeDoctor = @"MPUserNotificationTy return self; } +- (void)userNotificationCenter:(NSUserNotificationCenter *)center didDeliverNotification:(NSUserNotification *)notification { + /* we only clean autotype feedback. the rest piles up */ + if(![notification.identifier isEqualToString:MPUserNotificationTypeAutotypeFeedback]) { + return; + } + for(NSUserNotification *deliveredNotification in center.deliveredNotifications) { + if(deliveredNotification == notification) { + continue; + } + [center removeDeliveredNotification:deliveredNotification]; + } +} + - (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification { NSDictionary *userInfo = notification.userInfo; NSString *notificationType = userInfo[MPUserNotificationTypeKey];