From c882f2f8283b57cec241d78adf617cdfda04baa5 Mon Sep 17 00:00:00 2001 From: Ariel Juodziukynas Date: Sat, 1 Mar 2025 14:27:49 -0300 Subject: [PATCH] [UX] Show tab and message when Cloud Saves are not supported (#4280) --- public/locales/en/translation.json | 2 ++ .../Settings/sections/GamesSettings/index.tsx | 6 ++--- .../Settings/sections/SyncSaves/gog.tsx | 26 +++++++++++++++++-- .../Settings/sections/SyncSaves/index.tsx | 5 +++- .../Settings/sections/SyncSaves/legendary.tsx | 17 ++++++++++-- 5 files changed, 48 insertions(+), 8 deletions(-) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index a7bd93e96f..56a864c10b 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -827,6 +827,8 @@ "open-config-file": "Open Config File", "reset-heroic": "Reset Heroic", "saves": { + "gog_linux_native_warning": "Linux native games do not support GOG's Cloud Saves feature. Use the Windows version instead.", + "not_supported": "This game does not support Cloud Saves.", "warning": "Cloud Saves feature is in Beta, please backup your saves before syncing (in case something goes wrong)" }, "systemInformation": { diff --git a/src/frontend/screens/Settings/sections/GamesSettings/index.tsx b/src/frontend/screens/Settings/sections/GamesSettings/index.tsx index 9e690fd08e..d2bd6a1d03 100644 --- a/src/frontend/screens/Settings/sections/GamesSettings/index.tsx +++ b/src/frontend/screens/Settings/sections/GamesSettings/index.tsx @@ -78,8 +78,8 @@ export default function GamesSettings() { const isWin = platform === 'win32' const isMac = platform === 'darwin' const isCrossover = wineVersion?.type === 'crossover' - const hasCloudSaves = - gameInfo?.cloud_save_enabled && gameInfo.install.platform !== 'linux' + const showCloudSavesTab = + gameInfo?.runner === 'gog' || gameInfo?.runner === 'legendary' const isBrowserGame = gameInfo?.install.platform === 'Browser' const isSideloaded = gameInfo?.runner === 'sideload' @@ -157,7 +157,7 @@ export default function GamesSettings() { value="advanced" /> - {hasCloudSaves && ( + {showCloudSavesTab && ( void syncCommands: { name: string; value: string }[] + featureSupported: boolean + isLinuxNative: boolean } export default function GOGSyncSaves({ @@ -28,7 +30,9 @@ export default function GOGSyncSaves({ setGogSaves, autoSyncSaves, setAutoSyncSaves, - syncCommands + syncCommands, + featureSupported, + isLinuxNative }: Props) { const [isLoading, setIsLoading] = useState(true) const [isSyncing, setIsSyncing] = useState(false) @@ -67,7 +71,7 @@ export default function GOGSyncSaves({ setIsSyncing(false) setIsLoading(false) } - getLocations() + if (featureSupported && !isLinuxNative) getLocations() }, [retry]) const handleRetry = () => { @@ -88,6 +92,24 @@ export default function GOGSyncSaves({ setIsSyncing(false) } + if (isLinuxNative || !featureSupported) { + return ( +
+ {isLinuxNative && + t( + 'settings.saves.gog_linux_native_warning', + "Linux native games do not support GOG's Cloud Saves feature. Use the Windows version instead." + )} +
+ {!featureSupported && + t( + 'settings.saves.not_supported', + 'Cloud Saves are not supported by this game.' + )} +
+ ) + } + return ( <> {manuallyOutputShow && ( diff --git a/src/frontend/screens/Settings/sections/SyncSaves/index.tsx b/src/frontend/screens/Settings/sections/SyncSaves/index.tsx index 5e4bc4640c..1a29ae2887 100644 --- a/src/frontend/screens/Settings/sections/SyncSaves/index.tsx +++ b/src/frontend/screens/Settings/sections/SyncSaves/index.tsx @@ -9,7 +9,7 @@ import LegendarySyncSaves from './legendary' const SyncSaves = () => { const { t } = useTranslation() - const { runner } = useContext(SettingsContext) + const { runner, gameInfo } = useContext(SettingsContext) const { platform } = useContext(ContextProvider) const isWin = platform === 'win32' @@ -32,6 +32,7 @@ const SyncSaves = () => { if (runner === 'legendary') { return ( { if (runner === 'gog') { return ( void winePrefix?: string syncCommands: { name: string; value: string }[] + featureSupported: boolean } export default function LegendarySyncSaves({ @@ -32,7 +33,8 @@ export default function LegendarySyncSaves({ setAutoSyncSaves, isProton, winePrefix, - syncCommands + syncCommands, + featureSupported }: Props) { const [isSyncing, setIsSyncing] = useState(false) const [isLoading, setLoading] = useState(false) @@ -60,7 +62,7 @@ export default function LegendarySyncSaves({ setLoading(false) setRetry(false) } - setDefaultSaveFolder() + if (featureSupported) setDefaultSaveFolder() }, [winePrefix, isProton, retry]) async function handleSync() { @@ -75,6 +77,17 @@ export default function LegendarySyncSaves({ setIsSyncing(false) } + if (!featureSupported) { + return ( +
+ {t( + 'settings.saves.not_supported', + 'This game does not support Cloud Saves.' + )} +
+ ) + } + return ( <> {manuallyOutputShow && (