Compare id from user info

Signed-off-by: Max Risuhin <risuhin.max@gmail.com>
This commit is contained in:
Max Risuhin 2018-10-14 21:14:02 +03:00
parent a0a62a7f14
commit 8656195205
No known key found for this signature in database
GPG Key ID: BF733F5ACA0B4448

View File

@ -89,7 +89,8 @@ BOOL installNSBundleHook()
while(notificationAvailable) { while(notificationAvailable) {
notificationAvailable = NO; notificationAvailable = NO;
for(NSUserNotification *osxNotification in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) { for(NSUserNotification *osxNotification in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) {
if([osxNotification.identifier isEqualToString:notification.identifier]) { int fetchedNotificationID = [osxNotification.userInfo[@"id"] intValue];
if(fetchedNotificationID == notificationId) {
notificationAvailable = YES; notificationAvailable = YES;
[NSThread sleepForTimeInterval:0.25f]; [NSThread sleepForTimeInterval:0.25f];
break; break;
@ -155,7 +156,7 @@ void OSXNotificationCenter::slotNotify(Snore::Notification notification)
osxNotification.title = notification.title().toNSString(); osxNotification.title = notification.title().toNSString();
osxNotification.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:notificationId, @"id", nil]; osxNotification.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:notificationId, @"id", nil];
osxNotification.informativeText = notification.text().toNSString(); osxNotification.informativeText = notification.text().toNSString();
osxNotification.identifier = notificationId; //osxNotification.identifier = notificationId;
// Add notification to mapper from id to Nofification / NSUserNotification // Add notification to mapper from id to Nofification / NSUserNotification
m_IdToNotification.insert(notification.id(), notification); m_IdToNotification.insert(notification.id(), notification);