1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-17 19:04:03 +02:00

Fossil HR: In notifications display sender, and if not available, notification title (like other devices do too)

This commit is contained in:
Andreas Shimokawa 2020-01-29 20:43:40 +01:00
parent 9cd4ee0f29
commit 3722a9b432

View File

@ -59,6 +59,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fos
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.widget.Widget;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.widget.WidgetsPutRequest;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_PHONE_REQUEST;
import static nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.music.MusicControlRequest.MUSIC_WATCH_REQUEST;
@ -446,16 +447,16 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
}
public boolean playRawNotification(NotificationSpec notificationSpec) {
String sender = notificationSpec.sender;
if (sender == null) sender = notificationSpec.sourceName;
String senderOrTitle = StringUtils.getFirstOf(notificationSpec.sender, notificationSpec.title);
try {
for (NotificationHRConfiguration configuration : this.notificationConfigurations){
if(configuration.getPackageName().equals(notificationSpec.sourceAppId)){
queueWrite(new PlayNotificationRequest(notificationSpec.sourceAppId, notificationSpec.sender, notificationSpec.body, this));
queueWrite(new PlayNotificationRequest(notificationSpec.sourceAppId, senderOrTitle, notificationSpec.body, this));
return true;
}
}
queueWrite(new PlayNotificationRequest("generic", notificationSpec.sender, notificationSpec.body, this));
queueWrite(new PlayNotificationRequest("generic", senderOrTitle, notificationSpec.body, this));
}catch (Exception e){
e.printStackTrace();
}