-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
Changes from 6 commits
e9cf8b3
2dfebf4
fa35810
7b3a2cf
8ce6bc8
7fdea22
8a1bfda
5723db4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ import { | |
} from 'electron' | ||
import 'backend/updater' | ||
import { autoUpdater } from 'electron-updater' | ||
import { cpus, platform } from 'os' | ||
import { cpus } from 'os' | ||
import { | ||
access, | ||
constants, | ||
|
@@ -94,7 +94,9 @@ import { | |
createNecessaryFolders, | ||
fixAsarPath, | ||
isSnap, | ||
fixesPath | ||
fixesPath, | ||
isWindows, | ||
isMac | ||
} from './constants' | ||
import { handleProtocol } from './protocol' | ||
import { | ||
|
@@ -160,7 +162,6 @@ import { storeMap } from 'common/utils' | |
app.commandLine?.appendSwitch('ozone-platform-hint', 'auto') | ||
|
||
const { showOpenDialog } = dialog | ||
const isWindows = platform() === 'win32' | ||
|
||
async function initializeWindow(): Promise<BrowserWindow> { | ||
createNecessaryFolders() | ||
|
@@ -234,9 +235,7 @@ async function initializeWindow(): Promise<BrowserWindow> { | |
handleExit() | ||
}) | ||
|
||
if (isWindows) { | ||
detectVCRedist(mainWindow) | ||
} | ||
detectVCRedist(mainWindow) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
if (process.env.VITE_DEV_SERVER_URL) { | ||
if (!process.env.HEROIC_NO_REACT_DEVTOOLS) { | ||
|
@@ -430,7 +429,6 @@ if (!gotTheLock) { | |
] | ||
}) | ||
|
||
GOGUser.migrateCredentialsConfig() | ||
const mainWindow = await initializeWindow() | ||
|
||
protocol.handle('heroic', (request) => { | ||
|
@@ -637,7 +635,7 @@ ipcMain.on('quit', async () => handleExit()) | |
// for applications and their menu bar to stay active until the user quits | ||
// explicitly with Cmd + Q. | ||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
if (!isMac) { | ||
app.quit() | ||
} | ||
}) | ||
|
@@ -709,8 +707,6 @@ ipcMain.handle('isFlatpak', () => isFlatpak) | |
ipcMain.handle('getGameOverride', async () => getGameOverride()) | ||
ipcMain.handle('getGameSdl', async (event, appName) => getGameSdl(appName)) | ||
|
||
ipcMain.handle('getPlatform', () => process.platform) | ||
|
||
ipcMain.handle('showUpdateSetting', () => !isFlatpak) | ||
|
||
ipcMain.handle('getLatestReleases', async () => { | ||
|
@@ -831,12 +827,12 @@ ipcMain.handle('getAlternativeWine', async () => | |
GlobalConfig.get().getAlternativeWine() | ||
) | ||
|
||
ipcMain.handle('readConfig', async (event, config_class) => { | ||
if (config_class === 'library') { | ||
ipcMain.handle('readConfig', async (event, configClass) => { | ||
if (configClass === 'library') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just to follow conventions |
||
await libraryManagerMap['legendary'].refresh() | ||
return LegendaryLibraryManager.getListOfGames() | ||
} | ||
const userInfo = await LegendaryUser.getUserInfo() | ||
const userInfo = LegendaryUser.getUserInfo() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this await was not needed, the linter was flagging it |
||
return userInfo?.displayName ?? '' | ||
}) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -696,19 +696,6 @@ export async function getInstallInfo( | |
} | ||
} | ||
installInfoStore.set(installInfoStoreKey, info) | ||
if (!info) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a few lines above we do |
||
logWarning( | ||
[ | ||
'Failed to get Install Info for', | ||
`${appName}`, | ||
`using ${installPlatform} as platform,`, | ||
'returning empty object' | ||
], | ||
LogPrefix.Gog | ||
) | ||
// @ts-expect-error TODO: Handle this better | ||
return {} | ||
} | ||
return info | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import axios from 'axios' | ||
import { writeFileSync, existsSync, unlinkSync } from 'graceful-fs' | ||
import { existsSync, unlinkSync } from 'graceful-fs' | ||
import { logError, logInfo, LogPrefix, logWarning } from '../../logger/logger' | ||
import { GOGLoginData } from 'common/types' | ||
import { configStore } from './electronStores' | ||
|
@@ -115,26 +115,6 @@ export class GOGUser { | |
return JSON.parse(stdout) | ||
} | ||
|
||
/** | ||
* Migrates existing authorization config to one supported by gogdl | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
*/ | ||
public static migrateCredentialsConfig() { | ||
if (!configStore.has('credentials')) { | ||
return | ||
} | ||
|
||
const credentials = configStore.get_nodefault('credentials') | ||
if (credentials?.loginTime) | ||
credentials.loginTime = credentials?.loginTime / 1000 | ||
|
||
writeFileSync( | ||
gogdlAuthConfig, | ||
JSON.stringify({ '46899977096215655': credentials }) | ||
) | ||
configStore.delete('credentials') | ||
configStore.set('isLoggedIn', true) | ||
} | ||
|
||
public static logout() { | ||
clearCache('gog') | ||
configStore.clear() | ||
|
There was a problem hiding this comment.
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