@@ -364,7 +364,7 @@ function showMessagesScroller(msg, persist, alreadyProcessed) {
364
364
function reinitAdding ( idx ) {
365
365
setTimeout ( ( ) => {
366
366
E . showScroller ( ) ;
367
- if ( BTN_WATCH ) { clearWatch ( BTN_WATCH ) ; }
367
+ if ( BTN_EXT_SELECT ) { clearWatch ( BTN_EXT_SELECT ) ; }
368
368
showMessagesScroller ( MESSAGES [ idx ] ,
369
369
true , alreadyProcessed ) ;
370
370
} , 40 ) ;
@@ -388,30 +388,26 @@ function showMessagesScroller(msg, persist, alreadyProcessed) {
388
388
prevScrollIdxs [ 0 ] = scrollIdx ;
389
389
} ,
390
390
select : function ( scrollIdx , touch ) {
391
+ WU . show ( ) ;
391
392
const MSG_SELECT = identifyDisplayedMsg ( scrollIdx ) ;
392
- if ( touch . type == 0 ) {
393
- WU . show ( ) ;
394
- if ( BTN_WATCH ) { clearWatch ( BTN_WATCH ) ; }
395
- showMessage ( MSG_SELECT . id , true ) ;
396
- }
397
- if ( touch . type == 2 ) {
398
- WU . show ( ) ;
399
- if ( BTN_WATCH ) { clearWatch ( BTN_WATCH ) ; }
400
- showMessageSettings ( MSG_SELECT ) ;
401
- }
393
+ if ( BTN_EXT_SELECT ) { clearWatch ( BTN_EXT_SELECT ) ; }
394
+ if ( ! touch ) { showMessage ( MSG_SELECT . id , true ) ; return }
395
+ if ( touch . type == 0 ) { showMessage ( MSG_SELECT . id , true ) ; }
396
+ if ( touch . type == 2 ) { showMessageSettings ( MSG_SELECT ) ; }
402
397
}
403
398
} ) ;
404
399
405
- const BTN_WATCH = setWatch ( ( ) => {
400
+ // If Bangle.js 2 add an external select hw button handler.
401
+ const BTN_EXT_SELECT = ( ( 2 === process . env . HWVERSION ) && ( setWatch ( ( ) => {
406
402
Bangle . emit ( "drag" , { dy :0 } ) ; // Compatibility with `kineticscroll`, stopping the scroller so it doesn't continue scrolling when the `showMessage` screen is loaded.
407
403
// Zero ms timeout as to not move on before the scroller has registered the emitted drag event.
408
404
setTimeout ( ( ) => {
409
405
const SCROLL_IDX_CENTER_SCREEN = prevScrollIdxs [ 0 ] > prevScrollIdxs [ 1 ] ?
410
- prevScrollIdxs [ 0 ] - LINES_PER_SCREEN / 2 :prevScrollIdxs [ 0 ] + LINES_PER_SCREEN / 2 ;
406
+ prevScrollIdxs [ 0 ] - LINES_PER_SCREEN / 2 :prevScrollIdxs [ 0 ] + LINES_PER_SCREEN / 2 ;
411
407
WU . show ( ) ;
412
408
showMessage ( identifyDisplayedMsg ( SCROLL_IDX_CENTER_SCREEN ) . id , true ) ;
413
409
} , 0 )
414
- } , BTN , { edge :'rising' } ) ;
410
+ } , BTN , { edge :'rising' } ) ) ) ;
415
411
}
416
412
417
413
function showMessageSettings ( msg ) {
0 commit comments