Merge pull request #13747 from desktop/Refactor-getAppArchitecture(remote.app)-to-main-process

Refactor `getArchitecture(remote.app)` to main process
This commit is contained in:
tidy-dev 2022-01-28 11:05:30 -05:00 committed by GitHub
commit 64acbb750a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View file

@ -9,6 +9,7 @@ import { WindowState } from './window-state'
import { IMenu } from '../models/app-menu'
import { ILaunchStats } from './stats'
import { URLActionType } from './parse-app-url'
import { Architecture } from './get-architecture'
import { EndpointToken } from './endpoint-token'
/**
@ -81,6 +82,7 @@ export type RequestChannels = {
* Return signatures must be promises
*/
export type RequestResponseChannels = {
'get-app-architecture': () => Promise<Architecture>
'move-to-trash': (path: string) => Promise<void>
'show-contextual-menu': (
items: ReadonlyArray<ISerializableMenuItem>

View file

@ -22,8 +22,8 @@ import {
} from '../local-storage'
import { PushOptions } from '../git'
import { getShowSideBySideDiff } from '../../ui/lib/diff-mode'
import * as remote from '@electron/remote'
import { Architecture, getArchitecture } from '../get-architecture'
import { getAppArchitecture } from '../../ui/main-process-proxy'
import { Architecture } from '../get-architecture'
import { MultiCommitOperationKind } from '../../models/multi-commit-operation'
import { isInApplicationFolder } from '../../ui/main-process-proxy'
@ -523,7 +523,7 @@ export class StatsStore implements IStatsStore {
version: getVersion(),
osVersion: getOS(),
platform: process.platform,
architecture: getArchitecture(remote.app),
architecture: await getAppArchitecture(),
theme: getPersistedThemeName(),
selectedTerminalEmulator,
selectedTextEditor,

View file

@ -28,6 +28,7 @@ import { installAuthenticatedAvatarFilter } from './authenticated-avatar-filter'
import { installAliveOriginFilter } from './alive-origin-filter'
import { installSameOriginFilter } from './same-origin-filter'
import * as ipcMain from './ipc-main'
import { getArchitecture } from '../lib/get-architecture'
import * as remoteMain from '@electron/remote/main'
remoteMain.initialize()
@ -519,6 +520,11 @@ app.on('ready', () => {
}
})
/**
* An event sent by the renderer asking for the app's architecture
*/
ipcMain.handle('get-app-architecture', async () => getArchitecture(app))
/**
* An event sent by the renderer asking to move the app to the application
* folder

View file

@ -164,6 +164,11 @@ export const showCertificateTrustDialog = sendProxy(
2
)
/**
* Tell the main process to obtain the applications architecture
*/
export const getAppArchitecture = invokeProxy('get-app-architecture', 0)
/**
* Tell the main process that we're going to quit. This means it should allow
* the window to close.