Skip to content

Commit 10d2dbd

Browse files
feat: Add clean install state functionality to app settings
* Introduced a new setting for cleaning the install state, allowing users to delete the install state file if it exists. * Added error handling and user feedback for the clean install state operation.
1 parent de74f96 commit 10d2dbd

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/settings/appSettings.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export default function otherSettings() {
7777
value: values.console,
7878
select: [appSettings.CONSOLE_LEGACY, appSettings.CONSOLE_ERUDA],
7979
},
80+
{
81+
key: "cleanInstallState",
82+
text: strings.cleanInstallState
83+
},
8084
{
8185
key: "keyboardMode",
8286
text: strings["keyboard mode"],
@@ -245,6 +249,28 @@ export default function otherSettings() {
245249
}
246250
}
247251

252+
case "cleanInstallState": {
253+
const INSTALL_STATE_STORAGE = Url.join(DATA_STORAGE, ".install-state");
254+
255+
const fs = fsOperation(INSTALL_STATE_STORAGE);
256+
257+
if(!(await fs.exists())) {
258+
toast(strings["no such file or directory"])
259+
break;
260+
}
261+
262+
loader.create("loading...")
263+
264+
try {
265+
await fs.delete()
266+
loader.destroy();
267+
toast(strings["success"])
268+
} catch (error) {
269+
helpers.error(error);
270+
loader.destroy()
271+
}
272+
}
273+
248274
case "rememberFiles":
249275
if (!value) {
250276
delete localStorage.files;

0 commit comments

Comments
 (0)