From 81b0012565a78726acc9560d48f48a585022646e Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 25 Nov 2026 09:53:45 +0100 Subject: [PATCH 1/5] feat(connection): require consecutive failures before going offline --- .../src/hooks/usePhoneIslandEventListeners.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/hooks/usePhoneIslandEventListeners.ts b/src/renderer/src/hooks/usePhoneIslandEventListeners.ts index f84e8427..aebbd306 100644 --- a/src/renderer/src/hooks/usePhoneIslandEventListeners.ts +++ b/src/renderer/src/hooks/usePhoneIslandEventListeners.ts @@ -12,6 +12,8 @@ let isWebRTCRegistered = false let isSocketAuthorized = false let hasTriggeredPhoneIslandReady = false +const OFFLINE_FAILURES_THRESHOLD = 3 + const defaultSize: PhoneIslandSizes = { sizes: { width: '0px', @@ -66,6 +68,7 @@ export const usePhoneIslandEventListener = () => { accountRef.current = account const connectedRef = useRef(connected) connectedRef.current = connected + const internetFailuresRef = useRef(0) const [availableRingtones, setAvailableRingtones] = useSharedState('availableRingtones') const notifiedSummaryIdsRef = useRef>(new Set()) @@ -393,6 +396,7 @@ export const usePhoneIslandEventListener = () => { ...eventHandler( PHONE_ISLAND_EVENTS['phone-island-internet-connected'], () => { + internetFailuresRef.current = 0 if (accountRef.current && !connectedRef.current) { setConnected(true) } @@ -401,7 +405,12 @@ export const usePhoneIslandEventListener = () => { ...eventHandler( PHONE_ISLAND_EVENTS['phone-island-internet-disconnected'], () => { - if (accountRef.current && connectedRef.current) { + internetFailuresRef.current += 1 + if ( + accountRef.current && + connectedRef.current && + internetFailuresRef.current >= OFFLINE_FAILURES_THRESHOLD + ) { setConnected(false) } }, From 455d37e0d3bd4088f43d3cfe52d840f18e6e02bf Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 25 Nov 2026 09:54:07 +0100 Subject: [PATCH 2/5] feat(connection): replace blocking dialog with inline banner --- public/locales/en/translations.json | 1 + public/locales/it/translations.json | 1 + .../public/locales/en/translations.json | 1 + .../public/locales/it/translations.json | 1 + .../src/components/ConnectionBanner.tsx | 32 +++++++++++++++++++ src/renderer/src/components/index.ts | 1 + src/renderer/src/pages/NethLinkPage.tsx | 14 +++----- 7 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 src/renderer/src/components/ConnectionBanner.tsx diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index 7e1a3da2..409b3f37 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -85,6 +85,7 @@ "No internet connection title": "No internet connection", "No internet connection description": "Please check your connection and try again", "Refresh": "Refresh", + "Connection lost banner": "No connection: you can't make or receive calls", "Answer phone to start recording": "Answer phone to start recording", "Close the call to stop recording": "Close the call to stop recording", "Search or type a contact": "Search or type a contact", diff --git a/public/locales/it/translations.json b/public/locales/it/translations.json index a71a3ea9..89d8dd8d 100644 --- a/public/locales/it/translations.json +++ b/public/locales/it/translations.json @@ -85,6 +85,7 @@ "No internet connection title": "Nessuna connessione internet", "No internet connection description": "Si prega di controllare la connessione e riprovare", "Refresh": "Aggiorna", + "Connection lost banner": "Connessione assente: non puoi ricevere né fare chiamate", "Answer phone to start recording": "Rispondi al telefono per iniziare la registrazione", "Close the call to stop recording": "Chiudi la chiamata per fermare la registrazione", "Search or type a contact": "Cerca o digita un contatto", diff --git a/src/renderer/public/locales/en/translations.json b/src/renderer/public/locales/en/translations.json index 7e1a3da2..409b3f37 100644 --- a/src/renderer/public/locales/en/translations.json +++ b/src/renderer/public/locales/en/translations.json @@ -85,6 +85,7 @@ "No internet connection title": "No internet connection", "No internet connection description": "Please check your connection and try again", "Refresh": "Refresh", + "Connection lost banner": "No connection: you can't make or receive calls", "Answer phone to start recording": "Answer phone to start recording", "Close the call to stop recording": "Close the call to stop recording", "Search or type a contact": "Search or type a contact", diff --git a/src/renderer/public/locales/it/translations.json b/src/renderer/public/locales/it/translations.json index a71a3ea9..89d8dd8d 100644 --- a/src/renderer/public/locales/it/translations.json +++ b/src/renderer/public/locales/it/translations.json @@ -85,6 +85,7 @@ "No internet connection title": "Nessuna connessione internet", "No internet connection description": "Si prega di controllare la connessione e riprovare", "Refresh": "Aggiorna", + "Connection lost banner": "Connessione assente: non puoi ricevere né fare chiamate", "Answer phone to start recording": "Rispondi al telefono per iniziare la registrazione", "Close the call to stop recording": "Chiudi la chiamata per fermare la registrazione", "Search or type a contact": "Cerca o digita un contatto", diff --git a/src/renderer/src/components/ConnectionBanner.tsx b/src/renderer/src/components/ConnectionBanner.tsx new file mode 100644 index 00000000..1576b6aa --- /dev/null +++ b/src/renderer/src/components/ConnectionBanner.tsx @@ -0,0 +1,32 @@ +import { faTriangleExclamation } from '@fortawesome/free-solid-svg-icons' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { t } from 'i18next' + +interface ConnectionBannerProps { + onRetry: () => void +} + +export const ConnectionBanner = ({ onRetry }: ConnectionBannerProps) => { + return ( +
+
+ ) +} diff --git a/src/renderer/src/components/index.ts b/src/renderer/src/components/index.ts index d7adb5a4..e31b7b0d 100644 --- a/src/renderer/src/components/index.ts +++ b/src/renderer/src/components/index.ts @@ -1,2 +1,3 @@ export * from './Modal' export * from './ConnectionErrorDialog' +export * from './ConnectionBanner' diff --git a/src/renderer/src/pages/NethLinkPage.tsx b/src/renderer/src/pages/NethLinkPage.tsx index 8b838360..ba087ad3 100644 --- a/src/renderer/src/pages/NethLinkPage.tsx +++ b/src/renderer/src/pages/NethLinkPage.tsx @@ -8,7 +8,7 @@ import { NethLinkModules } from '@renderer/components/Modules' import { usePhoneIslandEventHandler } from '@renderer/hooks/usePhoneIslandEventHandler' import { useLoggedNethVoiceAPI } from '@renderer/hooks/useLoggedNethVoiceAPI' import { IPC_EVENTS, PERMISSION } from '@shared/constants' -import { ConnectionErrorDialog } from '@renderer/components' +import { ConnectionBanner } from '@renderer/components' import { debouncer } from '@shared/utils/utils' import { useAccount } from '@renderer/hooks/useAccount' import { Sidebar } from '@renderer/components/Modules/NethVoice/BaseModule/Sidebar' @@ -233,7 +233,10 @@ export function NethLinkPage({ handleRefreshConnection }: NethLinkPageProps) {
-
+ {!connection && ( + + )} +
updateAccountData()} /> @@ -242,13 +245,6 @@ export function NethLinkPage({ handleRefreshConnection }: NethLinkPageProps) {
- {!connection && ( - - )}
) } From 147b630498beebf9720d64bc1de2c383d80eaafb Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 25 Nov 2026 09:54:07 +0100 Subject: [PATCH 3/5] feat(tray): show offline badge and notify once on disconnection --- public/TrayToolbarIconOfflineBlack.png | Bin 0 -> 6539 bytes public/TrayToolbarIconOfflineWhite.png | Bin 0 -> 7991 bytes public/locales/en/translations.json | 3 ++ public/locales/it/translations.json | 3 ++ .../classes/controllers/TrayController.ts | 29 ++++++++++++------ src/main/lib/ipcEvents.ts | 24 +++++++++++++++ .../public/locales/en/translations.json | 3 ++ .../public/locales/it/translations.json | 3 ++ 8 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 public/TrayToolbarIconOfflineBlack.png create mode 100644 public/TrayToolbarIconOfflineWhite.png diff --git a/public/TrayToolbarIconOfflineBlack.png b/public/TrayToolbarIconOfflineBlack.png new file mode 100644 index 0000000000000000000000000000000000000000..c0dd0b9ede22c95319808ed90faf980270c056b1 GIT binary patch literal 6539 zcmdT|eK=I<-@nf>!$>g`p{0f)(+kln8f&JIwO)67Q7NVu%a&zOUP|Ufq=b!asf2Bx zN?Tz|QHm2udZCn3#CXY+myj@+m*0KP*!}&UYp?6MuIG>EkH;U*Irsg2`FuY2_rA~f z%uz27=NZ$!ng#%v;qr~+_W+>q76mj_c=;0basq(a-@7=jULW;YH=o==VJO5 z-YXZ{Zz$}lUB6Iw@OE2?pEX8-N&e6NFhrV`39|Awrz>1P510@w=l);(=P&n-QjhBTFPR`ln%h<|KF}gu&i}P*RqgiY6$)1Eo)-Y&En;^S zaE%oUY9nR2+qm|=gVv#KM=B?|ij!T7Ys=(ZpZy$jISWugRc?${hV+>tTEagRQhO~e zK2l4*S$~t%3D7`JX;VGZ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5HckS{R&M;Puu!le8o3=|fk zVgPEIwvr2#4AZt4=-AoAWy0alrg@@JW6~_oh_r!-;%ef_P)^WHlQh%PQ6ee>UIMuW z!N`xoyBBRqIG3KR%tCd3VI1i<5hm!Nza zz+Gldt6PTvn_Fw{jV}Ozy?MTkB^8KvX;8(#1CYJ^8>XyT# zS5}6o0YRARuqzDK;1%wx4)EHqrq!|4RJ_u~X#U*v2pBGOzD)=PhSQ{qlWVo;C6s)< zV{p7r)l1-;H3%Y9=Ib9;J`c*QYY{kZCG7)Xlg^!bYFmJ|0UnGcR2U(^h+-~90Wjvb z>j6MRG%5h#(Kbn_0Jgf7mH^OE-B<)*`b8f!05}YLE&!5{CH&{mdIx@a>Uu5>8d7v) xC;&4m5}5!HxMI5b7ZhOXs&Ul0fcVQ>prAH9D*J3ytM5QOyEu6`7OdgN{R_mutVI9- literal 0 HcmV?d00001 diff --git a/public/TrayToolbarIconOfflineWhite.png b/public/TrayToolbarIconOfflineWhite.png new file mode 100644 index 0000000000000000000000000000000000000000..f052dabc37c26c350cb442e539980a0bfe3fe36a GIT binary patch literal 7991 zcmcIpc~leG(!ZSq2na%mf+zw89uXBmona9qaSY=Fn`zS|w=y*cyF`~G|MIUUmXR@JY5Rkv>4 zPSW@8E?OFMH2?rw>({Y70U*GC34p8$KgJ?oOaWjdU(Z_oV`TfltHJ%$E$u@+(uId- zQ*K^wzmRWAW3mb^l80Dm5}+ckqzvp|I-$DtM&5VS2a%?BjcW55fuc(8i?bzC;jQ2E zUPg$c^)|13^{zFd=r=Mn@jv{N_~nKB1j>F4jQ!jU(5*bhYzhF6Y`E~g-u8cg7cF!v zBQcF_6p4~Klu;waw~Z{wt4V906+uUd00m%O$z(Dh0p|01f079RXG7#PfPm9KkLn|2 zfd0m-ATt3ldo}HhiGKLEs3?1u6*AAgy;TwZ_M@V_q(|{-^|p%sQyVP? z^GGBRYrmkeU47D+GF&VRYmtu+#8;fG)6?)$OfRO%PbD^5>ZW&5pb>yDC+OlR)^w-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AOh@f?6Cs5 Xx2y0?#NGId*!T6$?yOtiv5)*8y33F$ literal 0 HcmV?d00001 diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index 409b3f37..898d5372 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -3,6 +3,7 @@ "Quit": "Quit", "Hide": "Hide", "Show": "Show", + "Offline": "Not connected", "Theme": "Theme", "System": "System", "Light": "Light", @@ -86,6 +87,8 @@ "No internet connection description": "Please check your connection and try again", "Refresh": "Refresh", "Connection lost banner": "No connection: you can't make or receive calls", + "Connection lost notification title": "NethLink is not connected", + "Connection lost notification body": "You can't make or receive calls until the connection is back", "Answer phone to start recording": "Answer phone to start recording", "Close the call to stop recording": "Close the call to stop recording", "Search or type a contact": "Search or type a contact", diff --git a/public/locales/it/translations.json b/public/locales/it/translations.json index 89d8dd8d..1352ee24 100644 --- a/public/locales/it/translations.json +++ b/public/locales/it/translations.json @@ -3,6 +3,7 @@ "Quit": "Chiudi", "Hide": "Nascondi", "Show": "Mostra", + "Offline": "Non connesso", "Theme": "Tema", "System": "Sistema", "Light": "Chiaro", @@ -86,6 +87,8 @@ "No internet connection description": "Si prega di controllare la connessione e riprovare", "Refresh": "Aggiorna", "Connection lost banner": "Connessione assente: non puoi ricevere né fare chiamate", + "Connection lost notification title": "NethLink non è connesso", + "Connection lost notification body": "Non puoi ricevere né fare chiamate finché la connessione non torna", "Answer phone to start recording": "Rispondi al telefono per iniziare la registrazione", "Close the call to stop recording": "Chiudi la chiamata per fermare la registrazione", "Search or type a contact": "Cerca o digita un contatto", diff --git a/src/main/classes/controllers/TrayController.ts b/src/main/classes/controllers/TrayController.ts index 85f4499a..36d837e7 100644 --- a/src/main/classes/controllers/TrayController.ts +++ b/src/main/classes/controllers/TrayController.ts @@ -27,9 +27,12 @@ export type TrayUpdaterProps = { export class TrayController { tray: Tray static instance: TrayController + theme: 'light' | 'dark' + offline = false constructor() { TrayController.instance = this const theme = nativeTheme.shouldUseDarkColors ? 'dark' : 'light' + this.theme = theme const image = this.getImage(theme) this.tray = new Tray(image) this.updateTray() @@ -43,20 +46,27 @@ export class TrayController { } getImage(theme: 'light' | 'dark') { - let pathImage = '../../public/TrayToolbarIconWhite.png' - if (process.platform === 'win32') { - pathImage = - theme === 'light' - ? '../../public/TrayToolbarIconBlack.png' - : '../../public/TrayToolbarIconWhite.png' - } + const name = this.offline ? 'TrayToolbarIconOffline' : 'TrayToolbarIcon' + const followsTheme = + process.platform === 'win32' || + (process.platform === 'darwin' && this.offline) + const color = followsTheme && theme === 'light' ? 'Black' : 'White' const image = nativeImage - .createFromPath(path.join(__dirname, pathImage)) + .createFromPath(path.join(__dirname, `../../public/${name}${color}.png`)) .resize({ height: 18, width: 18 }) - image.setTemplateImage(true) + image.setTemplateImage(!this.offline) return image } + setOffline(offline: boolean) { + if (this.offline === offline) return + this.offline = offline + this.tray.setImage(this.getImage(this.theme)) + this.tray.setToolTip( + offline ? `NethLink - ${t('Tray.Offline')}` : 'NethLink', + ) + } + // a 16px icon of the menu, from public/tray (the @2x file is picked up on // HiDPI screens): a template image on macOS, which follows the menu bar, // the color of the system theme elsewhere @@ -86,6 +96,7 @@ export class TrayController { } changeIconByTheme(theme: 'light' | 'dark') { + this.theme = theme const image = this.getImage(theme) this.tray.setImage(image) } diff --git a/src/main/lib/ipcEvents.ts b/src/main/lib/ipcEvents.ts index aed921fb..9db48df7 100644 --- a/src/main/lib/ipcEvents.ts +++ b/src/main/lib/ipcEvents.ts @@ -23,6 +23,7 @@ import { NethLinkController } from '@/classes/controllers/NethLinkController' import { AppController } from '@/classes/controllers/AppController' import { TrayController } from '@/classes/controllers/TrayController' import { store } from './mainStore' +import { t } from 'i18next' import { debouncer, getAccountUID, getPageFromQuery } from '@shared/utils/utils' import { NetworkController } from '@/classes/controllers/NetworkController' import { useLogin } from '@shared/useLogin' @@ -56,6 +57,28 @@ let isPhoneIslandReloadPending = false const SERVER_CONFIG_CHECK_MIN_INTERVAL = 10_000 let lastServerConfigCheck = 0 +let lastConnection: boolean | undefined = undefined + +function onConnectionStateChange(state: any) { + const connection: boolean | undefined = state?.account + ? state.connection + : undefined + if (connection === lastConnection) return + const previous = lastConnection + lastConnection = connection + TrayController.instance?.setOffline(connection === false) + if (connection === false && previous === true) { + const isNethLinkFocused = + NethLinkController.instance?.window?.getWindow()?.isFocused() ?? false + if (!isNethLinkFocused) { + new Notification({ + title: `${t('Common.Connection lost notification title')}`, + body: `${t('Common.Connection lost notification body')}`, + }).show() + } + } +} + /** * Reload the PhoneIsland so that it registers again with the current SIP host/port. * When a call is active the reload is deferred to the call end, since it would drop the call. @@ -205,6 +228,7 @@ export function registerIpcEvents() { ipcMain.on(IPC_EVENTS.UPDATE_SHARED_STATE, (_, newState, page, selector) => { const windows = BrowserWindow.getAllWindows() store.updateStore(newState, `${page}[${selector}]`) + onConnectionStateChange(store.store) windows.forEach((win) => { const targetPage = win.webContents.getTitle() try { diff --git a/src/renderer/public/locales/en/translations.json b/src/renderer/public/locales/en/translations.json index 409b3f37..898d5372 100644 --- a/src/renderer/public/locales/en/translations.json +++ b/src/renderer/public/locales/en/translations.json @@ -3,6 +3,7 @@ "Quit": "Quit", "Hide": "Hide", "Show": "Show", + "Offline": "Not connected", "Theme": "Theme", "System": "System", "Light": "Light", @@ -86,6 +87,8 @@ "No internet connection description": "Please check your connection and try again", "Refresh": "Refresh", "Connection lost banner": "No connection: you can't make or receive calls", + "Connection lost notification title": "NethLink is not connected", + "Connection lost notification body": "You can't make or receive calls until the connection is back", "Answer phone to start recording": "Answer phone to start recording", "Close the call to stop recording": "Close the call to stop recording", "Search or type a contact": "Search or type a contact", diff --git a/src/renderer/public/locales/it/translations.json b/src/renderer/public/locales/it/translations.json index 89d8dd8d..1352ee24 100644 --- a/src/renderer/public/locales/it/translations.json +++ b/src/renderer/public/locales/it/translations.json @@ -3,6 +3,7 @@ "Quit": "Chiudi", "Hide": "Nascondi", "Show": "Mostra", + "Offline": "Non connesso", "Theme": "Tema", "System": "Sistema", "Light": "Chiaro", @@ -86,6 +87,8 @@ "No internet connection description": "Si prega di controllare la connessione e riprovare", "Refresh": "Aggiorna", "Connection lost banner": "Connessione assente: non puoi ricevere né fare chiamate", + "Connection lost notification title": "NethLink non è connesso", + "Connection lost notification body": "Non puoi ricevere né fare chiamate finché la connessione non torna", "Answer phone to start recording": "Rispondi al telefono per iniziare la registrazione", "Close the call to stop recording": "Chiudi la chiamata per fermare la registrazione", "Search or type a contact": "Cerca o digita un contatto", From 7c30a917e000ba3ef720f19cea9d6e95eae6e868 Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 25 Nov 2026 10:29:49 +0100 Subject: [PATCH 4/5] chore(deps): update phone-island to dev version --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c560181c..69ef3245 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "@hookform/resolvers": "^3.3.4", "@nethesis/chat-island": "0.1.73", "@nethesis/nethesis-solid-svg-icons": "github:nethesis/Font-Awesome#ns-solid", - "@nethesis/phone-island": "^1.1.8", + "@nethesis/phone-island": "^1.1.9-dev.1", "@tailwindcss/forms": "^0.5.7", "@types/lodash": "^4.14.202", "@types/node": "^18.19.9", @@ -2495,9 +2495,9 @@ } }, "node_modules/@nethesis/phone-island": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/@nethesis/phone-island/-/phone-island-1.1.8.tgz", - "integrity": "sha512-lQ9euEYukFvU6beB00nUV2Y7QJzbP5hytET5Cbxdt56IH7UgYjT1gNd5ZWPjH9iD3dkwrRVxnznhq/rLVN6hAQ==", + "version": "1.1.9-dev.1", + "resolved": "https://registry.npmjs.org/@nethesis/phone-island/-/phone-island-1.1.9-dev.1.tgz", + "integrity": "sha512-9/qLKtbpy6jvRWNstMBGr7zCbb/lVJLdb+Jhr38H8w+ViV5UHxr9pDyP8PV0986Q0JEIfngGarLlqJvDXV2odA==", "dev": true, "license": "GPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 898464cc..9f7e95e4 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@hookform/resolvers": "^3.3.4", "@nethesis/chat-island": "0.1.73", "@nethesis/nethesis-solid-svg-icons": "github:nethesis/Font-Awesome#ns-solid", - "@nethesis/phone-island": "^1.1.8", + "@nethesis/phone-island": "^1.1.9-dev.1", "@tailwindcss/forms": "^0.5.7", "@types/lodash": "^4.14.202", "@types/node": "^18.19.9", From a68f2b17aa61a2cb06a6b59f29b94dcbf92ef129 Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 25 Nov 2026 10:29:49 +0100 Subject: [PATCH 5/5] feat(island): keep connection alerts from opening the island --- .../pageComponents/phoneIsland/phoneIslandContainer.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/src/components/pageComponents/phoneIsland/phoneIslandContainer.tsx b/src/renderer/src/components/pageComponents/phoneIsland/phoneIslandContainer.tsx index 26b33118..cf4d65d9 100644 --- a/src/renderer/src/components/pageComponents/phoneIsland/phoneIslandContainer.tsx +++ b/src/renderer/src/components/pageComponents/phoneIsland/phoneIslandContainer.tsx @@ -35,6 +35,7 @@ export const PhoneIslandContainer = ({ dataConfig={dataConfig} uaType='mobile' preferredSummaryExtensionType='nethlink' + hideConnectionAlerts /> ) )