Skip to content

Commit

Permalink
[UX] Show tab and message when Cloud Saves are not supported (#4280)
Browse files Browse the repository at this point in the history
  • Loading branch information
arielj authored Mar 1, 2025
1 parent abe3e08 commit c882f2f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 8 deletions.
2 changes: 2 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -157,7 +157,7 @@ export default function GamesSettings() {
value="advanced"
/>

{hasCloudSaves && (
{showCloudSavesTab && (
<Tab
label={t('settings.navbar.sync', 'Cloud Saves Sync')}
value="saves"
Expand Down
26 changes: 24 additions & 2 deletions src/frontend/screens/Settings/sections/SyncSaves/gog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ interface Props {
autoSyncSaves: boolean
setAutoSyncSaves: (value: boolean) => void
syncCommands: { name: string; value: string }[]
featureSupported: boolean
isLinuxNative: boolean
}

export default function GOGSyncSaves({
gogSaves,
setGogSaves,
autoSyncSaves,
setAutoSyncSaves,
syncCommands
syncCommands,
featureSupported,
isLinuxNative
}: Props) {
const [isLoading, setIsLoading] = useState(true)
const [isSyncing, setIsSyncing] = useState(false)
Expand Down Expand Up @@ -67,7 +71,7 @@ export default function GOGSyncSaves({
setIsSyncing(false)
setIsLoading(false)
}
getLocations()
if (featureSupported && !isLinuxNative) getLocations()
}, [retry])

const handleRetry = () => {
Expand All @@ -88,6 +92,24 @@ export default function GOGSyncSaves({
setIsSyncing(false)
}

if (isLinuxNative || !featureSupported) {
return (
<div style={{ color: 'red' }}>
{isLinuxNative &&
t(
'settings.saves.gog_linux_native_warning',
"Linux native games do not support GOG's Cloud Saves feature. Use the Windows version instead."
)}
<br />
{!featureSupported &&
t(
'settings.saves.not_supported',
'Cloud Saves are not supported by this game.'
)}
</div>
)
}

return (
<>
{manuallyOutputShow && (
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/screens/Settings/sections/SyncSaves/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -32,6 +32,7 @@ const SyncSaves = () => {
if (runner === 'legendary') {
return (
<LegendarySyncSaves
featureSupported={!!gameInfo?.cloud_save_enabled}
savesPath={savesPath}
setSavesPath={setSavesPath}
autoSyncSaves={autoSyncSaves}
Expand All @@ -46,6 +47,8 @@ const SyncSaves = () => {
if (runner === 'gog') {
return (
<GOGSyncSaves
featureSupported={!!gameInfo?.cloud_save_enabled}
isLinuxNative={gameInfo?.install.platform === 'linux'}
gogSaves={gogSavesLocations}
setGogSaves={setGogSavesLocations}
autoSyncSaves={autoSyncSaves}
Expand Down
17 changes: 15 additions & 2 deletions src/frontend/screens/Settings/sections/SyncSaves/legendary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface Props {
setSavesPath: (value: string) => void
winePrefix?: string
syncCommands: { name: string; value: string }[]
featureSupported: boolean
}

export default function LegendarySyncSaves({
Expand All @@ -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)
Expand Down Expand Up @@ -60,7 +62,7 @@ export default function LegendarySyncSaves({
setLoading(false)
setRetry(false)
}
setDefaultSaveFolder()
if (featureSupported) setDefaultSaveFolder()
}, [winePrefix, isProton, retry])

async function handleSync() {
Expand All @@ -75,6 +77,17 @@ export default function LegendarySyncSaves({
setIsSyncing(false)
}

if (!featureSupported) {
return (
<div style={{ color: 'red' }}>
{t(
'settings.saves.not_supported',
'This game does not support Cloud Saves.'
)}
</div>
)
}

return (
<>
{manuallyOutputShow && (
Expand Down

0 comments on commit c882f2f

Please sign in to comment.