1- import { app , BrowserWindow , shell } from "electron " ;
1+ import type { IDevHostActions } from "@posthog/platform/dev-host-actions " ;
22import { inject , injectable } from "inversify" ;
33import { MAIN_TOKENS } from "../../di/tokens" ;
44import { getUserDataDir } from "../../utils/env" ;
@@ -20,33 +20,32 @@ export class DevActionsService extends TypedEventEmitter<DevActionsEvents> {
2020 constructor (
2121 @inject ( MAIN_TOKENS . DevNetworkService )
2222 private readonly network : DevNetworkService ,
23+ @inject ( MAIN_TOKENS . DevHostActions )
24+ private readonly host : IDevHostActions ,
2325 ) {
2426 super ( ) ;
2527 }
2628
2729 async openUserDataDir ( ) : Promise < void > {
28- await shell . openPath ( getUserDataDir ( ) ) ;
30+ await this . host . openPath ( getUserDataDir ( ) ) ;
2931 }
3032
3133 async openLogFile ( ) : Promise < void > {
32- await shell . openPath ( getLogFilePath ( ) ) ;
34+ await this . host . openPath ( getLogFilePath ( ) ) ;
3335 }
3436
3537 reloadRenderer ( ) : void {
36- for ( const window of BrowserWindow . getAllWindows ( ) ) {
37- window . webContents . reload ( ) ;
38- }
38+ this . host . reloadAllWindows ( ) ;
3939 }
4040
4141 restartMain ( ) : void {
4242 log . warn ( "Restarting main process from dev toolbar" ) ;
43- app . relaunch ( ) ;
44- app . exit ( 0 ) ;
43+ this . host . relaunch ( ) ;
4544 }
4645
4746 crashMain ( ) : void {
4847 log . warn ( "Crashing main process from dev toolbar" ) ;
49- process . crash ( ) ;
48+ this . host . crash ( ) ;
5049 }
5150
5251 triggerToast ( variant : "info" | "error" , message : string ) : DevToast {
0 commit comments