Skip to content

Commit ceaed89

Browse files
committed
WIP
1 parent f73e270 commit ceaed89

File tree

1 file changed

+24
-39
lines changed

1 file changed

+24
-39
lines changed

Diff for: Terminal Notifier/AppDelegate.m

+24-39
Original file line numberDiff line numberDiff line change
@@ -305,37 +305,32 @@ - (void)deliverNotificationWithTitle:(NSString *)title
305305
// content image
306306
userNotification.contentImage = [self getImageFromURL:options[@"contentImage"]];
307307
}
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"];
326323
}
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"];
329328
}
330-
}else if (options[@"reply"]) {
331-
[userNotification setValue:@YES forKey:@"_showsButtons"];
332-
userNotification.hasReplyButton = 1;
333-
userNotification.responsePlaceholder = options[@"reply"];
334-
}
335329

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+
}
339334
}
340335

341336
if (sound != nil) {
@@ -431,6 +426,7 @@ - (void)userNotificationCenter:(NSUserNotificationCenter *)center
431426
}
432427
if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f];
433428
} while (notificationStillPresent);
429+
434430
dispatch_async(dispatch_get_main_queue(), ^{
435431
NSDictionary *udict = @{@"activationType" : @"closed", @"activationValue" : userNotification.otherButtonTitle};
436432
[self Quit:udict notification:userNotification];
@@ -593,15 +589,4 @@ - (void)listNotificationWithGroupID:(NSString *)listGroupID;
593589
}
594590
}
595591

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

0 commit comments

Comments
 (0)