Skip to content

Commit

Permalink
vibrate Android phone on mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccrear committed Mar 17, 2024
1 parent 255f396 commit fea1ceb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/decode-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,7 @@ function afterMove(status) {
$("#board").removeClass("animated shake");
}, 500);
showGuide(encodedMessage[bitProgressCounter]);
mistakeCounter++;
console.log("mistakes: ", mistakeCounter);
$("#mistake-counter").text(mistakeCounter);
$(".mistake-counter-label").show();
registerMistake();
} else if (status === "wrong") {
console.log("status: wrong");
$("#board").addClass("animated shake");
Expand All @@ -310,6 +307,16 @@ function afterMove(status) {
}
}

function registerMistake() {
mistakeCounter++;
console.log("mistakes: ", mistakeCounter);
$("#mistake-counter").text(mistakeCounter);
$(".mistake-counter-label").show();
if(navigator.vibrate && typeof navigator.vibrate === 'function'){
navigator.vibrate(200);
}
}

// DIGITS will come in as 01
// function handleEmojiInput(origEncodedMessage, DIGITS) {
// const emojiMessage = convertDigits(origEncodedMessage, ["0", "1"], DIGITS);
Expand Down

0 comments on commit fea1ceb

Please sign in to comment.