@@ -90,7 +90,7 @@ var onMessagesModified = function(type,msg) {
90
90
}
91
91
if ( msg && msg . id == "nav" && msg . t == "modify" && active != "map" )
92
92
return ; // don't show an updated nav message if we're just in the menu
93
- showMessage ( msg , "modified" ) ;
93
+ showMessageRouter ( msg , "modified" ) ;
94
94
} ;
95
95
Bangle . on ( "message" , onMessagesModified ) ;
96
96
@@ -99,7 +99,7 @@ function saveMessages() {
99
99
}
100
100
E . on ( "kill" , saveMessages ) ;
101
101
102
- function showMessage ( msg , calledFrom ) {
102
+ function showMessageRouter ( msg , calledFrom ) {
103
103
////var active; // active screen (undefined/"list"/"music"/"map"/"message"/"scroller"/"settings")
104
104
//if (active==undefined) { } else if (active=="list") ... //and so on.
105
105
@@ -117,6 +117,9 @@ function showMessage(msg, calledFrom) {
117
117
if ( calledFrom == "scrollerSelect" ) {
118
118
return showMessageOverview ( msg . id ) ;
119
119
}
120
+ if ( msg . id == "call" ) {
121
+ return showMessageOverview ( msg . id ) ;
122
+ }
120
123
//if (false) {showMessageSettings(msg);}
121
124
}
122
125
@@ -304,23 +307,23 @@ function showMessagesScroller(msg, persist, alreadyProcessed) {
304
307
var titleLines = [ ] ;
305
308
var messagesWrapped = [ ] ;
306
309
for ( let i = idxSpan . start ; i < idxSpan . stop ; i ++ ) {
307
- let MSG_ITER = MESSAGES [ i ] ;
308
- MSG_ITER . new = false ;
310
+ let msgIter = MESSAGES [ i ] ;
311
+ msgIter . new = false ;
309
312
310
- //if (/*MSG_ITER .id=="music" ||*/ MSG_ITER .source=="maps" || MSG_ITER .id =="call") {
313
+ //if (/*msgIter .id=="music" ||*/ msgIter .source=="maps" || msgIter .id =="call") {
311
314
// idxSpan.stop++
312
315
// if (idxSpan.stop>=MESSAGES.length) {break;}
313
316
// continue;
314
317
//}
315
318
316
319
var lines = [ ] ;
317
- const TITLE_STRING = MSG_ITER . title || MSG_ITER . sender || MSG_ITER . subject || MSG_ITER . src || /*LANG*/ "No Title" ;
320
+ const TITLE_STRING = msgIter . title || msgIter . sender || msgIter . subject || msgIter . src || /*LANG*/ "No Title" ;
318
321
lines = g . wrapString ( TITLE_STRING , APP_RECT . w - 10 ) ;
319
322
for ( let i = 0 ; i < lines . length ; i ++ ) {
320
323
titleLines . push ( i + ( messagesWrapped [ 0 ] ?messagesWrapped [ 0 ] . length :0 ) +
321
324
( messagesWrapped [ 1 ] ?messagesWrapped [ 1 ] . length :0 ) ) ;
322
325
}
323
- lines = lines . concat ( g . wrapString ( MSG_ITER . body , APP_RECT . w - 10 ) ,
326
+ lines = lines . concat ( g . wrapString ( msgIter . body , APP_RECT . w - 10 ) ,
324
327
[ "-" . repeat ( 12 ) ] ) ;
325
328
messagesWrapped . push ( lines ) ;
326
329
}
@@ -343,6 +346,7 @@ function showMessagesScroller(msg, persist, alreadyProcessed) {
343
346
map ( ( x ) => x + alreadyProcessed . lines . length ) ) ;
344
347
allLines = alreadyProcessed . lines . concat ( allLines ) ;
345
348
}
349
+ initScroll = initScroll * FONT_HEIGHT ;
346
350
347
351
if ( allLines . length == 0 && alreadyProcessed . lines . length == 0 ) {
348
352
cancelReloadTimeout ( ) ;
@@ -377,29 +381,28 @@ function showMessagesScroller(msg, persist, alreadyProcessed) {
377
381
let prevScrollIdxs = [ undefined , undefined ] ; // [prevIdx, prevPrevIdx]
378
382
379
383
function shouldAddNext ( scrollIdx ) { "ram" ; return ( scrollIdx >= allLines . length - 1 &&
380
- scrollIdx != prevScrollIdxs [ 0 ] && alreadyProcessed . idxSpan . stop < MESSAGES . length ) }
384
+ scrollIdx != prevScrollIdxs [ 0 ] && alreadyProcessed . idxSpan . stop < MESSAGES . length ) ; }
381
385
function shouldAddPrev ( scrollIdx ) { "ram" ; return ( scrollIdx == 0 &&
382
- scrollIdx != prevScrollIdxs [ 0 ] && alreadyProcessed . idxSpan . start > 0 ) }
386
+ scrollIdx != prevScrollIdxs [ 0 ] && alreadyProcessed . idxSpan . start > 0 ) ; }
383
387
function reinitAdding ( idx ) {
384
388
setTimeout ( ( ) => {
385
- Bangle . emit ( "drag" , { dy :0 } ) ; // Make sure scrolling doesn't continue after reinit.
389
+ Bangle . emit ( "drag" , { dy :0 } ) ; // Make sure scrolling doesn't continue after reinit. FIXME: Is this a hack that begs for a bug being fixed elsewhere?
386
390
// Zero ms timeout as to not move on before the scroller has registered the emitted drag event.
387
391
setTimeout ( ( ) => {
388
392
E . showScroller ( ) ;
389
393
if ( BTN_EXT_SELECT ) { clearWatch ( BTN_EXT_SELECT ) ; delete BTN_EXT_SELECT ; }
390
394
showMessagesScroller ( MESSAGES [ idx ] ,
391
395
true , alreadyProcessed ) ;
392
- } , 0 )
396
+ } , 0 ) ;
393
397
} , 40 ) ;
394
398
}
395
399
396
400
E . showScroller ( {
397
- scroll : initScroll * FONT_HEIGHT ,
401
+ scroll : initScroll ,
398
402
h : FONT_HEIGHT , // height of each menu item in pixels
399
403
c : allLines . length , // number of menu items
400
404
// a function to draw a menu item
401
- draw : function ( scrollIdx , r ) {
402
- "ram" ;
405
+ draw : function ( scrollIdx , r ) { "ram" ;
403
406
g . setBgColor ( titleLines . find ( e => e == scrollIdx ) !== undefined ? g . theme . bg2 : g . theme . bg ) .
404
407
setColor ( titleLines . find ( e => e == scrollIdx ) !== undefined ? g . theme . fg2 : g . theme . fg ) .
405
408
clearRect ( r ) ;
@@ -413,9 +416,9 @@ function showMessagesScroller(msg, persist, alreadyProcessed) {
413
416
select : function ( scrollIdx , touch ) {
414
417
WU . show ( ) ;
415
418
const MSG_SELECT = identifyDisplayedMsg ( scrollIdx ) ;
416
- if ( BTN_EXT_SELECT ) { clearWatch ( BTN_EXT_SELECT ) ; delete BTN_EXT_SELECT }
417
- if ( ! touch ) { showMessage ( MSG_SELECT , "scrollerSelect" ) ; return }
418
- if ( touch . type == 0 ) { showMessage ( MSG_SELECT , "scrollerSelect" ) ; }
419
+ if ( BTN_EXT_SELECT ) { clearWatch ( BTN_EXT_SELECT ) ; delete BTN_EXT_SELECT ; }
420
+ if ( ! touch ) { showMessageRouter ( MSG_SELECT , "scrollerSelect" ) ; return ; }
421
+ if ( touch . type == 0 ) { showMessageRouter ( MSG_SELECT , "scrollerSelect" ) ; }
419
422
if ( touch . type == 2 ) { showMessageSettings ( MSG_SELECT ) ; }
420
423
}
421
424
} ) ;
@@ -429,7 +432,7 @@ function showMessagesScroller(msg, persist, alreadyProcessed) {
429
432
prevScrollIdxs [ 0 ] - LINES_PER_SCREEN / 2 :prevScrollIdxs [ 0 ] + LINES_PER_SCREEN / 2 ;
430
433
WU . show ( ) ;
431
434
showMessageOverview ( identifyDisplayedMsg ( SCROLL_IDX_CENTER_SCREEN ) . id , true ) ;
432
- } , 0 )
435
+ } , 0 ) ;
433
436
} , BTN , { edge :'rising' } ) ) ) ;
434
437
}
435
438
@@ -675,7 +678,7 @@ function checkMessages(options) {
675
678
E . showScroller ( {
676
679
h : 48 ,
677
680
c : Math . max ( MESSAGES . length , 3 ) , // workaround for 2v10.219 firmware (min 3 not needed for 2v11)
678
- draw : function ( idx , r ) { "ram"
681
+ draw : function ( idx , r ) { "ram" ;
679
682
var msg = MESSAGES [ idx ] ;
680
683
if ( msg && msg . new ) g . setBgColor ( g . theme . bgH ) . setColor ( g . theme . fgH ) ;
681
684
else g . setBgColor ( g . theme . bg ) . setColor ( g . theme . fg ) ;
0 commit comments