Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UX] Show tab and message when Cloud Saves are not supported #4280

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,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 @@ -77,8 +77,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 @@ -156,7 +156,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
Loading