From bc75bb93d5aa9aa176262a138f47d3a1d53afbcb Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Thu, 10 Sep 2026 00:25:58 -0400 Subject: fix: simplify Flatpak runtime toggles --- src/components/SetupTab.tsx | 76 ++------------------------------------------- 1 file changed, 3 insertions(+), 73 deletions(-) (limited to 'src/components') diff --git a/src/components/SetupTab.tsx b/src/components/SetupTab.tsx index df43c5e..aec0e93 100644 --- a/src/components/SetupTab.tsx +++ b/src/components/SetupTab.tsx @@ -1,8 +1,7 @@ -import { ButtonItem, ConfirmModal, Field, PanelSection, PanelSectionRow, ToggleField, showModal } from "@decky/ui"; +import { ButtonItem, Field, PanelSection, PanelSectionRow, ToggleField } from "@decky/ui"; import { useEffect, useState } from "react"; import { getFlatpakSupportStatus, - removePluginOwnedFlatpakExtensions, setFlatpakExtensionEnabled, type FlatpakExtensionStatus, type SteamBranchStatus, @@ -41,8 +40,6 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) { extension_id: "", supported_branches: [], installed_branches: [], - owned_branches: [], - ownership_uncertain: false, }); } }; @@ -67,61 +64,10 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) { } }; - const confirmDisable = (version: string) => { - showModal( - void runExtensionOperation(version, false)} - onCancel={() => {}} - />, - ); - }; - const handleExtensionToggle = (version: string, enabled: boolean) => { - const installed = status.installed_branches.includes(version); - const owned = status.owned_branches.includes(version); - if (!enabled && installed && !owned) { - showErrorToast( - "Flatpak runtime preserved", - `${version} was not installed by this plugin, so it will remain installed.`, - ); - void refresh(); - return; - } - if (!enabled && installed && owned) { - confirmDisable(version); - return; - } void runExtensionOperation(version, enabled); }; - const confirmCleanup = () => { - showModal( - { - setOperation("cleanup"); - try { - const result = await removePluginOwnedFlatpakExtensions(); - if (!result.success) throw new Error(result.error || result.message || "Flatpak cleanup failed"); - await refresh(); - } catch (error) { - showErrorToast("Flatpak cleanup failed", String(error)); - } finally { - setOperation(null); - } - }} - onCancel={() => {}} - />, - ); - }; - return ( @@ -147,31 +93,15 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) { : operation === `disable-${branch}` ? "Uninstalling..." : status.installed_branches.includes(branch) - ? status.owned_branches.includes(branch) - ? "Installed · plugin-owned" - : "Installed · pre-existing (preserved)" + ? "Installed" : "Not installed" } checked={status.installed_branches.includes(branch)} onChange={(enabled) => handleExtensionToggle(branch, enabled)} - disabled={operation !== null || status.ownership_uncertain} + disabled={operation !== null} /> ))} - {status.ownership_uncertain && ( - - - - )} - - - {operation === "cleanup" ? "Removing..." : "Remove plugin-installed extensions"} - - )} -- cgit v1.2.3