diff --git a/apps/cubescramble/cube-scramble.js b/apps/cubescramble/cube-scramble.js index 6fe477031..73c4e95ef 100644 --- a/apps/cubescramble/cube-scramble.js +++ b/apps/cubescramble/cube-scramble.js @@ -58,19 +58,16 @@ const getRandomInt = max => Math.floor(Math.random() * Math.floor(max)); // retu const getRandomIntBetween = (min, max) => Math.floor(Math.random() * (max - min) + min); const presentScramble = () => { - E.showPrompt(makeScramble().join(" "), { - title: "cube scramble", + showPrompt(makeScramble().join(" "), { buttons: {"solve": true, "reset": false} }).then((v) => { if (v) { const start = new Date(); - E.showPrompt(" ", { - title: "cube scramble", + showPrompt(" ", { buttons: {"stop": true} }).then(() => { const time = parseFloat(((new Date()).getTime() - start.getTime()) / 1000); - E.showPrompt(String(time.toFixed(3)), { - title: "cube scramble", + showPrompt(String(time.toFixed(3)), { buttons: {"next": true} }).then(() => { presentScramble(); @@ -82,6 +79,11 @@ const presentScramble = () => { }); }; +const showPrompt = (text, options = {}) => { + options.title = options.title || "cube scramble"; + return E.showPrompt(text, options); +}; + const init = () => { Bangle.setLCDTimeout(0); Bangle.setLCDPower(1);