@@ -285,6 +285,7 @@ function showMessagesScroller(msg) {
285285 var titleLines = [ ] ;
286286 let allLines = [ ] ;
287287 let firstTitleLinePerMsg = [ ] ;
288+ let footerImgNeg , footerImgPos ;
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+ footerImgNeg = atob ( "PhAB4A8AAAAAAAPAfAMAAAAAD4PwHAAAAAA/H4DwAAAAAH78B8AAAAAA/+A/AAAAAAH/Af//////w/gP//////8P4D///////H/Af//////z/4D8AAAAAB+/AfAAAAAA/H4DwAAAAAPg/AcAAAAADwHwDAAAAAA4A8AAAAAAAA==" ) ;
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+ footerImgPos = atob ( "QRABAAAAAAAH//+AAAAABgP//8AAAAADgf//4AAAAAHg4ABwAAAAAPh8APgAAAAAfj+B////////geHv///////hf+f///////GPw///////8cGBwAAAAAPx/gDgAAAAAfD/gHAAAAAA8DngOAAAAABwDHP8AAAAADACGf4AAAAAAAAM/w==" ) ;
308+ } else if ( msg . positive ) {
309+ //footer[0] += ((!msg.negative)?" ".repeat(6):"") + " " + "-".repeat(4) + ">";
310+ footerImgPos = atob ( "QRABAAAAAAAAAAOAAAAABgAAA8AAAAADgAAD4AAAAAHgAAPgAAAAAPgAA+AAAAAAfgAD4///////gAPh///////gA+D///////AD4H//////8cPgAAAAAAPw8+AAAAAAAfB/4AAAAAAA8B/gAAAAAABwB+AAAAAAADAB4AAAAAAAAABgAA==" ) ;
305311 }
306312 if ( ! footer ) {
307313 footer = [ "-" . repeat ( 12 ) ] ;
@@ -330,6 +336,16 @@ 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 ( "#f00" ) . drawImage ( footerImgNeg , r . x + 5 + 3 , r . y ) .
342+ setColor ( "#0f0" ) . drawImage ( footerImgPos , r . w - 64 - 5 , r . y ) ;
343+ }
344+ if ( 0 === scrollIdx ) {
345+ g .
346+ setColor ( "#f00" ) . drawImage ( atob ( "GBiBAAAYAAH/gAf/4A//8B//+D///D///H/P/n+H/n8P/n4f/vwAP/wAP34f/n8P/n+H/n/P/j///D///B//+A//8Af/4AH/gAAYAA==" ) , r . x , r . y - 1 ) .
347+ setColor ( g . theme . fg2 ) . drawImage ( atob ( "GBgBABgAAf+AB//gD//wH//4P//8P//8fAA+fAA+f//+f//+/AA//AA/f//+f//+fAA+fAA+P//8P//8H//4D//wB//gAf+AABgA" ) , r . w - 24 , r . y - 1 ) ;
348+ }
333349 if ( scrollIdx < shownScrollIdxFirst ) { shownScrollIdxFirst = scrollIdx ; }
334350 if ( scrollIdx > shownScrollIdxLast ) { shownScrollIdxLast = scrollIdx ; }
335351 } ,
@@ -339,7 +355,9 @@ function showMessagesScroller(msg) {
339355 if ( touch && touch . type === 2 ) { return ; }
340356 const MSG_SELECTED = MESSAGES [ i ] ;
341357 WU && WU . show ( ) ;
342- //E.showScroller();
358+ print ( process . memory ( ) ) ;
359+ E . showScroller ( ) ;
360+ print ( process . memory ( ) ) ;
343361 updateReadMessages ( ) ;
344362 delete titleLines , allLines ;
345363 if ( touch && touch . type . back ) {
@@ -361,30 +379,34 @@ function showMessagesScroller(msg) {
361379 }
362380 } ) ;
363381
382+ // Add an external back touch handler.
383+ let touchHandler = ( button , xy ) => {
384+ // if ((left side of Banlge 1 screen) || (top left corner of Bangle 2 screen))
385+ if ( ( ! xy && 1 === button ) || ( xy && xy . type === 0 && xy . x < 30 && xy . y < 30 ) ) {
386+ if ( ! persist ) { return load ( ) ; }
387+ returnToMain ( ) ;
388+ E . stopEventPropagation ( ) ;
389+ Bangle . removeListener ( "touch" , touchHandler ) ;
390+ if ( btnWatch ) { clearWatch ( btnWatch ) ; btnWatch = undefined ; }
391+ }
392+ } ;
393+ Bangle . prependListener ( "touch" , touchHandler ) ;
394+
364395 // If Bangle.js 2 add an external back hw button handler.
396+ let btnWatch ;
365397 if ( 2 === process . env . HWVERSION ) {
366- setWatch ( ( ) => {
398+ btnWatch = setWatch ( ( ) => {
367399 if ( "scroller" !== active ) { return ; }
368400 Bangle . emit ( "drag" , { dy :0 } ) ; // Compatibility with `kineticscroll`, stopping the scroller so it doesn't continue scrolling when the `showMessageOverview` screen is loaded.
369401 // Zero ms timeout as to not move on before the scroller has registered the emitted drag event.
370402 setTimeout ( ( ) => {
371403 if ( ! persist ) { return load ( ) ; }
404+ Bangle . removeListener ( "touch" , touchHandler ) ;
372405 Bangle . emit ( "touch" , 1 , { x :Math . floor ( APP_RECT . x2 / 2 ) , y :Math . floor ( APP_RECT . y2 / 2 ) , type :{ back :true } } ) ;
373406 } , 0 ) ;
374407 } , BTN ) ;
375408 }
376409
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 ) ;
388410
389411 function updateReadMessages ( ) {
390412 let shownMsgIdxFirst , shownMsgIdxLast ;
0 commit comments