From ef304cdf69a76d8d8fed34e58f5ca63cdad836cb Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 27 May 2025 00:51:38 +0800 Subject: [PATCH] feat(desktop): add check for updates functionality in settings - Integrated a new button in the About section to allow users to check for application updates. - Updated localization files to include the new button text. - Enhanced the app's update handling by importing the checkForAppUpdates function. Signed-off-by: Innei --- apps/desktop/layer/main/src/tipc/app.ts | 6 +++++- .../renderer/src/modules/settings/tabs/about.tsx | 14 ++++++++++++-- locales/settings/en.json | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/desktop/layer/main/src/tipc/app.ts b/apps/desktop/layer/main/src/tipc/app.ts index 32567c8e4..28323a1e7 100644 --- a/apps/desktop/layer/main/src/tipc/app.ts +++ b/apps/desktop/layer/main/src/tipc/app.ts @@ -19,7 +19,7 @@ import { cleanupOldRender, loadDynamicRenderEntry } from "~/updater/hot-updater" import { downloadFile } from "../lib/download" import { i18n } from "../lib/i18n" import type { RendererHandlers } from "../renderer-handlers" -import { quitAndInstall } from "../updater" +import { checkForAppUpdates, quitAndInstall } from "../updater" import { getMainWindow } from "../window" import { t } from "./_instance" @@ -324,6 +324,10 @@ ${content} revealLogFile: t.procedure.action(async () => { return revealLogFile() }), + + checkForUpdates: t.procedure.action(async () => { + return checkForAppUpdates() + }), } interface Sender extends Electron.WebContents { diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx index 2e974a521..c5e0e3254 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/about.tsx @@ -3,7 +3,7 @@ import { Button } from "@follow/components/ui/button/index.js" import { styledButtonVariant } from "@follow/components/ui/button/variants.js" import { Divider } from "@follow/components/ui/divider/index.js" import { SocialMediaLinks } from "@follow/constants" -import { MODE, ModeEnum } from "@follow/shared/constants" +import { IN_ELECTRON, MODE, ModeEnum } from "@follow/shared/constants" import { getCurrentEnvironment } from "@follow/utils/environment" import PKG, { repository } from "@pkg" import { useQuery } from "@tanstack/react-query" @@ -23,6 +23,10 @@ export const SettingAbout = () => { const rendererVersion = PKG.version + const handleCheckForUpdates = () => { + tipcClient?.checkForUpdates() + } + return (
@@ -56,9 +60,15 @@ export const SettingAbout = () => {
-
+
+ {IN_ELECTRON && ( + + )}