-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
messages: split library/gui/widget into separate apps
- Loading branch information
Showing
41 changed files
with
641 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
0.01: Base code | ||
0.02: Saved settings when switching color scheme | ||
0.03: Added Button 3 opening messages (if app is installed) | ||
0.04: Use `messages` library to check for new messages | ||
0.04: Use `messages` library to check for new messages | ||
0.05: Use `messages` library to open message GUI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// Config app not implemented yet | ||
setTimeout(()=>load("messages.app.js"),10); | ||
setTimeout(()=>require("messages").openGUI(),10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
0.01: New App! | ||
0.02: Add 'messages' library | ||
0.03: Fixes for Bangle.js 1 | ||
0.04: Add require("messages").clearAll() | ||
0.05: Handling of message actions (ok/clear) | ||
0.06: New messages now go at the start (fix #898) | ||
Answering true/false now exits the messages app if no new messages | ||
Back now marks a message as read | ||
Clicking top-left opens a menu which allows you to delete a message or mark unread | ||
0.07: Added settings menu with option to choose vibrate pattern and frequency (fix #909) | ||
0.08: Fix rendering of long messages (fix #969) | ||
buzz on new message (fix #999) | ||
0.09: Message now disappears after 60s if no action taken and clock loads (fix 922) | ||
Fix phone icon (#1014) | ||
0.10: Respect the 'new' attribute if it was set from iOS integrations | ||
0.11: Open app when touching the widget (Bangle.js 2 only) | ||
0.12: Extra app-specific notification icons | ||
New animated notification icon (instead of large blinking 'MESSAGES') | ||
Added screenshots | ||
0.13: Add /*LANG*/ comments for internationalisation | ||
Add 'Delete All' option to message options | ||
Now update correctly when 'require("messages").clearAll()' is called | ||
0.14: Hide widget when all unread notifications are dismissed from phone | ||
0.15: Don't buzz when Quiet Mode is active | ||
0.16: Fix text wrapping so it fits the screen even if title is big (fix #1147) | ||
0.17: Fix: Get dynamic dimensions of notify icon, fixed notification font | ||
0.18: Use app-specific icon colors | ||
Spread message action buttons out | ||
Back button now goes back to list of messages | ||
If showMessage called with no message (eg all messages deleted) now return to the clock (fix #1267) | ||
0.19: Use a larger font for message text if it'll fit | ||
0.20: Allow tapping on the body to show a scrollable view of the message and title in a bigger font (fix #1405, #1031) | ||
0.21: Improve list readability on dark theme | ||
0.22: Add Home Assistant icon | ||
Allow repeat to be switched Off, so there is no buzzing repetition. | ||
Also gave the widget a pixel more room to the right | ||
0.23: Change message colors to match current theme instead of using green | ||
Now attempt to use Large/Big/Medium fonts, and allow minimum font size to be configured | ||
0.24: Remove left-over debug statement | ||
0.25: Fix widget memory usage issues if message received and watch repeatedly calls Bangle.drawWidgets (fix #1550) | ||
0.26: Setting to auto-open music | ||
0.27: Add 'mark all read' option to popup menu (fix #1624) | ||
0.28: Option to auto-unlock the watch when a new message arrives | ||
0.29: Fix message list overwrites on Bangle.js 1 (fix #1642) | ||
0.30: Add new Icons (Youtube, Twitch, MS TODO, Teams, Snapchat, Signal, Post & DHL, Nina, Lieferando, Kalender, Discord, Corona Warn, Bibel) | ||
0.31: Option to disable icon flashing | ||
0.32: Added an option to allow quiet mode to override message auto-open | ||
0.33: Timeout from the message list screen if the message being displayed is removed and there is a timer going | ||
0.34: Don't buzz for 'map' update messages | ||
0.35: Reset graphics colors before rendering a message (possibly fix #1752) | ||
0.36: Ensure a new message plus an almost immediate deletion of that message doesn't load the messages app (fix #1362) | ||
0.37: Now use the setUI 'back' icon in the top left rather than specific buttons/menu items | ||
0.38: Add telegram foss handling | ||
0.39: Set default color for message icons according to theme | ||
0.40: Use default Bangle formatter for booleans | ||
0.41: Add notification icons in the widget | ||
0.42: Fix messages ignoring "Vibrate: Off" setting | ||
0.43: Add new Icons (Airbnb, warnwetter) | ||
0.44: Separate buzz pattern for incoming calls | ||
0.45: Added new app colors and icons | ||
0.46: Add 'Vibrate Timer' option to set how long to vibrate for, and fix Repeat:off | ||
Fix message removal from widget bar (previously caused exception as .hide has been removed) | ||
0.47: Add new Icons (Nextbike, Mattermost, etc.) | ||
0.48: When getting new message from the clock, only buzz once the messages app is loaded | ||
0.49: Change messages icon (to fit within 24px) and ensure widget renders icons centrally | ||
0.50: Add `getMessages` and `status` functions to library | ||
Option to disable auto-open of messages | ||
Option to make message icons monochrome (not colored) | ||
messages widget buzz now returns a promise | ||
0.51: Emit "message events" | ||
Setting to hide widget | ||
Add custom event handlers to prevent default app form loading | ||
Move WIDGETS.messages.buzz() to require("messages").buzz() | ||
0.52: Fix require("messages").buzz() regression | ||
Fix background color in messages list after one unread message is shown | ||
0.53: Messages now uses Bangle.load() to load messages app faster (if possible) | ||
0.54: Move icons out to messageicons module | ||
0.55: Rename to messagegui, move global message handling library to message module | ||
Move widget to widmessage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Messages app | ||
|
||
Default app to handle the display of messages and message notifications. It allows | ||
them to be listed, viewed, and responded to. | ||
It is installed automatically if you install `Android Integration` or `iOS Integration`. | ||
|
||
It is a replacement for the old `notify`/`gadgetbridge` apps. | ||
|
||
|
||
## Settings | ||
|
||
You can change settings by going to the global `Settings` app, then `App Settings` | ||
and `Messages`: | ||
|
||
* `Vibrate` - This is the pattern of buzzes that should be made when a new message is received | ||
* `Vibrate for calls` - This is the pattern of buzzes that should be made when an incoming call is received | ||
* `Repeat` - How often should buzzes repeat - the default of 4 means the Bangle will buzz every 4 seconds | ||
* `Vibrate Timer` - When a new message is received when in a non-clock app, we display the message icon and | ||
buzz every `Repeat` seconds. This is how long we continue to do that. | ||
* `Unread Timer` - When a new message is received when showing the clock we go into the Messages app. | ||
If there is no user input for this amount of time then the app will exit and return | ||
to the clock where a ringing bell will be shown in the Widget bar. | ||
* `Min Font` - The minimum font size used when displaying messages on the screen. A bigger font | ||
is chosen if there isn't much message text, but this specifies the smallest the font should get before | ||
it starts getting clipped. | ||
* `Auto-Open Music` - Should the app automatically open when the phone starts playing music? | ||
* `Unlock Watch` - Should the app unlock the watch when a new message arrives, so you can touch the buttons at the bottom of the app? | ||
|
||
## New Messages | ||
|
||
When a new message is received: | ||
|
||
* If you're in an app, the Bangle will buzz and a message icon appears in the Widget bar. You can tap this icon to view the message. | ||
* If you're in a clock, the Messages app will automatically start and show the message | ||
|
||
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`) | ||
* If shown, the 'tick' button: | ||
* **Android** opens the notification on the phone | ||
* **iOS** responds positively to the notification (accept call/etc) | ||
* If shown, the 'cross' button: | ||
* **Android** dismisses the notification on the phone | ||
* **iOS** responds negatively to the notification (dismiss call/etc) | ||
|
||
## Images | ||
_1. Screenshot of a notification_ | ||
|
||
![](screenshot.png) | ||
|
||
|
||
## Requests | ||
|
||
Please file any issues on https://github.com/espruino/BangleApps/issues/new?title=messages%20app | ||
|
||
## Creator | ||
|
||
Gordon Williams | ||
|
||
## Contributors | ||
|
||
[Jeroen Peters](https://github.com/jeroenpeters1986) | ||
|
||
## Attributions | ||
|
||
Icons used in this app are from https://icons8.com |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
apps/messages/app-newmessage.js → apps/messagegui/app-newmessage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* Called when we have a new message when we're in the clock... | ||
BUZZ_ON_NEW_MESSAGE is set so when messages.app.js loads it knows | ||
BUZZ_ON_NEW_MESSAGE is set so when messagegui.app.js loads it knows | ||
that it should buzz */ | ||
global.BUZZ_ON_NEW_MESSAGE = true; | ||
eval(require("Storage").read("messages.app.js")); | ||
eval(require("Storage").read("messagegui.app.js")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(function() { | ||
Bangle.on("message", (type, msg) => require("messagegui").listener(type, msg)); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Listener set up in boot.js, calls into here to keep boot.js short | ||
*/ | ||
exports.listener = function(type, msg) { | ||
// Default handler: Launch the GUI for all unhandled messages (except music if disabled in settings) | ||
if (msg.handled || (global.__FILE__ && __FILE__.startsWith('messagegui.'))) return; // already handled or app open | ||
|
||
// if no new messages now, make sure we don't load the messages app | ||
if (exports.messageTimeout && !msg.new && require("messages").status(msg) !== "new") { | ||
clearTimeout(exports.messageTimeout); | ||
delete exports.messageTimeout; | ||
} | ||
if (msg.t==="remove") return; | ||
|
||
const appSettings = require("Storage").readJSON("messages.settings.json", 1) || {}; | ||
let loadMessages = (Bangle.CLOCK || event.important); | ||
if (type==="music") { | ||
if (Bangle.CLOCK && msg.new && appSettings.openMusic) loadMessages = true; | ||
else return; | ||
} | ||
require("messages").save(msg); | ||
msg.handled = true; | ||
if (msg.t!=="add" || !msg.new) { | ||
return; | ||
} | ||
|
||
const quiet = (require("Storage").readJSON("setting.json", 1) || {}).quiet; | ||
const unlockWatch = appSettings.unlockWatch; | ||
// don't auto-open messages in quiet mode if quietNoAutOpn is true | ||
if ((quiet && appSettings.quietNoAutOpn) || appSettings.noAutOpn) | ||
loadMessages = false; | ||
|
||
// after a delay load the app, to ensure we have all the messages | ||
if (exports.messageTimeout) clearTimeout(exports.messageTimeout); | ||
exports.messageTimeout = setTimeout(function() { | ||
delete exports.messageTimeout; | ||
if (type!=="music") { | ||
if (!loadMessages) return require("messages").buzz(msg.src); // no opening the app, just buzz | ||
if (!quiet && unlockWatch) { | ||
Bangle.setLocked(false); | ||
Bangle.setLCDPower(1); // turn screen on | ||
} | ||
} | ||
exports.open(msg); | ||
}, 500); | ||
}; | ||
|
||
/** | ||
* Launch GUI app with given message | ||
* @param {object} msg | ||
*/ | ||
exports.open = function(msg) { | ||
if (msg && msg.id && !msg.show) { | ||
// store which message to load | ||
msg.show = 1; | ||
require("messages").save(msg, {force: 1}); | ||
} | ||
|
||
Bangle.load((msg && msg.new && msg.id!=="music") ? "messagegui.new.js" : "messagegui.app.js"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"id": "messagegui", | ||
"name": "Messages", | ||
"version": "0.55", | ||
"description": "Default app to display notifications from iOS and Gadgetbridge/Android", | ||
"icon": "app.png", | ||
"type": "app", | ||
"tags": "tool,system", | ||
"supports": ["BANGLEJS","BANGLEJS2"], | ||
"dependencies" : { "messageicons":"module" }, | ||
"provides_modules": ["messagegui"], | ||
"readme": "README.md", | ||
"storage": [ | ||
{"name":"messagegui","url":"lib.js"}, | ||
{"name":"messagegui.app.js","url":"app.js"}, | ||
{"name":"messagegui.new.js","url":"app-newmessage.js"}, | ||
{"name":"messagegui.boot.js","url":"boot.js"}, | ||
{"name":"messagegui.img","url":"app-icon.js","evaluate":true} | ||
], | ||
"screenshots": [{"url":"screenshot.png"}], | ||
"sortorder": -9 | ||
} |
File renamed without changes
Oops, something went wrong.