@@ -285,6 +285,7 @@ function showMessagesScroller(msg) {
285285 var titleLines = [ ] ;
286286 let allLines = [ ] ;
287287 let firstTitleLinePerMsg = [ ] ;
288+ let footerImgs = { } ;
288289 for ( let i = 0 ; i < MESSAGES . length ; i ++ ) {
289290 if ( MSG_IDX === i ) { initScroll = allLines . length * FONT_HEIGHT ; }
290291 let msgIter = MESSAGES [ i ] ;
@@ -298,10 +299,15 @@ function showMessagesScroller(msg) {
298299 }
299300 let footer = [ "" ] ;
300301 if ( msg . negative ) {
301- footer [ 0 ] += "<" + "-" . repeat ( 4 ) + " " + ( ( ! msg . reply && ! msg . positive ) ?" " . repeat ( 6 ) :"" ) ;
302+ //footer[0] += "<" + "-".repeat(4) + " " + ((!msg.reply&&!msg.positive)?" ".repeat(6):"");
303+ footerImgs . neg = { src :atob ( "PhAB4A8AAAAAAAPAfAMAAAAAD4PwHAAAAAA/H4DwAAAAAH78B8AAAAAA/+A/AAAAAAH/Af//////w/gP//////8P4D///////H/Af//////z/4D8AAAAAB+/AfAAAAAA/H4DwAAAAAPg/AcAAAAADwHwDAAAAAA4A8AAAAAAAA==" ) , col :"#f00" }
302304 }
303- if ( msg . reply || msg . positive ) {
304- footer [ 0 ] += ( ( ! msg . negative ) ?" " . repeat ( 6 ) :"" ) + " " + "-" . repeat ( 4 ) + ">" ;
305+ if ( msg . reply && reply ) {
306+ //footer[0] += ((!msg.negative)?" ".repeat(6):"") + " " + "-".repeat(4) + ">";
307+ footerImgs . pos = { src :atob ( "QRABAAAAAAAH//+AAAAABgP//8AAAAADgf//4AAAAAHg4ABwAAAAAPh8APgAAAAAfj+B////////geHv///////hf+f///////GPw///////8cGBwAAAAAPx/gDgAAAAAfD/gHAAAAAA8DngOAAAAABwDHP8AAAAADACGf4AAAAAAAAM/w==" ) , col :"#0f0" }
308+ } else if ( msg . positive ) {
309+ //footer[0] += ((!msg.negative)?" ".repeat(6):"") + " " + "-".repeat(4) + ">";
310+ footerImgs . pos = { src :atob ( "QRABAAAAAAAAAAOAAAAABgAAA8AAAAADgAAD4AAAAAHgAAPgAAAAAPgAA+AAAAAAfgAD4///////gAPh///////gA+D///////AD4H//////8cPgAAAAAAPw8+AAAAAAAfB/4AAAAAAA8B/gAAAAAABwB+AAAAAAADAB4AAAAAAAAABgAA==" ) , col :"#0f0" }
305311 }
306312 if ( ! footer ) {
307313 footer = [ "-" . repeat ( 12 ) ] ;
@@ -330,6 +336,11 @@ function showMessagesScroller(msg) {
330336 setColor ( titleLines . find ( e => e == scrollIdx ) !== undefined ? g . theme . fg2 : g . theme . fg ) .
331337 clearRect ( r ) ;
332338 g . setFont ( bodyFont ) . setFontAlign ( 0 , - 1 ) . drawString ( allLines [ scrollIdx ] , r . x + r . w / 2 , r . y ) ;
339+ if ( allLines [ scrollIdx ] === "" ) {
340+ g .
341+ setColor ( footerImgs . neg . col ) . drawImage ( footerImgs . neg . src , r . x + 5 + 3 , r . y ) .
342+ setColor ( footerImgs . pos . col ) . drawImage ( footerImgs . pos . src , r . w - 64 - 5 , r . y ) ;
343+ }
333344 if ( scrollIdx < shownScrollIdxFirst ) { shownScrollIdxFirst = scrollIdx ; }
334345 if ( scrollIdx > shownScrollIdxLast ) { shownScrollIdxLast = scrollIdx ; }
335346 } ,
@@ -339,7 +350,9 @@ function showMessagesScroller(msg) {
339350 if ( touch && touch . type === 2 ) { return ; }
340351 const MSG_SELECTED = MESSAGES [ i ] ;
341352 WU && WU . show ( ) ;
342- //E.showScroller();
353+ print ( process . memory ( ) ) ;
354+ E . showScroller ( ) ;
355+ print ( process . memory ( ) ) ;
343356 updateReadMessages ( ) ;
344357 delete titleLines , allLines ;
345358 if ( touch && touch . type . back ) {
@@ -361,30 +374,34 @@ function showMessagesScroller(msg) {
361374 }
362375 } ) ;
363376
377+ // Add an external back touch handler.
378+ let touchHandler = ( button , xy ) => {
379+ // if ((left side of Banlge 1 screen) || (top left corner of Bangle 2 screen))
380+ if ( ( ! xy && 1 === button ) || ( xy && xy . type === 0 && xy . x < 30 && xy . y < 30 ) ) {
381+ if ( ! persist ) { return load ( ) ; }
382+ returnToMain ( ) ;
383+ E . stopEventPropagation ( ) ;
384+ Bangle . removeListener ( "touch" , touchHandler ) ;
385+ if ( btnWatch ) { clearWatch ( btnWatch ) ; btnWatch = undefined ; }
386+ }
387+ } ;
388+ Bangle . prependListener ( "touch" , touchHandler ) ;
389+
364390 // If Bangle.js 2 add an external back hw button handler.
391+ let btnWatch ;
365392 if ( 2 === process . env . HWVERSION ) {
366- setWatch ( ( ) => {
393+ btnWatch = setWatch ( ( ) => {
367394 if ( "scroller" !== active ) { return ; }
368395 Bangle . emit ( "drag" , { dy :0 } ) ; // Compatibility with `kineticscroll`, stopping the scroller so it doesn't continue scrolling when the `showMessageOverview` screen is loaded.
369396 // Zero ms timeout as to not move on before the scroller has registered the emitted drag event.
370397 setTimeout ( ( ) => {
371398 if ( ! persist ) { return load ( ) ; }
399+ Bangle . removeListener ( "touch" , touchHandler ) ;
372400 Bangle . emit ( "touch" , 1 , { x :Math . floor ( APP_RECT . x2 / 2 ) , y :Math . floor ( APP_RECT . y2 / 2 ) , type :{ back :true } } ) ;
373401 } , 0 ) ;
374402 } , BTN ) ;
375403 }
376404
377- // Add an external back touch handler.
378- let touchHandler = ( button , xy ) => {
379- // if ((left side of Banlge 1 screen) || (top left corner of Bangle 2 screen))
380- if ( ( ! xy && 1 === button ) || ( xy && xy . type === 0 && xy . x < 30 && xy . y < 30 ) ) {
381- if ( ! persist ) { return load ( ) ; }
382- returnToMain ( ) ;
383- E . stopEventPropagation ( ) ;
384- Bangle . removeListener ( "touch" , touchHandler ) ;
385- }
386- } ;
387- Bangle . prependListener ( "touch" , touchHandler ) ;
388405
389406 function updateReadMessages ( ) {
390407 let shownMsgIdxFirst , shownMsgIdxLast ;
0 commit comments