mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-12 02:45:49 +01:00
Lefun: Tweak notifications for empty message handling
This commit is contained in:
parent
c2375f95f4
commit
741fdbcbd2
@ -68,7 +68,7 @@ public abstract class AbstractSendNotificationRequest extends Request {
|
||||
int maxPayloadLength = NotificationCommand.MAX_PAYLOAD_LENGTH;
|
||||
if (reserveSpaceForExtended) maxPayloadLength -= 1;
|
||||
maxPayloadLength = Math.min(maxPayloadLength, buffer.limit() - buffer.position());
|
||||
if (maxPayloadLength == 0) break;
|
||||
if (maxPayloadLength == 0 && i != 0) break;
|
||||
|
||||
byte[] payload = new byte[maxPayloadLength];
|
||||
buffer.get(payload);
|
||||
|
@ -41,11 +41,11 @@ public class SendCallNotificationRequest extends AbstractSendNotificationRequest
|
||||
@Override
|
||||
protected String getMessage() {
|
||||
String message = "";
|
||||
if (callNotification.number != null) {
|
||||
if (callNotification.number != null &&!callNotification.number.isEmpty()) {
|
||||
message = callNotification.number;
|
||||
}
|
||||
|
||||
if (callNotification.name != null) {
|
||||
if (callNotification.name != null && !callNotification.name.isEmpty()) {
|
||||
if (message.length() > 0) {
|
||||
message += " - ";
|
||||
}
|
||||
|
@ -90,19 +90,19 @@ public class SendNotificationRequest extends AbstractSendNotificationRequest {
|
||||
// Based on nodomain.freeyourgadget.gadgetbridge.service.devices.id115.SendNotificationOperation
|
||||
String message = "";
|
||||
|
||||
if (notification.phoneNumber != null) {
|
||||
if (notification.phoneNumber != null && !notification.phoneNumber.isEmpty()) {
|
||||
message += notification.phoneNumber + ": ";
|
||||
}
|
||||
|
||||
if (notification.sender != null) {
|
||||
if (notification.sender != null && !notification.sender.isEmpty()) {
|
||||
message += notification.sender + " - ";
|
||||
} else if (notification.title != null) {
|
||||
} else if (notification.title != null && !notification.title.isEmpty()) {
|
||||
message += notification.title + " - ";
|
||||
} else if (notification.subject != null) {
|
||||
} else if (notification.subject != null && !notification.sender.isEmpty()) {
|
||||
message += notification.subject + " - ";
|
||||
}
|
||||
|
||||
if (notification.body != null) {
|
||||
if (notification.body != null && !notification.body.isEmpty()) {
|
||||
message += notification.body;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user