mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
desktop: fix desktop toggle settings
This commit is contained in:
committed by
Abdullah Atta
parent
405a8aaad0
commit
aa3561555e
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
});
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along 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();
|
||||
|
||||
@@ -38,8 +38,8 @@ export const config = {
|
||||
closeToSystemTray: false
|
||||
},
|
||||
privacyMode: false,
|
||||
isSpellCheckerEnabled: false,
|
||||
zoomFactor: 0,
|
||||
isSpellCheckerEnabled: true,
|
||||
zoomFactor: 1,
|
||||
theme: nativeTheme.themeSource,
|
||||
automaticUpdates: true
|
||||
};
|
||||
|
||||
@@ -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()
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user