mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
web: disable desktop update checker if auto updates off
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import { AppEventManager, AppEvents } from "../app-events";
|
||||
import { TaskScheduler } from "../../utils/task-scheduler";
|
||||
import { checkForUpdate } from "../../utils/updater";
|
||||
import { showToast } from "../../utils/toast";
|
||||
import { store as settingStore } from "../../stores/setting-store";
|
||||
|
||||
export const desktop = createTRPCProxyClient<AppRouter>({
|
||||
links: [ipcLink()]
|
||||
@@ -64,7 +65,7 @@ function attachListeners() {
|
||||
);
|
||||
|
||||
TaskScheduler.register("updateCheck", "0 0 */12 * * * *", () => {
|
||||
checkForUpdate();
|
||||
checkForUpdate(settingStore.get().autoUpdates);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { checkForUpdate } from "../utils/updater";
|
||||
import { AppEventManager, AppEvents } from "../common/app-events";
|
||||
import BaseStore from "../stores";
|
||||
import createStore from "../common/store";
|
||||
import { store as settingStore } from "../stores/setting-store";
|
||||
|
||||
type CompletedUpdateStatus = { type: "completed"; version: string };
|
||||
type DownloadingUpdateStatus = { type: "downloading"; progress: number };
|
||||
@@ -104,7 +104,7 @@ export function useAutoUpdater() {
|
||||
);
|
||||
|
||||
checkingForUpdate();
|
||||
checkForUpdate().catch(console.error);
|
||||
checkForUpdate(settingStore.get().autoUpdates).catch(console.error);
|
||||
|
||||
return () => {
|
||||
checkingForUpdateEvent.unsubscribe();
|
||||
|
||||
@@ -87,7 +87,7 @@ class SettingStore extends BaseStore<SettingStore> {
|
||||
ImageCompressionOptions.ASK_EVERY_TIME
|
||||
);
|
||||
desktopIntegrationSettings?: DesktopIntegration;
|
||||
autoUpdates = true;
|
||||
autoUpdates = false;
|
||||
isFlatpak = false;
|
||||
isSnap = false;
|
||||
proxyRules?: string;
|
||||
|
||||
@@ -21,9 +21,12 @@ import { AppEventManager, AppEvents } from "../common/app-events";
|
||||
import { desktop } from "../common/desktop-bridge";
|
||||
import { appVersion, getServiceWorkerVersion } from "./version";
|
||||
|
||||
export async function checkForUpdate() {
|
||||
if (IS_DESKTOP_APP) await desktop?.updater.check.query().catch(console.error);
|
||||
else {
|
||||
export async function checkForUpdate(checkOnDesktop = true) {
|
||||
if (IS_DESKTOP_APP && checkOnDesktop) {
|
||||
await desktop?.updater.check.query().catch(console.error);
|
||||
}
|
||||
|
||||
if (!IS_DESKTOP_APP) {
|
||||
AppEventManager.publish(AppEvents.checkingForUpdate);
|
||||
|
||||
const registrations =
|
||||
|
||||
Reference in New Issue
Block a user