Skip to content

Commit

Permalink
0.74: Add extra layer of checks before allowing a factory reset (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jul 10, 2024
1 parent 16d4911 commit 422a349
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions apps/setting/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ of 'Select Clock'
0.71: Minor code improvements
0.72: Add setting for configuring BLE privacy
0.73: Fix `const` bug / work with fastload
0.74: Add extra layer of checks before allowing a factory reset (fix #3476)
2 changes: 1 addition & 1 deletion apps/setting/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "setting",
"name": "Settings",
"version": "0.73",
"version": "0.74",
"description": "A menu for setting up Bangle.js",
"icon": "settings.png",
"tags": "tool,system",
Expand Down
20 changes: 15 additions & 5 deletions apps/setting/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,24 @@ function showUtilMenu() {
}
});
};

if (Bangle.factoryReset) {
menu[/*LANG*/'Factory Reset'] = ()=>{
E.showPrompt(/*LANG*/'This will remove everything!',{title:/*LANG*/"Factory Reset"}).then((v) => {
E.showPrompt(/*LANG*/'This will remove everything!',{title:/*LANG*/"Factory Reset",back:showUtilMenu}).then((v) => {
if (v) {
E.showMessage();
Terminal.setConsole();
Bangle.factoryReset();
var n = ((Math.random()*4)&3) + 1;
E.showPrompt(/*LANG*/"To confirm, please press "+n,{
title:/*LANG*/"Factory Reset",
buttons : {"1":1,"2":2,"3":3,"4":4},
back:showUtilMenu
}).then(function(v) {
if (v==n) {
E.showMessage();
Terminal.setConsole();
Bangle.factoryReset();
} else {
showUtilMenu();
}
});
} else showUtilMenu();
});
}
Expand Down

0 comments on commit 422a349

Please sign in to comment.