mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Pebble: Display a failure if we cannot map a notification id back to a Phone number when replying to an SMS
This commit is contained in:
parent
890016d652
commit
d358ed81d2
@ -18,6 +18,7 @@ import java.util.Random;
|
||||
import java.util.SimpleTimeZone;
|
||||
import java.util.UUID;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventAppInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventAppManagement;
|
||||
@ -1579,6 +1580,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
icon_id = PebbleIconID.RESULT_MUTE;
|
||||
break;
|
||||
case 0x05:
|
||||
boolean failed = true;
|
||||
byte attribute_count = buf.get();
|
||||
if (attribute_count > 0) {
|
||||
byte attribute = buf.get();
|
||||
@ -1587,16 +1589,18 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
if (length > 64) length = 64;
|
||||
byte[] reply = new byte[length];
|
||||
buf.get(reply);
|
||||
devEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.REPLY;
|
||||
devEvtNotificationControl.reply = new String(reply);
|
||||
caption = "SENT";
|
||||
icon_id = PebbleIconID.RESULT_SENT;
|
||||
} else {
|
||||
devEvtNotificationControl = null; // error
|
||||
caption = "FAILED";
|
||||
icon_id = PebbleIconID.RESULT_FAILED;
|
||||
// FIXME: this does not belong here, but we want at least check if there is no chance at all to send out the SMS later before we report success
|
||||
String phoneNumber = GBApplication.getIDSenderLookup().lookup(id);
|
||||
if (phoneNumber != null) {
|
||||
devEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.REPLY;
|
||||
devEvtNotificationControl.reply = new String(reply);
|
||||
caption = "SENT";
|
||||
icon_id = PebbleIconID.RESULT_SENT;
|
||||
failed = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (failed) {
|
||||
caption = "FAILED";
|
||||
icon_id = PebbleIconID.RESULT_FAILED;
|
||||
devEvtNotificationControl = null; // error
|
||||
|
Loading…
Reference in New Issue
Block a user