Garmin: use wearable reply for SMS

also use GBDeviceEventCallControl to reply with SMS in case of call refusal
This commit is contained in:
Daniele Gobbetti 2024-07-01 18:15:09 +02:00
parent 452ab461ab
commit f725317844

View File

@ -186,15 +186,14 @@ public class NotificationsHandler implements MessageHandler {
switch (message.getNotificationAction()) { switch (message.getNotificationAction()) {
case REPLY_INCOMING_CALL: case REPLY_INCOMING_CALL:
deviceEvtCallControl.event = GBDeviceEventCallControl.Event.REJECT; deviceEvtCallControl.event = GBDeviceEventCallControl.Event.REJECT;
deviceEvtCallControl.phoneNumber = notificationSpec.phoneNumber;
deviceEvtCallControl.reply = message.getActionString();
message.addGbDeviceEvent(deviceEvtCallControl); message.addGbDeviceEvent(deviceEvtCallControl);
break;
case REPLY_MESSAGES: case REPLY_MESSAGES:
deviceEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.REPLY; deviceEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.REPLY;
deviceEvtNotificationControl.reply = message.getActionString(); deviceEvtNotificationControl.reply = message.getActionString();
if (notificationSpec.type.equals(NotificationType.GENERIC_PHONE) || notificationSpec.type.equals(NotificationType.GENERIC_SMS)) {
deviceEvtNotificationControl.phoneNumber = notificationSpec.phoneNumber;
} else {
deviceEvtNotificationControl.handle = mNotificationReplyAction.lookup(notificationSpec.getId()); //handle of wearable action is needed deviceEvtNotificationControl.handle = mNotificationReplyAction.lookup(notificationSpec.getId()); //handle of wearable action is needed
}
message.addGbDeviceEvent(deviceEvtNotificationControl); message.addGbDeviceEvent(deviceEvtNotificationControl);
break; break;
case ACCEPT_INCOMING_CALL: case ACCEPT_INCOMING_CALL:
@ -319,9 +318,6 @@ public class NotificationsHandler implements MessageHandler {
toReturn = NOTIFICATION_DATE_FORMAT.format(new Date(notificationTimestamp)); toReturn = NOTIFICATION_DATE_FORMAT.format(new Date(notificationTimestamp));
break; break;
case TITLE: case TITLE:
if (NotificationType.GENERIC_SMS.equals(notificationSpec.type))
toReturn = notificationSpec.sender == null ? "" : notificationSpec.sender;
else
toReturn = notificationSpec.title == null ? "" : notificationSpec.title; toReturn = notificationSpec.title == null ? "" : notificationSpec.title;
break; break;
case SUBTITLE: case SUBTITLE: