Skip to content

Commit aa8b8b7

Browse files
feat(click2call): added new event to handle physical phones (#41)
1 parent 634baf4 commit aa8b8b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1485
-799
lines changed

.vscode/launch.json

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,29 +85,6 @@
8585
"presentation": {
8686
"hidden": false
8787
}
88-
},
89-
{
90-
"name": "Debug Renderer Process",
91-
"port": 9222,
92-
"request": "attach",
93-
"type": "chrome",
94-
"webRoot": "${workspaceFolder}/src/renderer",
95-
"timeout": 15000,
96-
"presentation": {
97-
"hidden": true
98-
}
99-
}
100-
],
101-
"compounds": [
102-
{
103-
"name": "Debug main and renderer processes",
104-
"configurations": [
105-
"Debug Main Process",
106-
"Debug Renderer Process"
107-
],
108-
"presentation": {
109-
"order": 1
110-
}
11188
}
11289
]
11390
}

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,13 @@ $ npm run publish:patch
5353
5454
> `INSTANCE=<numer_of_the_instance>`\
5555
> 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.
56+
57+
### User data folders
58+
59+
- Windows: `%APPDATA%/nethlink/`
60+
- Linux: `~/.config/nethlink/`
61+
- macOS: `~/Library/Application Support/nethlink/`
62+
63+
64+
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
65+

package-lock.json

Lines changed: 76 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
1818
"typecheck": "npm run typecheck:node && npm run typecheck:web",
1919
"start": "electron-vite preview",
20-
"dev": "electron-vite dev",
20+
"dev": "DEV=true electron-vite dev",
2121
"pack": "electron-builder --dir",
2222
"dist": "electron-builder",
2323
"preversion": "git add . ",
@@ -46,7 +46,10 @@
4646
"@fortawesome/react-fontawesome": "^0.2.0",
4747
"@headlessui/react": "^1.7.18",
4848
"@hookform/resolvers": "^3.3.4",
49-
"@nethesis/phone-island": "^0.8.28",
49+
"@nethesis/nethesis-brands-svg-icons": "github:nethesis/Font-Awesome#ns-brands",
50+
"@nethesis/nethesis-light-svg-icons": "github:nethesis/Font-Awesome#ns-light",
51+
"@nethesis/nethesis-solid-svg-icons": "github:nethesis/Font-Awesome#ns-solid",
52+
"@nethesis/phone-island": "^0.8.40",
5053
"@tailwindcss/forms": "^0.5.7",
5154
"@types/lodash": "^4.14.202",
5255
"@types/node": "^18.19.9",
@@ -76,6 +79,7 @@
7679
"i18next-http-backend": "^2.1.1",
7780
"lodash": "^4.17.21",
7881
"moment": "^2.30.1",
82+
"motion": "^11.13.1",
7983
"path-browserify": "^1.0.1",
8084
"postcss": "^8.4.35",
8185
"prettier": "^3.2.4",

public/locales/en/translations.json

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"application_update_body": "Click here to open the page where you can download the new release",
128128
"lost_call_title": "Missed call from {{user}}",
129129
"lost_call_body": "You received a call from {{number}} at {{datetime}}",
130+
"physical_phone_error": "the phone {{phone}} is not reachable. Make sure it is connected",
130131
"call_transferred_title": "Call tranferred",
131132
"call_transferred_body": "The call was succesfully tranferred"
132133
},
@@ -322,7 +323,9 @@
322323
"For the following states": "For the following states",
323324
"Callforward": "Forward",
324325
"Do not disturb": "Do not disturb",
325-
"Available presence": "Available presence"
326+
"Available presence": "Available presence",
327+
"IP Phone": "IP Phone",
328+
"Only nethlink": "Only Nethlink"
326329
},
327330
"TopBar": {
328331
"Signed in as": "Signed in as",
@@ -344,7 +347,9 @@
344347
"Mobile": "Mobile",
345348
"Cellphone": "Cellphone",
346349
"Activate voicemail": "Activate voicemail",
347-
"Go to NethVoice CTI": "Go to NethVoice CTI"
350+
"Go to NethVoice CTI": "Go to NethVoice CTI",
351+
"Pair device": "Pair device",
352+
"Theme": "Theme"
348353
},
349354
"OperatorDrawer": {
350355
"Book": "Book",
@@ -893,19 +898,22 @@
893898
"download": "Download the update"
894899
},
895900
"Errors": {
896-
"browser_permissions": "Errore di autorizzazione",
897-
"user_permissions": "Errore di autorizzazione",
898-
"unknown_media_permissions": "Errore di autorizzazione",
899-
"webrtc_down": "WebRTC non disponibile",
900-
"socket_down": "Socket non disponibile",
901-
"busy_camera": "Camera occupata",
902-
"call_transfered": "Chiamata trasferita con successo",
903-
"The browser doesn't have permission to access camera or microphone.": "Il browser non ha il permesso di accedere alla fotocamera o al microfono.",
904-
"You must accept audio and video permissions.": "Devi accettare i permessi audio e video.",
905-
"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.",
906-
"Web Phone connection is down.": "La connessione del Web Phone è interrotta.",
907-
"Server connection is down.": "La connessione al server è interrotta.",
908-
"Camera is used by another application.": "La fotocamera è utilizzata da un'altra applicazione.",
909-
"Call transferred successfully.": "Chiamata trasferita con successo."
901+
"browser_permissions": "Browser permissions error",
902+
"user_permissions": "Media permissions error",
903+
"unknown_media_permissions": "Generic media permission error",
904+
"webrtc_down": "WebRTC is unavailable",
905+
"socket_down": "Socket is unavailable",
906+
"busy_camera": "Webcam is already in use",
907+
"call_transfered": "Transfer successful",
908+
"The browser doesn't have permission to access camera or microphone.": "The browser doesn't have permission to access camera or microphone.",
909+
"You must accept audio and video permissions.": "You must accept audio and video permissions.",
910+
"Web Phone can't access audio or camera on this device.": "Web Phone can't access audio or camera on this device.",
911+
"Web Phone connection is down.": "Device not communicating with server.",
912+
"NethLink connection is down.": "Server connection is unavailable",
913+
"Server connection is down.": "Server connection is unavailable",
914+
"Camera is used by another application.": "Webcam is used by another application.",
915+
"Unknown audio or camera permissions.": "Microphone or Webcam is unavailable",
916+
"No microphone or camera permissions.": "You must accept borwser permissions.",
917+
"Call transferred successfully.": "The call is transferred successfully."
910918
}
911919
}

