diff --git a/apps/hardalarm/hardalarm.js b/apps/hardalarm/hardalarm.js index e33bd39cc..a5b50f5dd 100644 --- a/apps/hardalarm/hardalarm.js +++ b/apps/hardalarm/hardalarm.js @@ -71,26 +71,30 @@ function showAlarm(alarm) { var currentGuess = 10; var randomNum = getRandomFromRange(0, 7, 13, 20); showNumberPicker(currentGuess, randomNum) - setWatch(o => { - if(!okClicked && currentGuess < 20) { - currentGuess = currentGuess + 1; - showNumberPicker(currentGuess, randomNum); + + let onSwipe = (x, y) => { + if (y == 1) { + if(!okClicked && currentGuess < 20) { + currentGuess = currentGuess + 1; + showNumberPicker(currentGuess, randomNum); + } } - }, BTN1, {repeat: true, edge: 'rising'}); + else if (y == -1) { + if(!okClicked && currentGuess > 0) { + currentGuess = currentGuess - 1; + showNumberPicker(currentGuess, randomNum); + } + } + }; + Bangle.on("swipe", onSwipe); + setWatch(o => { if(currentGuess == randomNum) { okClicked = true; showPrompt(msg, buzzCount, alarm); } - }, BTN2, {repeat: true, edge: 'rising'}); - - setWatch(o => { - if(!okClicked && currentGuess > 0) { - currentGuess = currentGuess - 1; - showNumberPicker(currentGuess, randomNum); - } - }, BTN3, {repeat: true, edge: 'rising'}); + }, BTN, {repeat: true, edge: 'rising'}); function buzz() { Bangle.buzz(500).then(()=>{