Skip to content

Commit

Permalink
feat(click2call): added new event to handle physical phones (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
therockerline authored Jan 15, 2025
1 parent 634baf4 commit aa8b8b7
Show file tree
Hide file tree
Showing 55 changed files with 1,485 additions and 799 deletions.
23 changes: 0 additions & 23 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,6 @@
"presentation": {
"hidden": false
}
},
{
"name": "Debug Renderer Process",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}/src/renderer",
"timeout": 15000,
"presentation": {
"hidden": true
}
}
],
"compounds": [
{
"name": "Debug main and renderer processes",
"configurations": [
"Debug Main Process",
"Debug Renderer Process"
],
"presentation": {
"order": 1
}
}
]
}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ $ npm run publish:patch
> `INSTANCE=<numer_of_the_instance>`\
> enables multiple instances of the process. Use this function with extreme caution, it can cause many problems - for testing purposes only. When this variable is set, a new `user_data_<instance_number>.json` is created and the instance only changes its related file.
### User data folders

- Windows: `%APPDATA%/nethlink/`
- Linux: `~/.config/nethlink/`
- macOS: `~/Library/Application Support/nethlink/`


We then have two files: user_data.json and available_users.json the first file contains the data of the currently logged in user, the other contains the data of all available users in that device who have logged in at least once

84 changes: 76 additions & 8 deletions package-lock.json

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

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"start": "electron-vite preview",
"dev": "electron-vite dev",
"dev": "DEV=true electron-vite dev",
"pack": "electron-builder --dir",
"dist": "electron-builder",
"preversion": "git add . ",
Expand Down Expand Up @@ -46,7 +46,10 @@
"@fortawesome/react-fontawesome": "^0.2.0",
"@headlessui/react": "^1.7.18",
"@hookform/resolvers": "^3.3.4",
"@nethesis/phone-island": "^0.8.28",
"@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.8.40",
"@tailwindcss/forms": "^0.5.7",
"@types/lodash": "^4.14.202",
"@types/node": "^18.19.9",
Expand Down Expand Up @@ -76,6 +79,7 @@
"i18next-http-backend": "^2.1.1",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"motion": "^11.13.1",
"path-browserify": "^1.0.1",
"postcss": "^8.4.35",
"prettier": "^3.2.4",
Expand Down
40 changes: 24 additions & 16 deletions public/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"application_update_body": "Click here to open the page where you can download the new release",
"lost_call_title": "Missed call from {{user}}",
"lost_call_body": "You received a call from {{number}} at {{datetime}}",
"physical_phone_error": "the phone {{phone}} is not reachable. Make sure it is connected",
"call_transferred_title": "Call tranferred",
"call_transferred_body": "The call was succesfully tranferred"
},
Expand Down Expand Up @@ -322,7 +323,9 @@
"For the following states": "For the following states",
"Callforward": "Forward",
"Do not disturb": "Do not disturb",
"Available presence": "Available presence"
"Available presence": "Available presence",
"IP Phone": "IP Phone",
"Only nethlink": "Only Nethlink"
},
"TopBar": {
"Signed in as": "Signed in as",
Expand All @@ -344,7 +347,9 @@
"Mobile": "Mobile",
"Cellphone": "Cellphone",
"Activate voicemail": "Activate voicemail",
"Go to NethVoice CTI": "Go to NethVoice CTI"
"Go to NethVoice CTI": "Go to NethVoice CTI",
"Pair device": "Pair device",
"Theme": "Theme"
},
"OperatorDrawer": {
"Book": "Book",
Expand Down Expand Up @@ -893,19 +898,22 @@
"download": "Download the update"
},
"Errors": {
"browser_permissions": "Errore di autorizzazione",
"user_permissions": "Errore di autorizzazione",
"unknown_media_permissions": "Errore di autorizzazione",
"webrtc_down": "WebRTC non disponibile",
"socket_down": "Socket non disponibile",
"busy_camera": "Camera occupata",
"call_transfered": "Chiamata trasferita con successo",
"The browser doesn't have permission to access camera or microphone.": "Il browser non ha il permesso di accedere alla fotocamera o al microfono.",
"You must accept audio and video permissions.": "Devi accettare i permessi audio e video.",
"Web Phone can't access audio or camera on this device.": "Il Web Phone non può accedere all'audio o alla fotocamera su questo dispositivo.",
"Web Phone connection is down.": "La connessione del Web Phone è interrotta.",
"Server connection is down.": "La connessione al server è interrotta.",
"Camera is used by another application.": "La fotocamera è utilizzata da un'altra applicazione.",
"Call transferred successfully.": "Chiamata trasferita con successo."
"browser_permissions": "Browser permissions error",
"user_permissions": "Media permissions error",
"unknown_media_permissions": "Generic media permission error",
"webrtc_down": "WebRTC is unavailable",
"socket_down": "Socket is unavailable",
"busy_camera": "Webcam is already in use",
"call_transfered": "Transfer successful",
"The browser doesn't have permission to access camera or microphone.": "The browser doesn't have permission to access camera or microphone.",
"You must accept audio and video permissions.": "You must accept audio and video permissions.",
"Web Phone can't access audio or camera on this device.": "Web Phone can't access audio or camera on this device.",
"Web Phone connection is down.": "Device not communicating with server.",
"NethLink connection is down.": "Server connection is unavailable",
"Server connection is down.": "Server connection is unavailable",
"Camera is used by another application.": "Webcam is used by another application.",
"Unknown audio or camera permissions.": "Microphone or Webcam is unavailable",
"No microphone or camera permissions.": "You must accept borwser permissions.",
"Call transferred successfully.": "The call is transferred successfully."
}
}
40 changes: 24 additions & 16 deletions public/locales/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"application_update_body": "Clicca quì per aprire la pagina dove potrai scaricare la nuova release",
"lost_call_title": "Chiamata persa da {{user}}",
"lost_call_body": "Hai ricevuto una chiamata da {{number}} alle {{datetime}}",
"physical_phone_error": "Il telefono {{phone}} non è raggiungibile. Assicurarsi che sia collegato",
"call_transferred_title": "Traferimento di chiamata",
"call_transferred_body": "La chiamata è stata trasferita con successo"
},
Expand Down Expand Up @@ -322,7 +323,9 @@
"For the following states": "Per i seguenti stati",
"Callforward": "Inoltro",
"Do not disturb": "Non disturbare",
"Available presence": "Presence disponibili"
"Available presence": "Presence disponibili",
"IP Phone": "Telefono IP",
"Only nethlink": "Solo Nethlink"
},
"TopBar": {
"Signed in as": "Accesso effettuato come",
Expand All @@ -344,7 +347,9 @@
"Mobile": "Cellulare",
"Cellphone": "Cellulare",
"Activate voicemail": "Attiva voicemail",
"Go to NethVoice CTI": "Vai a NethVoice CTI"
"Go to NethVoice CTI": "Vai a NethVoice CTI",
"Pair device": "Abbina dispositivo",
"Theme": "Tema"
},
"OperatorDrawer": {
"Book": "Prenota",
Expand Down Expand Up @@ -893,19 +898,22 @@
"download": "Scarica l'aggiornamento"
},
"Errors": {
"browser_permissions": "Browser Permissions Error",
"user_permissions": "User Permissions Error",
"unknown_media_permissions": "Unknown Media Permissions Error",
"webrtc_down": "WebRTC Down",
"socket_down": "Socket Down",
"busy_camera": "Busy Camera",
"call_transfered": "Call Transferred Successfully",
"The browser doesn't have permission to access camera or microphone.": "The browser doesn't have permission to access camera or microphone.",
"You must accept audio and video permissions.": "You must accept audio and video permissions.",
"Web Phone can't access audio or camera on this device.": "Web Phone can't access audio or camera on this device.",
"Web Phone connection is down.": "Web Phone connection is down.",
"Server connection is down.": "Server connection is down.",
"Camera is used by another application.": "Camera is used by another application.",
"Call transferred successfully.": "Call transferred successfully."
"browser_permissions": "Errore nei permessi del browser",
"user_permissions": "Errore nei permessi dei media",
"unknown_media_permissions": "Errore generico nei permessi",
"webrtc_down": "WebRTC non disponibile",
"socket_down": "Socket non disponibile",
"busy_camera": "La webcam è già in uso",
"call_transfered": "Trasferimento riuscito",
"The browser doesn't have permission to access camera or microphone.": "Il browser non ha il permesso di accedere alla fotocamera o al microfono.",
"You must accept audio and video permissions.": "Devi accettare i permessi per audio e video.",
"Web Phone can't access audio or camera on this device.": "Il Web Phone non può accedere all'audio o alla fotocamera su questo dispositivo.",
"Web Phone connection is down.": "Il dispositivo non comunica con il server.",
"NethLink connection is down.": "Connessione al server non disponibile",
"Server connection is down.": "Connessione al server non disponibile",
"Camera is used by another application.": "La fotocamera è utilizzata da un'altra applicazione.",
"Unknown audio or camera permissions.": "Microfono o fotocamera non disponibili.",
"No microphone or camera permissions.": "Devi accettare i permessi del browser.",
"Call transferred successfully.": "La chiamata è stata trasferita con successo."
}
}
9 changes: 8 additions & 1 deletion src/main/classes/controllers/AccountController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Account, AuthAppData, ConfigFile } from '@shared/types'
import { Account, AuthAppData, AvailableDevices, ConfigFile } from '@shared/types'
import { Log } from '@shared/utils/logger'
import { safeStorage } from 'electron'
import { store } from '@/lib/mainStore'
Expand Down Expand Up @@ -77,6 +77,7 @@ export class AccountController {
let loggedAccount: Account = {
...lastLoggedAccount,
...tempLoggedAccount,
theme: lastLoggedAccount.theme || tempLoggedAccount.theme
}

const { parseConfig } = useLogin()
Expand Down Expand Up @@ -111,6 +112,10 @@ export class AccountController {
lastUser: accountUID,
lastUserCryptPsw: cryptString
},
device: account.data?.default_device ? {
type: account.data.default_device.type as AvailableDevices,
id: account.data.default_device.id,
} : undefined,
connection: store.store.connection || false
}, 'saveLoggedAccount')
store.saveToDisk()
Expand All @@ -137,6 +142,7 @@ export class AccountController {
auth!.availableAccounts[getAccountUID(account)] = account
store.set('auth', auth)
}
store.saveToDisk()
}
}

Expand Down Expand Up @@ -170,6 +176,7 @@ export class AccountController {

setAccountNethLinkBounds(nethlinkBounds: Electron.Rectangle | undefined): void {
const account = store.store.account
Log.info('MAIN PRESENCE BACK', account?.data?.mainPresence)
const auth = store.store.auth
if (account) {
account!.nethlinkBounds = nethlinkBounds
Expand Down
Loading

0 comments on commit aa8b8b7

Please sign in to comment.