public/locales/it/translations.json

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"application_update_body": "Clicca quì per aprire la pagina dove potrai scaricare la nuova release",
128128
"lost_call_title": "Chiamata persa da {{user}}",
129129
"lost_call_body": "Hai ricevuto una chiamata da {{number}} alle {{datetime}}",
130+
"physical_phone_error": "Il telefono {{phone}} non è raggiungibile. Assicurarsi che sia collegato",
130131
"call_transferred_title": "Traferimento di chiamata",
131132
"call_transferred_body": "La chiamata è stata trasferita con successo"
132133
},
@@ -322,7 +323,9 @@
322323
"For the following states": "Per i seguenti stati",
323324
"Callforward": "Inoltro",
324325
"Do not disturb": "Non disturbare",
325-
"Available presence": "Presence disponibili"
326+
"Available presence": "Presence disponibili",
327+
"IP Phone": "Telefono IP",
328+
"Only nethlink": "Solo Nethlink"
326329
},
327330
"TopBar": {
328331
"Signed in as": "Accesso effettuato come",
@@ -344,7 +347,9 @@
344347
"Mobile": "Cellulare",
345348
"Cellphone": "Cellulare",
346349
"Activate voicemail": "Attiva voicemail",
347-
"Go to NethVoice CTI": "Vai a NethVoice CTI"
350+
"Go to NethVoice CTI": "Vai a NethVoice CTI",
351+
"Pair device": "Abbina dispositivo",
352+
"Theme": "Tema"
348353
},
349354
"OperatorDrawer": {
350355
"Book": "Prenota",
@@ -893,19 +898,22 @@
893898
"download": "Scarica l'aggiornamento"
894899
},
895900
"Errors": {
896-
"browser_permissions": "Browser Permissions Error",
897-
"user_permissions": "User Permissions Error",
898-
"unknown_media_permissions": "Unknown Media Permissions Error",
899-
"webrtc_down": "WebRTC Down",
900-
"socket_down": "Socket Down",
901-
"busy_camera": "Busy Camera",
902-
"call_transfered": "Call Transferred Successfully",
903-
"The browser doesn't have permission to access camera or microphone.": "The browser doesn't have permission to access camera or microphone.",
904-
"You must accept audio and video permissions.": "You must accept audio and video permissions.",
905-
"Web Phone can't access audio or camera on this device.": "Web Phone can't access audio or camera on this device.",
906-
"Web Phone connection is down.": "Web Phone connection is down.",
907-
"Server connection is down.": "Server connection is down.",
908-
"Camera is used by another application.": "Camera is used by another application.",
909-
"Call transferred successfully.": "Call transferred successfully."
901+
"browser_permissions": "Errore nei permessi del browser",
902+
"user_permissions": "Errore nei permessi dei media",
903+
"unknown_media_permissions": "Errore generico nei permessi",
904+
"webrtc_down": "WebRTC non disponibile",
905+
"socket_down": "Socket non disponibile",
906+
"busy_camera": "La webcam è già in uso",
907+
"call_transfered": "Trasferimento riuscito",
908+
"The browser doesn't have permission to access camera or microphone.": "Il browser non ha il permesso di accedere alla fotocamera o al microfono.",
909+
"You must accept audio and video permissions.": "Devi accettare i permessi per audio e video.",
910+
"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.",
911+
"Web Phone connection is down.": "Il dispositivo non comunica con il server.",
912+
"NethLink connection is down.": "Connessione al server non disponibile",
913+
"Server connection is down.": "Connessione al server non disponibile",
914+
"Camera is used by another application.": "La fotocamera è utilizzata da un'altra applicazione.",
915+
"Unknown audio or camera permissions.": "Microfono o fotocamera non disponibili.",
916+
"No microphone or camera permissions.": "Devi accettare i permessi del browser.",
917+
"Call transferred successfully.": "La chiamata è stata trasferita con successo."
910918
}
911919
}

src/main/classes/controllers/AccountController.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Account, AuthAppData, ConfigFile } from '@shared/types'
1+
import { Account, AuthAppData, AvailableDevices, ConfigFile } from '@shared/types'
22
import { Log } from '@shared/utils/logger'
33
import { safeStorage } from 'electron'
44
import { store } from '@/lib/mainStore'
@@ -77,6 +77,7 @@ export class AccountController {
7777
let loggedAccount: Account = {
7878
...lastLoggedAccount,
7979
...tempLoggedAccount,
80+
theme: lastLoggedAccount.theme || tempLoggedAccount.theme
8081
}
8182

8283
const { parseConfig } = useLogin()
@@ -111,6 +112,10 @@ export class AccountController {
111112
lastUser: accountUID,
112113
lastUserCryptPsw: cryptString
113114
},
115+
device: account.data?.default_device ? {
116+
type: account.data.default_device.type as AvailableDevices,
117+
id: account.data.default_device.id,
118+
} : undefined,
114119
connection: store.store.connection || false
115120
}, 'saveLoggedAccount')
116121
store.saveToDisk()
@@ -137,6 +142,7 @@ export class AccountController {
137142
auth!.availableAccounts[getAccountUID(account)] = account
138143
store.set('auth', auth)
139144
}
145+
store.saveToDisk()
140146
}
141147
}
142148

@@ -170,6 +176,7 @@ export class AccountController {
170176

171177
setAccountNethLinkBounds(nethlinkBounds: Electron.Rectangle | undefined): void {
172178
const account = store.store.account
179+
Log.info('MAIN PRESENCE BACK', account?.data?.mainPresence)
173180
const auth = store.store.auth
174181
if (account) {
175182
account!.nethlinkBounds = nethlinkBounds

0 commit comments

Comments
 (0)