[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>
swiftingly
Christopher Snowhill 2022-06-18 18:20:12 -07:00
parent b01924e10e
commit 20904cf2c4
1 changed files with 8 additions and 6 deletions

View File

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