A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: fix desktop toggle settings
Abdullah Attaaa3561555e7b
diff --git a/apps/desktop/src/api/os-integration.ts b/apps/desktop/src/api/os-integration.tsindex 84245dddf..fc608eee9 100644--- a/apps/desktop/src/api/os-integration.ts+++ b/apps/desktop/src/api/os-integration.ts@@ -52,21 +52,21 @@ export const osIntegrationRouter = t.router({privacyMode: t.procedure.query(() => config.privacyMode),setPrivacyMode: t.procedure- .input(z.boolean().optional())- .mutation(({ input: privacyMode }) => {+ .input(z.object({ enabled: z.boolean() }))+ .mutation(({ input: { enabled } }) => {if (!globalThis.window || !["win32", "darwin"].includes(process.platform))return;- globalThis.window.setContentProtection(!!privacyMode);+ globalThis.window.setContentProtection(enabled);if (process.platform === "win32") {globalThis.window.setThumbnailClip(- privacyMode+ enabled? { x: 0, y: 0, width: 1, height: 1 }: { x: 0, y: 0, width: 0, height: 0 });}- config.privacyMode = !!privacyMode;+ config.privacyMode = enabled;}),desktopIntegration: t.procedure.query(() => config.desktopSettings),diff --git a/apps/desktop/src/api/spell-checker.ts b/apps/desktop/src/api/spell-checker.tsindex 16d64306f..00b9355c6 100644--- a/apps/desktop/src/api/spell-checker.ts+++ b/apps/desktop/src/api/spell-checker.ts@@ -114,9 +114,9 @@ export const spellCheckerRouter = t.router({globalThis.window?.webContents.session.setSpellCheckerLanguages(languages)),toggle: t.procedure- .input(z.boolean().optional())- .mutation(({ input: enabled }) => {- globalThis.window?.webContents.session.setSpellCheckerEnabled(!!enabled);- config.isSpellCheckerEnabled = !!enabled;+ .input(z.object({ enabled: z.boolean() }))+ .mutation(({ input: { enabled } }) => {+ globalThis.window?.webContents.session.setSpellCheckerEnabled(enabled);+ config.isSpellCheckerEnabled = enabled;})});diff --git a/apps/desktop/src/api/updater.ts b/apps/desktop/src/api/updater.tsindex 7c6215b5d..1a3238eef 100644--- a/apps/desktop/src/api/updater.ts+++ b/apps/desktop/src/api/updater.ts@@ -41,10 +41,9 @@ export const updaterRouter = t.router({}),toggleAutoUpdates: t.procedure- .input(z.boolean().optional())- .mutation(({ input }) => {- config.automaticUpdates =- input === undefined ? !config.automaticUpdates : input;+ .input(z.object({ enabled: z.boolean() }))+ .mutation(({ input: { enabled } }) => {+ config.automaticUpdates = enabled;}),onChecking: createSubscription("checking-for-update"),diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.tsindex 352799154..01f4f3b48 100644--- a/apps/desktop/src/main.ts+++ b/apps/desktop/src/main.ts@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { app, BrowserWindow, nativeTheme, session, shell } from "electron";+import { app, BrowserWindow, nativeTheme, shell } from "electron";import { isDevelopment } from "./utils";import { registerProtocol, PROTOCOL_URL } from "./utils/protocol";import { configureAutoUpdater } from "./utils/autoupdater";@@ -91,7 +91,7 @@ async function createWindow() {mainWindow.setOpacity(1);if (config.privacyMode) {- await api.integration.setPrivacyMode(config.privacyMode);+ await api.integration.setPrivacyMode({ enabled: config.privacyMode });}await AssetManager.loadIcons();diff --git a/apps/desktop/src/utils/config.ts b/apps/desktop/src/utils/config.tsindex 6d938ab13..59a261183 100644--- a/apps/desktop/src/utils/config.ts+++ b/apps/desktop/src/utils/config.ts@@ -38,8 +38,8 @@ export const config = {closeToSystemTray: false},privacyMode: false,- isSpellCheckerEnabled: false,- zoomFactor: 0,+ isSpellCheckerEnabled: true,+ zoomFactor: 1,theme: nativeTheme.themeSource,automaticUpdates: true};diff --git a/apps/web/src/hooks/use-spell-checker.ts b/apps/web/src/hooks/use-spell-checker.tsindex 2bd354ee1..5c2a0744d 100644--- a/apps/web/src/hooks/use-spell-checker.ts+++ b/apps/web/src/hooks/use-spell-checker.ts@@ -30,9 +30,9 @@ class SpellCheckerStore extends BaseStore<SpellCheckerStore> {toggleSpellChecker = async () => {const enabled = this.get().enabled;- await desktop?.spellChecker.toggle.mutate(!enabled);+ await desktop?.spellChecker.toggle.mutate({ enabled: !enabled });this.set({- enabled: await desktop?.spellChecker.isEnabled.query()+ enabled: !enabled});};@@ -44,11 +44,12 @@ class SpellCheckerStore extends BaseStore<SpellCheckerStore> {};refresh = async () => {+ console.log("SPELL CHECK", await desktop?.spellChecker.isEnabled.query());this.set({enabledLanguages:(await desktop?.spellChecker.enabledLanguages.query()) || [],languages: (await desktop?.spellChecker.languages.query()) || [],- enabled: (await desktop?.spellChecker.isEnabled.query()) || true+ enabled: await desktop?.spellChecker.isEnabled.query()});};}diff --git a/apps/web/src/stores/setting-store.js b/apps/web/src/stores/setting-store.jsindex e36b2bbaa..b370c14ee 100644--- a/apps/web/src/stores/setting-store.js+++ b/apps/web/src/stores/setting-store.js@@ -160,13 +160,13 @@ class SettingStore extends BaseStore {togglePrivacyMode = async () => {const privacyMode = this.get().privacyMode;this.set({ privacyMode: !privacyMode });- await desktop?.integration.setPrivacyMode.mutate(!privacyMode);+ await desktop?.integration.setPrivacyMode.mutate({ enabled: !privacyMode });};toggleAutoUpdates = async () => {const autoUpdates = this.get().autoUpdates;this.set({ autoUpdates: !autoUpdates });- await desktop?.updater.toggleAutoUpdates.mutate(!autoUpdates);+ await desktop?.updater.toggleAutoUpdates.mutate({ enabled: !autoUpdates });};}