@@ -274,14 +274,34 @@ function showMessageScroller(msg) {
274274 } ) ;
275275}
276276
277- function showMessageScroller2 ( msg , initAtEndOfMsg ) {
277+ function showMessageScroller2 ( msg , initAtEndOfMsg , persist , alreadyProcessedLines , alreadyProcessedIdx ) {
278+ if ( initAtEndOfMsg === undefined ) { initAtEndOfMsg = false ; }
279+ if ( persist === undefined ) { persist = true ; }
280+ if ( ! ! alreadyProcessedLines ) { alreadyProcessedLines = [ ] ; }
281+ if ( ! ! alreadyProcessedIdx ) { alreadyProcessedIdx = [ ] ; }
278282
283+ if ( replying ) { return ; }
284+ if ( persist ) {
285+ cancelReloadTimeout ( ) ;
286+ } else {
287+ resetReloadTimeout ( ) ;
288+ }
279289
280290 let msgIdx = MESSAGES . findIndex ( ( m ) => m . id == msg . id )
281291 //print("msgIdx",msgIdx);
282-
283- let startIdx = Math . max ( msgIdx - 1 , 0 ) ;
284- let stopIdx = Math . min ( msgIdx + 2 , MESSAGES . length ) ;
292+ let startIdx ;
293+ let stopIdx ;
294+
295+ if ( alreadyProcessedIdx . length === 0 ) {
296+ startIdx = Math . max ( msgIdx - 1 , 0 ) ;
297+ stopIdx = Math . min ( msgIdx + 2 , MESSAGES . length ) ;
298+ } else if ( msgIdx > alreadyProcessedIdx [ 0 ] && msgid < alreadyProcessedIdx [ 1 ] ) {
299+ startIdx = msgIdx ;
300+ stopIdx = msgIdx + 1 ;
301+ } else {
302+ startIdx = msgIdx ;
303+ stopIdx = msgIdx ;
304+ }
285305
286306 active = "scroller" ;
287307 var bodyFont = fontBig ;
@@ -291,13 +311,14 @@ function showMessageScroller2(msg, initAtEndOfMsg) {
291311 var j = MESSAGES . length - 1 ;
292312 var messagesWrapped = [ ] ;
293313 for ( let j = startIdx ; j < stopIdx ; j ++ ) {
294- if ( msg . id == "music" || msg . source == "maps" ) {
314+ let msgLocal = MESSAGES [ j ] ;
315+
316+ if ( msgLocal . id == "music" || msgLocal . source == "maps" || msgLocal . id == "call" ) {
295317 stopIdx ++
296318 if ( stopIdx >= MESSAGES . length ) break ;
297319 continue ;
298320 }
299321
300- let msgLocal = MESSAGES [ j ] ;
301322 var lines = [ ] ;
302323 if ( msgLocal . title ) {
303324 lines = g . wrapString ( msgLocal . title , g . getWidth ( ) - 10 ) ;
@@ -325,7 +346,7 @@ function showMessageScroller2(msg, initAtEndOfMsg) {
325346 initScroll += messagesWrapped [ i ] . length > 8 ?messagesWrapped [ i ] . length - 8 :0 ;
326347 }
327348
328- if ( allLines2 . length == 0 ) {
349+ if ( allLines2 . length == 0 && alreadyProcessedIdx . length == 0 ) {
329350 cancelReloadTimeout ( ) ;
330351 returnToClockIfEmpty ( ) ;
331352 }
@@ -350,12 +371,12 @@ function showMessageScroller2(msg, initAtEndOfMsg) {
350371 if ( idx >= allLines2 . length - 1 && msgIdx < MESSAGES . length - 1 ) {
351372 setTimeout ( ( ) => {
352373 showMessageScroller2 ( MESSAGES [ msgIdx + 1 ] , true ) ;
353- } , 50 )
374+ } , 0 )
354375 }
355376 if ( idx == 0 && msgIdx > 0 ) {
356377 setTimeout ( ( ) => {
357378 showMessageScroller2 ( MESSAGES [ msgIdx - 1 ] , false ) ;
358- } , 50 )
379+ } , 0 )
359380 }
360381 } , select : function ( idx , touch ) {
361382 if ( touch . type == 0 ) {
@@ -646,7 +667,7 @@ function checkMessages(options) {
646667 if ( ! options . ignoreUnread && newMessages . length ) {
647668 delete newMessages [ 0 ] . show ; // stop us getting stuck here if we're called a second time
648669 //showMessage(newMessages[0].id, false);
649- showMessageScroller2 ( MESSAGES [ 2 ] , false ) ;
670+ showMessageScroller2 ( MESSAGES [ 2 ] , false , false ) ;
650671 // buzz after showMessage, so being busy during layout doesn't affect the buzz pattern
651672 if ( global . BUZZ_ON_NEW_MESSAGE ) {
652673 // this is set if we entered the messages app by loading `messagegui.new.js`
0 commit comments