mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Pebble: Pass booleans from Javascript Appmessage as such and convert to int16 later when sending to pebble
https://developer.pebble.com/guides/communication/using-pebblekit-js/#type-conversion
This commit is contained in:
parent
8353026c08
commit
c2af2dd15c
@ -221,9 +221,6 @@ public class ExternalPebbleJSActivity extends GBActivity {
|
||||
|
||||
if (passKey) {
|
||||
Object obj = in.get(inKey);
|
||||
if (obj instanceof Boolean) {
|
||||
obj = ((Boolean) obj) ? "true" : "false";
|
||||
}
|
||||
out.put(outKey, obj);
|
||||
} else {
|
||||
GB.toast("Discarded key " + inKey + ", not found in the local configuration and is not an integer key.", Toast.LENGTH_SHORT, GB.WARN);
|
||||
|
@ -87,6 +87,8 @@ public class PebbleSupport extends AbstractSerialDeviceSupport {
|
||||
byteArray[i] = ((Integer) jsonArray.get(i)).byteValue();
|
||||
}
|
||||
object = byteArray;
|
||||
} else if (object instanceof Boolean) {
|
||||
object = (short) (((Boolean) object) ? 1 : 0);
|
||||
}
|
||||
pairs.add(new Pair<>(Integer.parseInt(keyStr), object));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user