Skip to content

Commit c882f2f

Browse files
authored
[UX] Show tab and message when Cloud Saves are not supported (#4280)
1 parent abe3e08 commit c882f2f

File tree

5 files changed

+48
-8
lines changed

5 files changed

+48
-8
lines changed

public/locales/en/translation.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,8 @@
827827
"open-config-file": "Open Config File",
828828
"reset-heroic": "Reset Heroic",
829829
"saves": {
830+
"gog_linux_native_warning": "Linux native games do not support GOG's Cloud Saves feature. Use the Windows version instead.",
831+
"not_supported": "This game does not support Cloud Saves.",
830832
"warning": "Cloud Saves feature is in Beta, please backup your saves before syncing (in case something goes wrong)"
831833
},
832834
"systemInformation": {

src/frontend/screens/Settings/sections/GamesSettings/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export default function GamesSettings() {
7878
const isWin = platform === 'win32'
7979
const isMac = platform === 'darwin'
8080
const isCrossover = wineVersion?.type === 'crossover'
81-
const hasCloudSaves =
82-
gameInfo?.cloud_save_enabled && gameInfo.install.platform !== 'linux'
81+
const showCloudSavesTab =
82+
gameInfo?.runner === 'gog' || gameInfo?.runner === 'legendary'
8383
const isBrowserGame = gameInfo?.install.platform === 'Browser'
8484
const isSideloaded = gameInfo?.runner === 'sideload'
8585

@@ -157,7 +157,7 @@ export default function GamesSettings() {
157157
value="advanced"
158158
/>
159159

160-
{hasCloudSaves && (
160+
{showCloudSavesTab && (
161161
<Tab
162162
label={t('settings.navbar.sync', 'Cloud Saves Sync')}
163163
value="saves"

src/frontend/screens/Settings/sections/SyncSaves/gog.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ interface Props {
2121
autoSyncSaves: boolean
2222
setAutoSyncSaves: (value: boolean) => void
2323
syncCommands: { name: string; value: string }[]
24+
featureSupported: boolean
25+
isLinuxNative: boolean
2426
}
2527

2628
export default function GOGSyncSaves({
2729
gogSaves,
2830
setGogSaves,
2931
autoSyncSaves,
3032
setAutoSyncSaves,
31-
syncCommands
33+
syncCommands,
34+
featureSupported,
35+
isLinuxNative
3236
}: Props) {
3337
const [isLoading, setIsLoading] = useState(true)
3438
const [isSyncing, setIsSyncing] = useState(false)
@@ -67,7 +71,7 @@ export default function GOGSyncSaves({
6771
setIsSyncing(false)
6872
setIsLoading(false)
6973
}
70-
getLocations()
74+
if (featureSupported && !isLinuxNative) getLocations()
7175
}, [retry])
7276

7377
const handleRetry = () => {
@@ -88,6 +92,24 @@ export default function GOGSyncSaves({
8892
setIsSyncing(false)
8993
}
9094

95+
if (isLinuxNative || !featureSupported) {
96+
return (
97+
<div style={{ color: 'red' }}>
98+
{isLinuxNative &&
99+
t(
100+
'settings.saves.gog_linux_native_warning',
101+
"Linux native games do not support GOG's Cloud Saves feature. Use the Windows version instead."
102+
)}
103+
<br />
104+
{!featureSupported &&
105+
t(
106+
'settings.saves.not_supported',
107+
'Cloud Saves are not supported by this game.'
108+
)}
109+
</div>
110+
)
111+
}
112+
91113
return (
92114
<>
93115
{manuallyOutputShow && (

src/frontend/screens/Settings/sections/SyncSaves/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import LegendarySyncSaves from './legendary'
99

1010
const SyncSaves = () => {
1111
const { t } = useTranslation()
12-
const { runner } = useContext(SettingsContext)
12+
const { runner, gameInfo } = useContext(SettingsContext)
1313
const { platform } = useContext(ContextProvider)
1414
const isWin = platform === 'win32'
1515

@@ -32,6 +32,7 @@ const SyncSaves = () => {
3232
if (runner === 'legendary') {
3333
return (
3434
<LegendarySyncSaves
35+
featureSupported={!!gameInfo?.cloud_save_enabled}
3536
savesPath={savesPath}
3637
setSavesPath={setSavesPath}
3738
autoSyncSaves={autoSyncSaves}
@@ -46,6 +47,8 @@ const SyncSaves = () => {
4647
if (runner === 'gog') {
4748
return (
4849
<GOGSyncSaves
50+
featureSupported={!!gameInfo?.cloud_save_enabled}
51+
isLinuxNative={gameInfo?.install.platform === 'linux'}
4952
gogSaves={gogSavesLocations}
5053
setGogSaves={setGogSavesLocations}
5154
autoSyncSaves={autoSyncSaves}

src/frontend/screens/Settings/sections/SyncSaves/legendary.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface Props {
2323
setSavesPath: (value: string) => void
2424
winePrefix?: string
2525
syncCommands: { name: string; value: string }[]
26+
featureSupported: boolean
2627
}
2728

2829
export default function LegendarySyncSaves({
@@ -32,7 +33,8 @@ export default function LegendarySyncSaves({
3233
setAutoSyncSaves,
3334
isProton,
3435
winePrefix,
35-
syncCommands
36+
syncCommands,
37+
featureSupported
3638
}: Props) {
3739
const [isSyncing, setIsSyncing] = useState(false)
3840
const [isLoading, setLoading] = useState(false)
@@ -60,7 +62,7 @@ export default function LegendarySyncSaves({
6062
setLoading(false)
6163
setRetry(false)
6264
}
63-
setDefaultSaveFolder()
65+
if (featureSupported) setDefaultSaveFolder()
6466
}, [winePrefix, isProton, retry])
6567

6668
async function handleSync() {
@@ -75,6 +77,17 @@ export default function LegendarySyncSaves({
7577
setIsSyncing(false)
7678
}
7779

80+
if (!featureSupported) {
81+
return (
82+
<div style={{ color: 'red' }}>
83+
{t(
84+
'settings.saves.not_supported',
85+
'This game does not support Cloud Saves.'
86+
)}
87+
</div>
88+
)
89+
}
90+
7891
return (
7992
<>
8093
{manuallyOutputShow && (

0 commit comments

Comments
 (0)