Skip to content

Commit a25b353

Browse files
committed
feat: take confirmation before uninstalling terminal
1 parent 6620a3d commit a25b353

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/settings/terminalSettings.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import fonts from "lib/fonts";
1111
import appSettings from "lib/settings";
1212
import FileBrowser from "pages/fileBrowser";
1313
import helpers from "utils/helpers";
14+
import confirm from "dialogs/confirm";
1415

1516
export default function terminalSettings() {
1617
const title = strings["terminal settings"];
@@ -188,7 +189,7 @@ export default function terminalSettings() {
188189
* @param {string} key
189190
* @param {string} value
190191
*/
191-
function callback(key, value) {
192+
async function callback(key, value) {
192193
switch (key) {
193194
case "all_file_access":
194195
if (ANDROID_SDK_INT >= 30) {
@@ -213,11 +214,13 @@ export default function terminalSettings() {
213214
return;
214215

215216
case "uninstall":
216-
loader.showTitleLoader();
217-
Terminal.uninstall()
218-
.then(() => {
219-
loader.removeTitleLoader();
220-
alert(
217+
const confirmation = await confirm(strings.confirm, "Are you sure you want to uninstall the terminal?");
218+
if (confirmation) {
219+
loader.showTitleLoader();
220+
Terminal.uninstall()
221+
.then(() => {
222+
loader.removeTitleLoader();
223+
alert(
221224
strings.success.toUpperCase(),
222225
"Terminal uninstalled successfully.",
223226
);
@@ -227,6 +230,7 @@ export default function terminalSettings() {
227230
console.error("Terminal uninstall failed:", error);
228231
helpers.error(error);
229232
});
233+
}
230234
return;
231235

232236
default:

0 commit comments

Comments
 (0)