@@ -9,7 +9,7 @@ import { AuthService } from "../auth/service.js";
99import { ControlUpdateWindowsPlatformService } from "../updater/services/windows/control-update.js" ;
1010import { TrayService } from "../tray/service.js" ;
1111import { destroyWindows } from "../@core/control-window/destroy.js" ;
12- import { ipcWebContentsSend , isDev } from "../$shared/utils.js" ;
12+ import { ipcMainOn , ipcWebContentsSend , isDev } from "../$shared/utils.js" ;
1313import { menu } from "../config.js" ;
1414
1515@WindowManager < TWindows [ "main" ] > ( {
@@ -48,6 +48,7 @@ export class AppWindow implements TWindowManager {
4848 this . buildMenu ( window ) ;
4949 this . buildTray ( window ) ;
5050 this . checkAuthenticated ( window ) ;
51+ this . ipcCheckSync ( window ) ;
5152 this . authService . setCheckAccessInterval ( window ) ;
5253
5354 const userId = getElectronStorage ( "userId" ) ;
@@ -58,14 +59,25 @@ export class AppWindow implements TWindowManager {
5859 }
5960 }
6061
61- private async checkAuthenticated ( window : BrowserWindow ) {
62- const result = await this . authService . checkAuthenticated ( window ) ;
63- ipcWebContentsSend ( "authSocialNetwork" , window . webContents , {
64- isAuthenticated :
65- result !== undefined && result . isAuthenticated !== undefined ,
62+ private ipcCheckSync ( window : BrowserWindow ) : void {
63+ ipcMainOn ( "sync" , ( event ) => {
64+ const result = this . authService . checkAuthenticated ( window ) ;
65+
66+ event . reply ( "sync" , {
67+ isAuthenticated : result !== undefined && result . isAuthenticated ,
68+ } ) ;
6669 } ) ;
6770 }
6871
72+ private async checkAuthenticated ( window : BrowserWindow ) {
73+ const result = this . authService . checkAuthenticated ( window ) ;
74+ if ( result !== undefined && result . isAuthenticated !== undefined ) {
75+ ipcWebContentsSend ( "authSocialNetwork" , window . webContents , {
76+ isAuthenticated : result . isAuthenticated ,
77+ } ) ;
78+ }
79+ }
80+
6981 private buildTray ( window : BrowserWindow ) : void {
7082 this . trayService . buildTray (
7183 this . trayService . trayMenu . map ( ( item ) => {
0 commit comments