Enable updater and remove unzipping and installing update text (#2918)

This commit is contained in:
Zane
2025-06-13 16:15:20 -07:00
committed by GitHub
parent 83cd9e1613
commit 92b3735953
7 changed files with 14 additions and 284 deletions
@@ -1,6 +1,7 @@
import { useState, useEffect, useRef } from 'react';
import { Switch } from '../../ui/switch';
import UpdateSection from './UpdateSection';
import { UPDATES_ENABLED } from '../../../updates';
interface AppSettingsSectionProps {
scrollToSection?: string;
@@ -11,7 +12,6 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
const [dockIconEnabled, setDockIconEnabled] = useState(true);
const [isMacOS, setIsMacOS] = useState(false);
const [isDockSwitchDisabled, setIsDockSwitchDisabled] = useState(false);
const [updatesEnabled, setUpdatesEnabled] = useState(false);
const updateSectionRef = useRef<HTMLDivElement>(null);
// Check if running on macOS
@@ -19,25 +19,6 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
setIsMacOS(window.electron.platform === 'darwin');
}, []);
// Load updater state
useEffect(() => {
window.electron.getUpdaterEnabled().then((enabled) => {
setUpdatesEnabled(enabled);
});
// Listen for updater state changes
const handleUpdaterStateChange = (enabled: boolean) => {
setUpdatesEnabled(enabled);
};
window.electron.onUpdaterStateChanged(handleUpdaterStateChange);
// Cleanup listener on unmount
return () => {
window.electron.removeUpdaterStateListener(handleUpdaterStateChange);
};
}, []);
// Handle scrolling to update section
useEffect(() => {
if (scrollToSection === 'update' && updateSectionRef.current) {
@@ -144,7 +125,7 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
</div>
{/* Update Section */}
{updatesEnabled && (
{UPDATES_ENABLED && (
<div ref={updateSectionRef} className="mt-8 pt-8 border-t border-gray-200">
<UpdateSection />
</div>
@@ -147,8 +147,6 @@ export default function UpdateSection() {
};
const installUpdate = () => {
setUpdateStatus('installing');
// This will quit the app and install the update
window.electron.installUpdate();
};
@@ -158,8 +156,6 @@ export default function UpdateSection() {
return 'Checking for updates...';
case 'downloading':
return `Downloading update... ${Math.round(progress)}%`;
case 'installing':
return 'Installing update...';
case 'ready':
return 'Update downloaded and ready to install!';
case 'success':
@@ -180,7 +176,6 @@ export default function UpdateSection() {
switch (updateStatus) {
case 'checking':
case 'downloading':
case 'installing':
return <Loader2 className="w-4 h-4 animate-spin" />;
case 'success':
return <CheckCircle className="w-4 h-4 text-green-500" />;
@@ -257,9 +252,10 @@ export default function UpdateSection() {
{/* Update information */}
{updateInfo.isUpdateAvailable && (
<div className="text-xs text-textSubtle mt-4 space-y-1">
<p>Update will be downloaded and automatically extracted to your Downloads folder.</p>
<p>Update will be downloaded to your Downloads folder.</p>
<p className="text-xs text-amber-600">
After download, move the Goose app to /Applications to complete the update.
After download, extract Goose-{updateInfo.latestVersion}.zip and move the Goose app
to /Applications to complete the update.
</p>
</div>
)}