bthrm - Modify dialogs

pull/3349/head
Martin Boonk 2024-04-10 21:39:06 +02:00
parent a98513d2ff
commit 7e0792409c
1 changed files with 7 additions and 4 deletions

View File

@ -262,12 +262,15 @@
log("Found device", d); log("Found device", d);
let shown = (d.name || d.id.substr(0, 17)); let shown = (d.name || d.id.substr(0, 17));
submenu_scan[shown] = function () { submenu_scan[shown] = function () {
E.showPrompt("Set " + shown + "?").then((r) => { E.showPrompt("Connect to\n" + shown + "?", {title: "Pairing"}).then((r) => {
if (r) { if (r) {
E.showMessage("Connecting..."); E.showMessage("Connecting...", {img:require("Storage").read("bthrm.img")});
let count = 0; let count = 0;
const successHandler = ()=>{ const successHandler = ()=>{
E.showAlert("Success").then(()=>{ E.showPrompt("Success!", {
img:require("Storage").read("bthrm.img"),
buttons: { "OK":true }
}).then(()=>{
writeSettings("btid", d.id); writeSettings("btid", d.id);
// Store the name for displaying later. Will connect by ID // Store the name for displaying later. Will connect by ID
if (d.name) { if (d.name) {
@ -280,7 +283,7 @@
count++; count++;
log("ERROR", e); log("ERROR", e);
if (count <= 10){ if (count <= 10){
E.showMessage("Error during caching, Retry " + count + "/10", e); E.showMessage("Error during caching\nRetry " + count + "/10", e);
return cacheDevice(d.id).then(successHandler).catch(errorHandler); return cacheDevice(d.id).then(successHandler).catch(errorHandler);
} else { } else {
E.showAlert("Error during caching", e).then(()=>{ E.showAlert("Error during caching", e).then(()=>{