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

Cleanup platform checks. Remove old code. #3477

Merged
merged 8 commits into from
Jan 29, 2024
Merged

Conversation

arielj
Copy link
Collaborator

@arielj arielj commented Jan 28, 2024

This PR does 3 cleanup/refactor tasks:

  • remove some code that is not really needed anymore (I'll add comments in the diff)
  • use isWindows/Linux/Mac constants when possible instead of process.platform or platform()
  • expose the platform name in the preload file so we don't need the extra IPC calls to get that info

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@arielj arielj added the pr:ready-for-review Feature-complete, ready for the grind! :P label Jan 28, 2024
@arielj arielj requested review from a team, flavioislima, CommandMC, Etaash-mathamsetty, Nocccer and imLinguin and removed request for a team January 28, 2024 16:34
const platform = await page.evaluate(async () => window.api.getPlatform())
console.log('Platform: ', platform)
expect(platform).toEqual(process.platform)
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this test because I removed the getPlatform function, that info is now exposed in the preload.ts file so we don't need an extra call to the backend

await libraryManagerMap['legendary'].refresh()
return LegendaryLibraryManager.getListOfGames()
}
const userInfo = await LegendaryUser.getUserInfo()
const userInfo = LegendaryUser.getUserInfo()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this await was not needed, the linter was flagging it

ipcMain.handle('readConfig', async (event, config_class) => {
if (config_class === 'library') {
ipcMain.handle('readConfig', async (event, configClass) => {
if (configClass === 'library') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to follow conventions

@@ -696,19 +696,6 @@ export async function getInstallInfo(
}
}
installInfoStore.set(installInfoStoreKey, info)
if (!info) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few lines above we do const info = { ..... }, I couldn't find any way this could be false since it's defined right before this line

@@ -115,26 +115,6 @@ export class GOGUser {
return JSON.parse(stdout)
}

/**
* Migrates existing authorization config to one supported by gogdl
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked with linguin, we don't need this anymore, it was here temporarily to migrate credentials over a few releases

if (isWindows) {
detectVCRedist(mainWindow)
}
detectVCRedist(mainWindow)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detectVCRedist already checks if isWindows inside the function

if (!currentConfigStore?.defaultInstallPath) {
configStore.set('settings', settings)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not needed anymore

Copy link
Member

@flavioislima flavioislima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arielj arielj merged commit 9551fd9 into main Jan 29, 2024
9 checks passed
@arielj arielj deleted the platform-cleanup-remove-todos branch January 29, 2024 22:00
@Heroic-Games-Launcher Heroic-Games-Launcher locked and limited conversation to collaborators Jan 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants