Repository navigation
fix: clear GOG presence when disabling the setting - #5472
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
While this fixes the basic problem, I think we should have a better solution that calls deletePresence as soon as we turn that off (now we still have the issue that when the presence is set, it's going to still show the presence even after disabling it until you close heroic). A better solution would be to:
it would require listening to the config changed events and a bit of logic changes, but I think it will be a better fix, since the change in this PR solves only one of the different things listed in that issue |
83276fa to
acd1994
Compare
|
@arielj Thanks for the thorough review! You're right — my initial fix only addressed the symptom. I've updated the PR to handle all 4 scenarios:
The approach follows the existing pattern used by Please take another look when you get a chance. |
| import { app } from 'electron' | ||
| import { GOGUser } from './user' | ||
| import { isOnline } from 'backend/online_monitor' | ||
| import { GlobalConfig } from 'backend/config' |
There was a problem hiding this comment.
Don't rearrange these things, it adds noise to the PR to not know at first glance what's an actual change and what's just reordering. Reordering is not needed.
I imagine this is made by AI, please don't just push any change made by AI, cleanup the changes and only send the minimal changes needed. Don't throw the burden of cleaning the AI generated code to the reviewers.
| GlobalConfig.get().getSettings() | ||
| if ( | ||
| disablePlaytimeSync || | ||
| disableGOGPresence || |
There was a problem hiding this comment.
removing this check would result in heroic always trying to delete the gog presence, even when not needed at all every time heroic is closed, we shouldn't do that (it executes the gogdl binary to check for auth information and makes a request to gog even when not needed)
instead, maybe add a new optional parameter to the deletePresence function to be able force the call even if the presence is turned off and pass true when the deletePresence function is called when the setting changes instead of removing this check
|
@arielj Good points, both addressed in the latest push:
Also fixed a latent bug where |
|
Thanks for the feedback @arielj — good catches, both. Condition reordering: Fixed. The guard now stays at its original position, just wrapped inline with Unrelated The force parameter approach you suggested is exactly right — existing callers keep their guard, only the |
Listen to backendEvents.settingChanged to clear/set GOG presence when the user toggles disableGOGPresence in settings. - Add force parameter to deletePresence to bypass disableGOGPresence guard when called from the setting toggle (avoids unnecessary GOG API calls on shutdown when presence is already off) - Preserves existing guards on normal (non-forced) deletePresence calls Closes Heroic-Games-Launcher#5443
d03ba7d to
a117441
Compare
| } | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
there's an extra new line here, remove that please so it's not changed for other people in the future if they touch this file
|
@reverb256, the lint job keeps complaining about style issues https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/actions/runs/24394668774/job/71249342911 do you have the pre-commit hooks configured to run the prettier checks before pushing code to github? do not skip that |
|
Thanks for the review @arielj! I've cleaned up the PR:
The full diff should now be minimal — just the |
|
thanks, it works fine next time PLEASE answer like a person and not just with AI generated output, I don't like talking to an AI |
Problem
When
Disable GOG Presence updatesis enabled and the app is closed, the user still shows as Online on gog.com. The presence is never cleared.Root Cause
deletePresence()insrc/backend/storeManagers/gog/presence.tshas adisableGOGPresenceguard that causes it to return early when the setting is enabled — exactly when presence needs to be deleted.Fix
Removed the
disableGOGPresencecheck fromdeletePresence(). ThedisablePlaytimeSync,isLoggedIn(), andisOnline()guards remain as valid reasons to skip the API call.Closes #5443