[Playback Notification] Prevent sending blank tags

Prevent the notification balloons from displaying empty hyphens or tags
if either album or artist is empty but not nil.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2022-06-18 18:20:12 -07:00
parent b01924e10e
commit 20904cf2c4

View file

@ -251,12 +251,14 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
notif.title = [pe title]; notif.title = [pe title];
NSString *subtitle; NSString *subtitle;
if([pe artist] && [pe album]) { NSString *artist = (pe.artist && [pe.artist length]) ? pe.artist : nil;
subtitle = [NSString stringWithFormat:@"%@ - %@", [pe artist], [pe album]]; NSString *album = (pe.album && [pe.album length]) ? pe.album : nil;
} else if([pe artist]) { if(artist && album) {
subtitle = [pe artist]; subtitle = [NSString stringWithFormat:@"%@ - %@", artist, album];
} else if([pe album]) { } else if(artist) {
subtitle = [pe album]; subtitle = artist;
} else if(album) {
subtitle = album;
} else { } else {
subtitle = @""; subtitle = @"";
} }