mirror of
https://github.com/desktop/desktop
synced 2024-10-03 23:03:52 +00:00
Await moveToApplicationsFolder invocation on main process
This commit is contained in:
parent
ab48d526da
commit
fa75ab567d
|
@ -72,7 +72,6 @@ export type RequestChannels = {
|
|||
'auto-updater-update-downloaded': () => void
|
||||
'native-theme-updated': () => void
|
||||
'set-native-theme-source': (themeName: ThemeSource) => void
|
||||
'move-to-applications-folder': () => void
|
||||
'focus-window': () => void
|
||||
}
|
||||
|
||||
|
@ -97,6 +96,7 @@ export type RequestResponseChannels = {
|
|||
'is-window-focused': () => Promise<boolean>
|
||||
'open-external': (path: string) => Promise<boolean>
|
||||
'is-in-application-folder': () => Promise<boolean | null>
|
||||
'move-to-applications-folder': () => Promise<void>
|
||||
'check-for-updates': (url: string) => Promise<Error | undefined>
|
||||
'get-current-window-state': () => Promise<WindowState | undefined>
|
||||
'get-current-window-zoom-factor': () => Promise<number | undefined>
|
||||
|
|
|
@ -576,7 +576,7 @@ app.on('ready', () => {
|
|||
* An event sent by the renderer asking to move the app to the application
|
||||
* folder
|
||||
*/
|
||||
ipcMain.on('move-to-applications-folder', () => {
|
||||
ipcMain.handle('move-to-applications-folder', async () => {
|
||||
app.moveToApplicationsFolder?.()
|
||||
})
|
||||
|
||||
|
|
|
@ -1375,8 +1375,9 @@ export class Dispatcher {
|
|||
return this.appStore.setStatsOptOut(optOut, userViewedPrompt)
|
||||
}
|
||||
|
||||
/** Moves the app to the /Applications folder on macOS. */
|
||||
public moveToApplicationsFolder() {
|
||||
moveToApplicationsFolder()
|
||||
return moveToApplicationsFolder()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -217,7 +217,7 @@ export function sendWillQuitSync() {
|
|||
/**
|
||||
* Tell the main process to move the application to the application folder
|
||||
*/
|
||||
export const moveToApplicationsFolder = sendProxy(
|
||||
export const moveToApplicationsFolder = invokeProxy(
|
||||
'move-to-applications-folder',
|
||||
0
|
||||
)
|
||||
|
|
|
@ -97,11 +97,11 @@ export class MoveToApplicationsFolder extends React.Component<
|
|||
)
|
||||
}
|
||||
|
||||
private onSubmit = () => {
|
||||
private onSubmit = async () => {
|
||||
this.props.onDismissed()
|
||||
|
||||
try {
|
||||
this.props.dispatcher.moveToApplicationsFolder()
|
||||
await this.props.dispatcher.moveToApplicationsFolder()
|
||||
} catch (error) {
|
||||
this.props.dispatcher.postError(error)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue