Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@nethesis/nethesis-brands-svg-icons": "github:nethesis/Font-Awesome#ns-brands",
"@nethesis/nethesis-light-svg-icons": "github:nethesis/Font-Awesome#ns-light",
"@nethesis/nethesis-solid-svg-icons": "github:nethesis/Font-Awesome#ns-solid",
"@nethesis/phone-island": "^0.14.6",
"@nethesis/phone-island": "^0.14.7",
"@tailwindcss/forms": "^0.5.7",
"@types/lodash": "^4.14.202",
"@types/node": "^18.19.9",
Expand Down
13 changes: 12 additions & 1 deletion src/main/lib/ipcEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,19 @@ export function registerIpcEvents() {
}
})

ipcMain.on(IPC_EVENTS.PHONE_ISLAND_READY, () => {
Log.info('PhoneIsland is ready to receive events')
const account = store.get('account') as Account

setTimeout(() => {
Log.info('Send CHANGE_PREFERRED_DEVICES event with', account.preferredDevices)
AccountController.instance.updatePreferredDevice(account.preferredDevices)
PhoneIslandController.instance.window.emit(IPC_EVENTS.CHANGE_PREFERRED_DEVICES, account.preferredDevices)
}, 250)
})

ipcMain.on(IPC_EVENTS.CHANGE_PREFERRED_DEVICES, (_, devices) => {
Log.info('CHANGE_PREFERRED_DEVICES:', devices)
Log.info('Received CHANGE_PREFERRED_DEVICES in ipcEvents:', devices)
AccountController.instance.updatePreferredDevice(devices)
PhoneIslandController.instance.window.emit(IPC_EVENTS.CHANGE_PREFERRED_DEVICES, devices)
})
Expand Down
6 changes: 0 additions & 6 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,6 @@ async function createNethLink(show: boolean = true) {
checkForUpdate()
const account = store.get('account') as Account
if (account) {
// read preffered devices for phone-island
Log.info("Preferred devices readed:", account.preferredDevices)
if (account.preferredDevices) {
ipcMain.emit(IPC_EVENTS.CHANGE_PREFERRED_DEVICES, undefined, account.preferredDevices)
}

// read shortcut from config and set it to app
Log.info("Shortcut readed:", account.shortcut)
if (account.shortcut && account.shortcut?.length > 0) {
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/src/hooks/usePhoneIslandEventListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ export const usePhoneIslandEventListener = () => {
...eventHandler(PHONE_ISLAND_EVENTS["phone-island-user-already-login"], () => {
window.api.logout()
}),
...eventHandler(PHONE_ISLAND_EVENTS["phone-island-webrtc-registered"]),
...eventHandler(PHONE_ISLAND_EVENTS["phone-island-webrtc-registered"], () => {
setTimeout(() => {
Log.info("phone-island-webrtc-registered", "send PHONE_ISLAND_READY event")
window.electron.send(IPC_EVENTS.PHONE_ISLAND_READY)
}, 500);
}),
...eventHandler(PHONE_ISLAND_EVENTS["phone-island-all-alerts-removed"]),
...eventHandler(PHONE_ISLAND_EVENTS["phone-island-fullscreen-entered"], () => {
window.electron.send(IPC_EVENTS.FULLSCREEN_ENTER)
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/pages/PhoneIslandPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function PhoneIslandPage() {
})

window.electron.receive(IPC_EVENTS.CHANGE_PREFERRED_DEVICES, (devices: PreferredDevices) => {
Log.info('Received CHANGE_PREFERRED_DEVICES in PhoneIslandPage:', devices)
eventDispatch(PHONE_ISLAND_EVENTS['phone-island-audio-input-change'], { deviceId: devices.audioInput })
eventDispatch(PHONE_ISLAND_EVENTS['phone-island-video-input-change'], { deviceId: devices.videoInput })
eventDispatch(PHONE_ISLAND_EVENTS['phone-island-audio-output-change'], { deviceId: devices.audioOutput })
Expand Down
3 changes: 2 additions & 1 deletion src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export enum IPC_EVENTS {
SCREEN_SHARE_SOURCES = "SCREEN_SHARE_SOURCES",
CHANGE_SHORTCUT = 'CHANGE_SHORTCUT',
COPY_TO_CLIPBOARD = "COPY_TO_CLIPBOARD",
CHANGE_PREFERRED_DEVICES = "CHANGE_PREFERRED_DEVICES"
CHANGE_PREFERRED_DEVICES = "CHANGE_PREFERRED_DEVICES",
PHONE_ISLAND_READY = "PHONE_ISLAND_READY"
}

//PHONE ISLAND EVENTS
Expand Down