File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1616 default, if locked, always)
17170.69: Remove .music field (which is not used - require("messages").getMessages().find(m=>m.id=="music") works fine)
1818 Ensure .getMessages uses Bangle.MESSAGES to return the most up to date message info
19+ 0.70: Fix message app not showing latest music messages
Original file line number Diff line number Diff line change @@ -152,6 +152,9 @@ exports.clearAll = function() {
152152 * that aren't yet written) apply them to the messages we read so we get
153153 * up to date info.
154154 *
155+ * If were in the messages app and it's defined `MESSAGES` then we just use that
156+ * as it contains all the messages that are already loaded.
157+ *
155158 * Optionally pass in a message to apply to the list, this is for event handlers:
156159 * By passing the message from the event, you can make sure the list is up-to-date,
157160 * even if the message has not been saved (yet)
@@ -165,7 +168,11 @@ exports.clearAll = function() {
165168 * @returns {array } All messages
166169 */
167170exports . getMessages = function ( withMessage ) {
168- let messages = require ( "Storage" ) . readJSON ( "messages.json" , true ) ;
171+ let messages ;
172+ if ( global . MESSAGES !== undefined )
173+ messages = global . MESSAGES . slice ( ) ; // we're in the messages app, just use the messages list that it's keeping (clone the array)
174+ else
175+ messages = require ( "Storage" ) . readJSON ( "messages.json" , true ) ;
169176 messages = Array . isArray ( messages ) ? messages : [ ] ; // make sure we always return an array
170177 ( Bangle . MESSAGES || [ ] ) . forEach ( m => require ( "messages" ) . apply ( m , messages ) ) ; // apply any usaved messages
171178 if ( withMessage && withMessage . id ) exports . apply ( withMessage , messages ) ;
Original file line number Diff line number Diff line change 11{
22 "id" : " messages" ,
33 "name" : " Messages" ,
4- "version" : " 0.69 " ,
4+ "version" : " 0.70 " ,
55 "description" : " Library to handle, load and store message events received from Android/iOS" ,
66 "icon" : " app.png" ,
77 "type" : " module" ,
You can’t perform that action at this time.
0 commit comments