From b38918cb6dbb00db457ddbe8a69821aa7e44ba77 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Thu, 12 Feb 2026 12:19:32 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B0=20=D0=BE=D0=B1=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B2=20=D1=81?= =?UTF-8?q?=D0=BE=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D0=B8?= =?UTF-8?q?=D0=B8=20=D1=81=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=BC=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=BA=D0=BE=D0=BB=D0=BE=D0=BC=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D0=B4=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5?= =?UTF-8?q?=D0=BC=D1=8B=D0=BC=20SDU=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/UpdateAlert/UpdateAlert.tsx | 46 +++-- app/hooks/useUpdater.ts | 124 ------------- .../protocol/packets/packet.requestupdate.ts | 50 +---- .../UpdateProvider/UpdateProvider.tsx | 172 ++++++++++++++++++ app/providers/UpdateProvider/useUpdater.ts | 10 + app/views/Main/Main.tsx | 93 +++++----- app/views/Update/Update.tsx | 7 +- 7 files changed, 270 insertions(+), 232 deletions(-) delete mode 100644 app/hooks/useUpdater.ts create mode 100644 app/providers/UpdateProvider/UpdateProvider.tsx create mode 100644 app/providers/UpdateProvider/useUpdater.ts diff --git a/app/components/UpdateAlert/UpdateAlert.tsx b/app/components/UpdateAlert/UpdateAlert.tsx index 56e2e05..6f90f1b 100644 --- a/app/components/UpdateAlert/UpdateAlert.tsx +++ b/app/components/UpdateAlert/UpdateAlert.tsx @@ -1,44 +1,50 @@ import { Button, MantineRadius } from "@mantine/core"; import { IconRefresh } from "@tabler/icons-react"; import { AnimatedRoundedProgress } from "../AnimatedRoundedProgress/AnimatedRoundedProgress"; -import { UpdateStatus, useUpdater } from "@/app/hooks/useUpdater"; +import { useUpdater } from "@/app/providers/UpdateProvider/useUpdater"; +import { UpdateStatus } from "@/app/providers/UpdateProvider/UpdateProvider"; +import { useEffect } from "react"; interface UpdateAlertProps { radius?: MantineRadius; } +/** + * Компонент для отображения кнопки обновлений если оно доступно, и прогресса загрузки если обновление уже скачивается + */ export function UpdateAlert(props : UpdateAlertProps) { const radius = props.radius || 0; const { - appUpdateUrl, kernelUpdateUrl, downloadProgress, updateStatus, - kernelOutdatedForNextAppUpdates, downloadLastApplicationUpdate, restartAppForUpdateApply, + checkForUpdates } = useUpdater(); + useEffect(() => { + checkForUpdates(); + }, []); + return ( <> - {updateStatus == UpdateStatus.IDLE && <> - {kernelOutdatedForNextAppUpdates && <> - - } - {!kernelOutdatedForNextAppUpdates && appUpdateUrl != "" && <> - - } + {updateStatus == UpdateStatus.KERNEL_UPDATE_NEED && <> + + } + {updateStatus == UpdateStatus.APP_UPDATE_AVAILABLE && <> + } {updateStatus == UpdateStatus.DOWNLOADING && <> - - - )} +
+ +
+ + {viewState != ViewPanelsState.DIALOGS_PANEL_ONLY && + + }> + }> + }> + }> + }> + }> + }> + }> + }> + }> + }> + + } + + {oldPublicKey && ( + + + + Your account uses an old format public key which is no longer supported. Please create a new account to continue using the application. +

After press "OK" button, the application will close and remove all data. +
+ +
+
+ )} + ); diff --git a/app/views/Update/Update.tsx b/app/views/Update/Update.tsx index b1904a5..5edc24e 100644 --- a/app/views/Update/Update.tsx +++ b/app/views/Update/Update.tsx @@ -5,18 +5,19 @@ import { SettingsAlert } from "@/app/components/SettingsAlert/SettingsAlert"; import { SettingsInput } from "@/app/components/SettingsInput/SettingsInput"; import { UpdateAlert } from "@/app/components/UpdateAlert/UpdateAlert"; import { CORE_VERSION } from "@/app/constants"; -import { useUpdater } from "@/app/hooks/useUpdater"; +import { UpdateStatus } from "@/app/providers/UpdateProvider/UpdateProvider"; +import { useUpdater } from "@/app/providers/UpdateProvider/useUpdater"; import { APP_VERSION } from "@/app/version"; import { Box, Text } from "@mantine/core"; export function Update() { - const {appUpdateUrl, kernelUpdateUrl, kernelOutdatedForNextAppUpdates} = useUpdater(); + const {updateStatus} = useUpdater(); return ( <> - {(kernelUpdateUrl != "" || appUpdateUrl != "" || kernelOutdatedForNextAppUpdates) && ( + {(updateStatus != UpdateStatus.NO_UPDATES) && ( )}