Skip to content

Commit a6dc4c6

Browse files
authored
chore(dep): update phone-island (#49)
1 parent 28095cf commit a6dc4c6

File tree

19 files changed

+182
-574
lines changed

19 files changed

+182
-574
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ out
55
*.log*
66
.yarn/install-state.gz
77
yarn.lock
8+
package-lock.json
89
certification
910
*.env
1011
test/

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@nethesis/nethesis-brands-svg-icons": "github:nethesis/Font-Awesome#ns-brands",
5050
"@nethesis/nethesis-light-svg-icons": "github:nethesis/Font-Awesome#ns-light",
5151
"@nethesis/nethesis-solid-svg-icons": "github:nethesis/Font-Awesome#ns-solid",
52-
"@nethesis/phone-island": "^0.8.45",
52+
"@nethesis/phone-island": "^0.10.2",
5353
"@tailwindcss/forms": "^0.5.7",
5454
"@types/lodash": "^4.14.202",
5555
"@types/node": "^18.19.9",

src/main/classes/controllers/NetworkController.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export class NetworkController {
88

99
async post(path: string, data: object | undefined, config: { headers: { Authorization?: string | undefined; 'Content-Type': string; }; } | undefined = { headers: { 'Content-Type': 'application/json' } }): Promise<any> {
1010
try {
11-
const response = await axios.post(path, data, config)
11+
const response = await axios.post(path, data, {
12+
timeout: 5000,
13+
...config
14+
})
1215

1316
return response.data
1417
} catch (e: any) {
@@ -19,7 +22,10 @@ export class NetworkController {
1922
}
2023
async get(path: string, config: { headers: { Authorization?: string | undefined; 'Content-Type': string } } | undefined = { headers: { 'Content-Type': 'application/json' } }): Promise<any> {
2124
try {
22-
const response = await axios.get(path, config)
25+
const response = await axios.get(path, {
26+
timeout: 5000,
27+
...config
28+
})
2329
return response.data
2430
} catch (e: any) {
2531
const err: AxiosError = e

src/main/classes/windows/NethLinkWindow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class NethLinkWindow extends BaseWindow {
123123
super.buildWindow()
124124
this._window?.on('hide', this.toggleVisibility)
125125
this._window?.on('moved', () => {
126-
this.saveBounds()
126+
debouncer('onMoveNethLinkWindow', () => this.saveBounds(), 1000)
127127
})
128128
this._window?.on('show', this.toggleVisibility)
129129
this._window?.on('closed', this.toggleVisibility)

src/main/lib/ipcEvents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function registerIpcEvents() {
104104
if (!draggingWindows?.hasOwnProperty(window.title)) {
105105
const interval: number = setInterval(() => {
106106
updateWindowPosition(window)
107-
}, 1000 / 60) as unknown as number; // => 60 frames per seconds
107+
}, 1000 / 300) as unknown as number; // => 300 frames per seconds
108108
draggingWindows = {
109109
...draggingWindows,
110110
[window.title]: {

src/renderer/index.html

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
<!doctype html>
22
<html>
3-
<head>
4-
<meta charset="UTF-8" />
5-
<!-- <meta http-equiv="Content-Security-Policy"
6-
content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval';" /> -->
7-
<!-- IMPORT THE WIDGET CSS -->
8-
<link
9-
rel="stylesheet"
10-
type="text/css"
11-
href="https://cdn.jsdelivr.net/gh/nethesis/phone-island/dist-widget/index.widget.css"
12-
/>
13-
<!-- IMPORT THE POPPINS FONTS -->
14-
<link rel="preconnect" href="https://fonts.googleapis.com" />
15-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
16-
<link
17-
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
18-
rel="stylesheet"
19-
/>
20-
<!-- IMPORT THE WIDGET CSS -->
21-
<meta
22-
http-equiv="Content-Security-Policy"
23-
content="default-src * self blob: data: gap:; style-src * self 'unsafe-inline' blob: data: gap:; script-src * 'self' 'unsafe-inline' blob: data: gap:; object-src * 'self' blob: data: gap:; img-src * self 'unsafe-inline' blob: data: gap:; connect-src self * 'unsafe-inline' blob: data: gap:; frame-src * self blob: data: gap:;"
24-
/>
25-
<!-- 'unsafe-eval' -->
26-
</head>
273

28-
<body>
29-
<div id="root"></div>
30-
<script type="module" src="/src/index.tsx"></script>
31-
</body>
32-
</html>
4+
<head>
5+
<meta charset="UTF-8" />
6+
<!-- IMPORT THE POPPINS FONTS -->
7+
<link rel="preconnect" href="https://fonts.googleapis.com" />
8+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9+
<link
10+
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
11+
rel="stylesheet" />
12+
<meta http-equiv="Content-Security-Policy"
13+
content="default-src * self blob: data: gap:; style-src * self 'unsafe-inline' blob: data: gap:; script-src * 'self' 'unsafe-inline' blob: data: gap:; object-src * 'self' blob: data: gap:; img-src * self 'unsafe-inline' blob: data: gap:; connect-src self * 'unsafe-inline' blob: data: gap:; frame-src * self blob: data: gap:;" />
14+
</head>
15+
16+
<body>
17+
<div id="root"></div>
18+
<script type="module" src="/src/index.tsx"></script>
19+
</body>
20+
21+
</html>

src/renderer/src/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useRegisterStoreHook, useSharedState } from "@renderer/store";
1313
import { PageContext, usePageCtx } from './contexts/pageContext'
1414
import { GIT_RELEASES_URL, IPC_EVENTS } from '@shared/constants'
1515
import { useNetwork } from '@shared/useNetwork'
16-
16+
import './index.css'
1717

1818
const RequestStateComponent = () => {
1919
const pageData = usePageCtx()
@@ -66,7 +66,7 @@ const RequestStateComponent = () => {
6666
}, [account?.username, pageData?.page])
6767

6868
const loader = async () => {
69-
Log.info('check i18n initialization')
69+
Log.debug('check i18n initialization')
7070
let time = 0
7171
//I wait for the language to load or 200 milliseconds
7272
while (time < 20 && !i18next.isInitialized) {
@@ -119,10 +119,9 @@ const Layout = ({ theme, page }: { theme?: AvailableThemes, page?: PAGES }) => {
119119

120120
const importStyle = async () => {
121121
// Importing CSS dynamically when the page is not 'PHONEISLAND'
122-
if (page !== PAGES.PHONEISLAND) {
123-
await import('./tailwind.css')
122+
if (page === PAGES.PHONEISLAND) {
123+
await import('@nethesis/phone-island/dist/index.css')
124124
}
125-
await import('./index.css')
126125
setIsCSSLoaded(true);
127126
}
128127

@@ -142,7 +141,7 @@ const Layout = ({ theme, page }: { theme?: AvailableThemes, page?: PAGES }) => {
142141
export default function App() {
143142

144143
useInitialize(() => {
145-
Log.info('initialize i18n')
144+
Log.debug('initialize i18n')
146145
loadI18n()
147146
})
148147
return (

src/renderer/src/components/ElectronDraggableWindow.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ export const ElectronDraggableWindow = ({ children }) => {
3939
};
4040

4141
const handleMouseUp = (e: MouseEvent) => {
42-
if (!mouseUpEvent.current) {
43-
mouseDownEvent.current = null
44-
window.electron.send(IPC_EVENTS.STOP_DRAG);
45-
isDrag.current = false
46-
mouseUpEvent.current = e
47-
}
42+
mouseDownEvent.current = null
43+
window.electron.send(IPC_EVENTS.STOP_DRAG);
44+
isDrag.current = false
45+
mouseUpEvent.current = e
4846
};
4947

5048
useEffect(() => {
@@ -81,7 +79,7 @@ export const ElectronDraggableWindow = ({ children }) => {
8179

8280
return (
8381
<div
84-
className={classNames('absolute select-none top-0 left-0 h-screen w-screen z-[10000]', isDev() ? 'bg-red-700/75' : '')}
82+
className={classNames('select-none h-[inherit] w-[inherit] z-[10000]', isDev() ? 'bg-red-700/75' : '')}
8583
>
8684
{children}
8785
</div>

src/renderer/src/components/pageComponents/phoneIsland/phoneIslandContainer.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { PhoneIsland } from "@nethesis/phone-island"
2-
import { eventDispatch } from "@renderer/hooks/eventDispatch"
3-
import { useLoggedNethVoiceAPI } from "@renderer/hooks/useLoggedNethVoiceAPI"
42
import { useSharedState } from "@renderer/store"
5-
import { IPC_EVENTS, PHONE_ISLAND_EVENTS } from "@shared/constants"
3+
import { IPC_EVENTS } from "@shared/constants"
64
import { Log } from "@shared/utils/logger"
75
import { useEffect, useMemo } from "react"
86

9-
export const PhoneIslandContainer = ({ dataConfig, deviceInformationObject, isDataConfigCreated, i18nLoadPath }) => {
7+
export const PhoneIslandContainer = ({ dataConfig, deviceInformationObject, isDataConfigCreated }) => {
108
const [account] = useSharedState('account')
11-
const { NethVoiceAPI } = useLoggedNethVoiceAPI()
129

1310
useEffect(() => {
1411
updateAccountInfo()
@@ -17,18 +14,14 @@ export const PhoneIslandContainer = ({ dataConfig, deviceInformationObject, isDa
1714
const updateAccountInfo = async () => {
1815
if (deviceInformationObject) {
1916
Log.info('FORCE DEFAULT DEVICE TO NETHLINK')
20-
//TODO: controlla
21-
if(account?.data?.default_device?.type === 'webrtc') {
17+
if (account?.data?.default_device?.type === 'webrtc') {
2218
window.electron.send(IPC_EVENTS.CHANGE_DEFAULT_DEVICE, deviceInformationObject)
2319
}
24-
// await NethVoiceAPI.User.default_device(deviceInformationObject)
25-
// eventDispatch(PHONE_ISLAND_EVENTS['phone-island-default-device-change'], { deviceInformationObject })
26-
2720
}
2821
}
2922

3023
const PhoneIslandComponent = useMemo(() => {
31-
return dataConfig && isDataConfigCreated && <PhoneIsland dataConfig={dataConfig} i18nLoadPath={i18nLoadPath} uaType='mobile' />
24+
return dataConfig && isDataConfigCreated && <PhoneIsland dataConfig={dataConfig} uaType='mobile' />
3225
}, [account?.username, dataConfig, isDataConfigCreated])
3326

3427
return PhoneIslandComponent

0 commit comments

Comments
 (0)