add manual update notice for macOS, disable autoinstall (#1725)

This commit is contained in:
jeffvli
2026-03-09 01:31:33 -07:00
parent 078d8068e0
commit 6a47e99680
7 changed files with 140 additions and 7 deletions
+7
View File
@@ -29,6 +29,12 @@ const ReleaseNotesModal = lazy(() =>
})),
);
const UpdateAvailableDialog = lazy(() =>
import('./update-available-dialog').then((module) => ({
default: module.UpdateAvailableDialog,
})),
);
const ipc = isElectron() ? window.api.ipc : null;
export const App = () => {
@@ -118,6 +124,7 @@ export const App = () => {
</WebAudioContext.Provider>
<Suspense fallback={null}>
<ReleaseNotesModal />
<UpdateAvailableDialog />
</Suspense>
</MantineProvider>
);
+79
View File
@@ -0,0 +1,79 @@
import isElectron from 'is-electron';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button } from '/@/shared/components/button/button';
import { Dialog } from '/@/shared/components/dialog/dialog';
import { Group } from '/@/shared/components/group/group';
import { Icon } from '/@/shared/components/icon/icon';
import { Stack } from '/@/shared/components/stack/stack';
import { Text } from '/@/shared/components/text/text';
import { useLocalStorage } from '/@/shared/hooks/use-local-storage';
export const UpdateAvailableDialog = () => {
const [opened, setOpened] = useState(false);
const [version, setVersion] = useState<string>('');
const { t } = useTranslation();
const [versionDismissed, setVersionDismissed] = useLocalStorage<string>({
key: 'version_dismissed',
});
useEffect(() => {
if (!isElectron()) return;
const handleUpdateAvailable = (_event: any, newVersion: string) => {
if (versionDismissed !== newVersion) {
setVersion(newVersion);
setOpened(true);
}
};
window.api.ipc.on('update-available', handleUpdateAvailable);
return () => {
window.api.ipc.removeListener?.('update-available', handleUpdateAvailable);
};
}, [versionDismissed]);
if (!opened) return null;
const handleDismiss = () => {
if (version) {
setVersionDismissed(version);
}
setOpened(false);
};
return (
<Dialog
onClose={handleDismiss}
opened={opened}
position={{ bottom: 100, right: 12 }}
radius="md"
size="lg"
withCloseButton
>
<Stack gap="md">
<Text fw={700} size="md">
{t('common.newVersionAvailable', { postProcess: 'sentenceCase' })} - {version}
</Text>
<Group justify="flex-end">
<Button onClick={handleDismiss} size="xs" variant="default">
{t('common.dismiss', { postProcess: 'titleCase' })}
</Button>
<Button
component="a"
href="https://github.com/jeffvli/feishin/releases/latest"
onClick={handleDismiss}
rightSection={<Icon icon="externalLink" size="sm" />}
size="xs"
target="_blank"
variant="filled"
>
{t('action.viewMore', { postProcess: 'titleCase' })}
</Button>
</Group>
</Stack>
</Dialog>
);
};