File tree Expand file tree Collapse file tree 5 files changed +20
-9
lines changed
Expand file tree Collapse file tree 5 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -269,8 +269,18 @@ export function registerIpcEvents() {
269269 }
270270 } )
271271
272+ ipcMain . on ( IPC_EVENTS . PHONE_ISLAND_READY , ( ) => {
273+ Log . info ( 'PhoneIsland is ready to receive events' )
274+ const account = store . get ( 'account' ) as Account
275+
276+ setTimeout ( ( ) => {
277+ Log . info ( 'Send CHANGE_PREFERRED_DEVICES event with' , account . preferredDevices )
278+ PhoneIslandController . instance . window . emit ( IPC_EVENTS . CHANGE_PREFERRED_DEVICES , account . preferredDevices )
279+ } , 250 )
280+ } )
281+
272282 ipcMain . on ( IPC_EVENTS . CHANGE_PREFERRED_DEVICES , ( _ , devices ) => {
273- Log . info ( 'CHANGE_PREFERRED_DEVICES:' , devices )
283+ Log . info ( 'Received CHANGE_PREFERRED_DEVICES in ipcEvents :' , devices )
274284 AccountController . instance . updatePreferredDevice ( devices )
275285 PhoneIslandController . instance . window . emit ( IPC_EVENTS . CHANGE_PREFERRED_DEVICES , devices )
276286 } )
Original file line number Diff line number Diff line change @@ -682,12 +682,6 @@ async function createNethLink(show: boolean = true) {
682682 checkForUpdate ( )
683683 const account = store . get ( 'account' ) as Account
684684 if ( account ) {
685- // read preffered devices for phone-island
686- Log . info ( "Preferred devices readed:" , account . preferredDevices )
687- if ( account . preferredDevices ) {
688- ipcMain . emit ( IPC_EVENTS . CHANGE_PREFERRED_DEVICES , undefined , account . preferredDevices )
689- }
690-
691685 // read shortcut from config and set it to app
692686 Log . info ( "Shortcut readed:" , account . shortcut )
693687 if ( account . shortcut && account . shortcut ?. length > 0 ) {
Original file line number Diff line number Diff line change @@ -234,7 +234,12 @@ export const usePhoneIslandEventListener = () => {
234234 ...eventHandler ( PHONE_ISLAND_EVENTS [ "phone-island-user-already-login" ] , ( ) => {
235235 window . api . logout ( )
236236 } ) ,
237- ...eventHandler ( PHONE_ISLAND_EVENTS [ "phone-island-webrtc-registered" ] ) ,
237+ ...eventHandler ( PHONE_ISLAND_EVENTS [ "phone-island-webrtc-registered" ] , ( ) => {
238+ setTimeout ( ( ) => {
239+ Log . info ( "phone-island-webrtc-registered" , "send PHONE_ISLAND_READY event" )
240+ window . electron . send ( IPC_EVENTS . PHONE_ISLAND_READY )
241+ } , 250 ) ;
242+ } ) ,
238243 ...eventHandler ( PHONE_ISLAND_EVENTS [ "phone-island-all-alerts-removed" ] ) ,
239244 ...eventHandler ( PHONE_ISLAND_EVENTS [ "phone-island-fullscreen-entered" ] , ( ) => {
240245 window . electron . send ( IPC_EVENTS . FULLSCREEN_ENTER )
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ export function PhoneIslandPage() {
7272 } )
7373
7474 window . electron . receive ( IPC_EVENTS . CHANGE_PREFERRED_DEVICES , ( devices : PreferredDevices ) => {
75+ Log . info ( 'Received CHANGE_PREFERRED_DEVICES in PhoneIslandPage:' , devices )
7576 eventDispatch ( PHONE_ISLAND_EVENTS [ 'phone-island-audio-input-change' ] , { deviceId : devices . audioInput } )
7677 eventDispatch ( PHONE_ISLAND_EVENTS [ 'phone-island-video-input-change' ] , { deviceId : devices . videoInput } )
7778 eventDispatch ( PHONE_ISLAND_EVENTS [ 'phone-island-audio-output-change' ] , { deviceId : devices . audioOutput } )
Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ export enum IPC_EVENTS {
9292 SCREEN_SHARE_SOURCES = "SCREEN_SHARE_SOURCES" ,
9393 CHANGE_SHORTCUT = 'CHANGE_SHORTCUT' ,
9494 COPY_TO_CLIPBOARD = "COPY_TO_CLIPBOARD" ,
95- CHANGE_PREFERRED_DEVICES = "CHANGE_PREFERRED_DEVICES"
95+ CHANGE_PREFERRED_DEVICES = "CHANGE_PREFERRED_DEVICES" ,
96+ PHONE_ISLAND_READY = "PHONE_ISLAND_READY"
9697}
9798
9899//PHONE ISLAND EVENTS
You can’t perform that action at this time.
0 commit comments