From 9d01b070d388881bacbfb7e58a0082d53c0a7e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20=E2=80=9CStorm1er=E2=80=9D=20Decaunes?= Date: Wed, 14 Aug 2019 17:18:21 +0200 Subject: [PATCH] fix: #42 revamped start on boot as it was still causing error for some users. --- js/methods.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/methods.js b/js/methods.js index 84bb7b5..34b1769 100644 --- a/js/methods.js +++ b/js/methods.js @@ -630,14 +630,16 @@ function updateScheduledStartOnBoot(toBeEnabled) { }); autoLaunch.isEnabled().then((isEnabled) => { console.log(`toBeEnabled: ${toBeEnabled} isEnabled: ${isEnabled}`); - if (toBeEnabled && !isEnabled) { - autoLaunch.enable(); - } else { - try { + + try { + if (isEnabled) { autoLaunch.disable(); - } catch (error) { - console.log("WARNING: Unable to disable start on boot. Is autoLaunch already disabled?", error); } + if (toBeEnabled) { + autoLaunch.enable(); + } + } catch (error) { + console.log("WARNING: Unable to manage start on boot.", error); } }); }