Bangle + Android : Reply to message

Posted on
  • One thing from the Pebble that I miss most, is the reply function. A simple 👍/👎/📵 would be enough until I have the time to eplain myself in detail.

    I've looked into the message app and found what the buttons do:
    _ Bangle.messageResponse(msg,true/false);

    Then I looked into the android/boot.js:
    ...return gbSend({ t: "notify", n:response?"OPEN":"DISMISS", id: msg.id });

    As I understand from there, Gadgetbridge could handle the reply.
    t:"notify", id:int, n:"DISMISS,DISMISS_ALL/OPEN/MUTE/REPLY",­ if REPLY can use tel:string(optional), msg:string

    Having only a very basic understanding of bluetooth, JS, the espruino,... I am really not comfortable, "messing" with the core android module.
    If I tried to code it, it would (mostly because of that limited experience/testing-hardware) likely only work for me (BanjgleJS2, msg.src=="Whatsapp", Gadgetbridge). So.. a lot of work and almost useless for the community. While my code usually "works", I it's still on the level of my first homepage in the 90s :)

    Are there any plans to implement the reply feature anytime soon? (Is there a roadmap?)
    I know, the cool thing with opensource is: If you don't like it, fork it and/or make a pull request. (But having my own, non-maintained copy would be my last option)
    Disclaimer: This is no complaint, no demand or really anything :)

  • Hi - there's not really a solid roadmap, but yes, the plan is eventually to add it - and you're right, it should work with Gadgetbridge and the change should be reasonably easy - however I don't believe it has been tested so it's not guaranteed.

    I think best bet is maybe you have a play - there's nothing really to lose. If you get it working, post up what you have and even if we don't merge it as-is we probably can with minimal changes... Definitely having some code pushes things up the priority list.

    I'd be interested to hear what you imagine the UI for it would look like though - there are others on here wanting to remove the extra buttons and use swipes - so how would you see it working?

  • Can't login with my other account (error), so replying with google login...

    I modified my personal version of the message app to directly jump to the scroller and unlock the screen. For now, I added some lines for my fat fingers :)

        lines.push("______________");
        lines.push("");
        lines.push("back");
        lines.push("______________");
        lines.push("");
        lines.push("mark read");
        lines.push("______________");
        lines.push("");
        lines.push("dismiss");
        lines.push("______________");
    

    In the long run, I would jump to the scroller, then swipe left/right would open a menu (back/read/dismiss/cannedRepliesSubmenu)­, while button brings back to the clock.
    I don't really need the preview. I will try and open a PR for the android/boot.js part, because I think that's very agreeable and I can't mess it up too much. :)

  • Update: I tried, but failed:

    I added some code to the android.boot.js: (No pull request, because it obviously doesn't work)

        function gbSend(message) {
            Bluetooth.println("");
            Bluetooth.println(JSON.stringify(message­));
            return message.n
        }
        Bangle.messageResponse = (msg, response) => {
            if (typeof response == "boolean") {
                if (msg.id == "call") return gbSend({ t: "call", n: response ? "ACCEPT" : "REJECT" });
                if (isFinite(msg.id)) return gbSend({ t: "notify", n: response ? "OPEN" : "DISMISS", id: msg.id });
            }
                if (isFinite(msg.id)) return gbSend({ t: "notify", n: "REPLY", msg: response, id: msg.id });
            } else return false;
        };
    

    (If response is a string -> send it as REPLY. I also added return (ACCEPT/REJECT/OPEN/DISMISS/REPLY, so that whatever triggers Bangle.messageResponse() gets feedback if the response was understood)

    When I respond "OK", I am getting this in my gadgetbridge.log:

    ...
    09:45:09.002 [Binder:4929_1] INFO  n.f.g.s.d.b.BangleJSDeviceSupport - UART RX LINE: {"t":"notify","n":"REPLY","msg":"OK","id­":1646979166}
    09:45:09.002 [Binder:4929_1] INFO  n.f.g.s.AbstractDeviceSupport - Got NOTIFICATION CONTROL device event
    09:45:09.002 [Binder:4929_1] INFO  n.f.g.s.AbstractDeviceSupport - Got notification reply for notification id 1646979166 : OK
    

    looks very promising, but DOES NOT send a reply to the whatsapp contact.

  • Thanks! That's a shame - so it looks like there's something up with the Gadgetbridge implementation?

  • At least that would be my guess. I'll try to reacitvate my pebble this weekend and see if there are any differences, now that I know how to look for a log :)

  • https://pastebin.com/raw/RhcpmXP9

    I dont know why the pebble stuff is handled by "Thread-6" while bangle by "Binder:20250_A"...
    That's the only difference in the log I think COULD be important.

  • Found another difference: There is a totally "strange" ID in the Pebble-log:

    Pebble:
    INFO n.f.g.e.NotificationListener - Processing notification 1647026941 age: 1311 from source com.whatsapp with flags: 8
    INFO n.f.g.s.AbstractDeviceSupport - Got notification reply for notification id 26352431058 : Call you later
    INFO n.f.g.e.NotificationListener - Notification 1647026941 removed, will ask device to delete it

    Bangle:
    INFO n.f.g.e.NotificationListener - Processing notification 1647026945 age: 1351 from source com.whatsapp with flags: 8
    INFO n.f.g.s.AbstractDeviceSupport - Got notification reply for notification id 1647026945 : OK

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bangle + Android : Reply to message

Posted by Avatar for Micha_home @Micha_home

Actions