Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Migrate off from deprecated API

Manav Rathi08b5672f9335
diff --git a/desktop/src/main/services/auto-launcher.ts b/desktop/src/main/services/auto-launcher.ts
index 4e97a02257..0942a49359 100644
--- a/desktop/src/main/services/auto-launcher.ts
+++ b/desktop/src/main/services/auto-launcher.ts
@@ -27,14 +27,14 @@ class AutoLauncher {
}
async toggleAutoLaunch() {
- const isEnabled = await this.isEnabled();
+ const wasEnabled = await this.isEnabled();
const autoLaunch = this.autoLaunch;
if (autoLaunch) {
- if (isEnabled) await autoLaunch.disable();
+ if (wasEnabled) await autoLaunch.disable();
else await autoLaunch.enable();
} else {
- if (isEnabled) app.setLoginItemSettings({ openAtLogin: false });
- else app.setLoginItemSettings({ openAtLogin: true });
+ const openAtLogin = !wasEnabled;
+ app.setLoginItemSettings({ openAtLogin });
}
}
@@ -42,8 +42,7 @@ class AutoLauncher {
if (this.autoLaunch) {
return app.commandLine.hasSwitch("hidden");
} else {
- // TODO(MR): This apparently doesn't work anymore.
- return app.getLoginItemSettings().wasOpenedAtLogin;
+ return app.getLoginItemSettings().openAtLogin;
}
}
}