@@ -305,37 +305,32 @@ - (void)deliverNotificationWithTitle:(NSString *)title
305
305
// content image
306
306
userNotification.contentImage = [self getImageFromURL: options[@" contentImage" ]];
307
307
}
308
- }
309
-
310
- if (sound != nil ) {
311
- userNotification.soundName = [sound isEqualToString: @" default" ] ? NSUserNotificationDefaultSoundName : sound;
312
- }
313
-
314
- // Actions
315
- if (options[@" actions" ]){
316
- [userNotification setValue: @YES forKey: @" _showsButtons" ];
317
- NSArray *myActions = [options[@" actions" ] componentsSeparatedByString: @" ," ];
318
- if (myActions.count > 1 ) {
319
- [userNotification setValue: @YES forKey: @" _alwaysShowAlternateActionMenu" ];
320
- [userNotification setValue: myActions forKey: @" _alternateActionButtonTitles" ];
321
-
322
- // Main Actions Title
323
- if (options[@" dropdownLabel" ]){
324
- userNotification.actionButtonTitle = options[@" dropdownLabel" ];
325
- userNotification.hasActionButton = true ;
308
+ // Actions
309
+ if (options[@" actions" ]){
310
+ [userNotification setValue: @YES forKey: @" _showsButtons" ];
311
+ NSArray *myActions = [options[@" actions" ] componentsSeparatedByString: @" ," ];
312
+ if (myActions.count > 1 ) {
313
+ [userNotification setValue: @YES forKey: @" _alwaysShowAlternateActionMenu" ];
314
+ [userNotification setValue: myActions forKey: @" _alternateActionButtonTitles" ];
315
+
316
+ // Main Actions Title
317
+ if (options[@" dropdownLabel" ]){
318
+ userNotification.actionButtonTitle = options[@" dropdownLabel" ];
319
+ userNotification.hasActionButton = true ;
320
+ }
321
+ }else {
322
+ userNotification.actionButtonTitle = options[@" actions" ];
326
323
}
327
- }else {
328
- userNotification.actionButtonTitle = options[@" actions" ];
324
+ }else if (options[@" reply" ]) {
325
+ [userNotification setValue: @YES forKey: @" _showsButtons" ];
326
+ userNotification.hasReplyButton = 1 ;
327
+ userNotification.responsePlaceholder = options[@" reply" ];
329
328
}
330
- }else if (options[@" reply" ]) {
331
- [userNotification setValue: @YES forKey: @" _showsButtons" ];
332
- userNotification.hasReplyButton = 1 ;
333
- userNotification.responsePlaceholder = options[@" reply" ];
334
- }
335
329
336
- // Close button
337
- if (options[@" closeLabel" ]){
338
- userNotification.otherButtonTitle = options[@" closeLabel" ];
330
+ // Close button
331
+ if (options[@" closeLabel" ]){
332
+ userNotification.otherButtonTitle = options[@" closeLabel" ];
333
+ }
339
334
}
340
335
341
336
if (sound != nil ) {
@@ -431,6 +426,7 @@ - (void)userNotificationCenter:(NSUserNotificationCenter *)center
431
426
}
432
427
if (notificationStillPresent) [NSThread sleepForTimeInterval: 0 .20f ];
433
428
} while (notificationStillPresent);
429
+
434
430
dispatch_async (dispatch_get_main_queue (), ^{
435
431
NSDictionary *udict = @{@" activationType" : @" closed" , @" activationValue" : userNotification.otherButtonTitle };
436
432
[self Quit: udict notification: userNotification];
@@ -593,15 +589,4 @@ - (void)listNotificationWithGroupID:(NSString *)listGroupID;
593
589
}
594
590
}
595
591
596
- - (void ) bye ; {
597
- // Look for the notification sent, remove it when found
598
- NSString *UUID = currentNotification.userInfo [@" uuid" ];
599
- for (NSUserNotification *nox in [[NSUserNotificationCenter defaultUserNotificationCenter ] deliveredNotifications ]) {
600
- if ([nox.userInfo[@" uuid" ] isEqualToString: UUID ]){
601
- [[NSUserNotificationCenter defaultUserNotificationCenter ] removeDeliveredNotification: nox];
602
- [[NSUserNotificationCenter defaultUserNotificationCenter ] removeDeliveredNotification: nox];
603
- }
604
- }
605
- }
606
-
607
592
@end
0 commit comments