From 907ebd34f54179626db20b1da1cb2570838cc5b4 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Mon, 26 Feb 2024 21:51:54 +0100 Subject: [PATCH] messagegui: swipe up/down on msg goes to newer/older msg messagegui: small refactor of swipeHandler `if (ud!=0)` -> `if (ud>0) ... if (ud<0)` --- apps/messagegui/ChangeLog | 4 +++- apps/messagegui/README.md | 1 + apps/messagegui/app.js | 7 +++++-- apps/messagegui/metadata.json | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/messagegui/ChangeLog b/apps/messagegui/ChangeLog index ea6b0fe43..cbf38af45 100644 --- a/apps/messagegui/ChangeLog +++ b/apps/messagegui/ChangeLog @@ -101,4 +101,6 @@ 0.72: Nav message updastes don't automatically launch navigation menu unless they're new 0.73: Add sharp left+right nav icons 0.74: Add option for driving on left (affects roundabout icons in navigation) -0.75: Handle text with images in messages list by just displaying the first line \ No newline at end of file +0.75: Handle text with images in messages list by just displaying the first line +0.76: Swipe up/down on a shown message to show the next newer/older message. + diff --git a/apps/messagegui/README.md b/apps/messagegui/README.md index 699588e1b..801ebfb2a 100644 --- a/apps/messagegui/README.md +++ b/apps/messagegui/README.md @@ -38,6 +38,7 @@ When a message is shown, you'll see a screen showing the message title and text. * The 'back-arrow' button (or physical button on Bangle.js 2) goes back to Messages, marking the current message as read. * The top-left icon shows more options, for instance deleting the message of marking unread * On Bangle.js 2 you can tap on the message body to view a scrollable version of the title and text (or can use the top-left icon + `View Message`) +- On Bangle.js 2 swipe up/down to show newer/older message * If shown, the 'tick' button: * **Android** opens the notification on the phone * **iOS** responds positively to the notification (accept call/etc) diff --git a/apps/messagegui/app.js b/apps/messagegui/app.js index 5596510c5..330c9677f 100644 --- a/apps/messagegui/app.js +++ b/apps/messagegui/app.js @@ -289,7 +289,8 @@ function showMessageSettings(msg) { } function showMessage(msgid) { - var msg = MESSAGES.find(m=>m.id==msgid); + let idx = MESSAGES.findIndex(m=>m.id==msgid); + var msg = MESSAGES[idx]; if (updateLabelsInterval) { clearInterval(updateLabelsInterval); updateLabelsInterval=undefined; @@ -389,9 +390,11 @@ function showMessage(msgid) { {type:"h",fillx:1, c: footer} ]},{back:goBack}); - Bangle.swipeHandler = lr => { + Bangle.swipeHandler = (lr,ud) => { if (lr>0 && posHandler) posHandler(); if (lr<0 && negHandler) negHandler(); + if (ud>0 && idx0) showMessage(MESSAGES[idx-1].id); }; Bangle.on("swipe", Bangle.swipeHandler); g.reset().clearRect(Bangle.appRect); diff --git a/apps/messagegui/metadata.json b/apps/messagegui/metadata.json index 6f2cb5d2e..1bf9b84d9 100644 --- a/apps/messagegui/metadata.json +++ b/apps/messagegui/metadata.json @@ -2,7 +2,7 @@ "id": "messagegui", "name": "Message UI", "shortName": "Messages", - "version": "0.75", + "version": "0.76", "description": "Default app to display notifications from iOS and Gadgetbridge/Android", "icon": "app.png", "type": "app",