AsteroidOS: fix missing sender notification attribute

AsteroidOS generally uses the 'summary' field for the notification's sender - this commit should make gadgetbridge behave more consistently with AsteroidOSSync
This fix was suggested by Jose Rebelo
This commit is contained in:
dodoradio 2025-01-13 13:06:35 +00:00 committed by José Rebelo
parent a68d3215a8
commit 60c91af5bb

View File

@ -26,6 +26,8 @@ import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationType;
import org.apache.commons.lang3.StringUtils;
/**
* An adapter for notifications on AsteroidOS
*/
@ -62,7 +64,7 @@ public class AsteroidOSNotification {
public AsteroidOSNotification(NotificationSpec spec) {
this.body = spec.body;
this.applicationName = spec.sourceName;
this.summary = spec.subject;
this.summary = StringUtils.firstNonBlank(spec.sender, spec.title, spec.subject);
this.id = spec.getId();
this.packageName = spec.sourceAppId;
this.icon = this.gbNotificationTypeToIcon(spec.type);