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 <tukon479@gmail.com>
This commit is contained in:
parent
0f6ee421fd
commit
ef304cdf69
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<div>
|
||||
<section className="mt-4">
|
||||
|
|
@ -56,9 +60,15 @@ export const SettingAbout = () => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div className="shrink-0">
|
||||
<div className="flex shrink-0 gap-2">
|
||||
{IN_ELECTRON && (
|
||||
<Button variant="outline" onClick={handleCheckForUpdates} buttonClassName="h-10">
|
||||
{t("about.checkForUpdates")}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="outline"
|
||||
buttonClassName="h-10"
|
||||
onClick={() => {
|
||||
window.open(`${repository.url}/releases`, "_blank")
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"about.changelog": "Changelog",
|
||||
"about.checkForUpdates": "Check for Updates",
|
||||
"about.feedbackInfo": "{{appName}} ({{commitSha}}) is open-source and actively developed on GitHub. If you have any feedback or suggestions, please feel free to <OpenIssueLink>open an issue</OpenIssueLink> <ExternalLinkIcon /> on our GitHub.",
|
||||
"about.iconLibrary": "The icon library used is copyrighted by <IconLibraryLink /> <ExternalLinkIcon /> and cannot be redistributed.",
|
||||
"about.licenseInfo": "Copyright © {{currentYear}} {{appName}}. All rights reserved.",
|
||||
|
|
|
|||
Loading…
Reference in New Issue