mirror of
https://github.com/jambonz/chrome-extension-dialer.git
synced 2026-10-04 02:04:28 +00:00
fixed review comments
This commit is contained in:
Generated
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
"framer-motion": "^10.16.4",
|
"framer-motion": "^10.16.4",
|
||||||
"fuse.js": "^6.6.2",
|
"fuse.js": "^6.6.2",
|
||||||
"google-libphonenumber": "^3.2.33",
|
"google-libphonenumber": "^3.2.33",
|
||||||
"jssip": "^3.2.17",
|
"jssip": "^3.10.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-feather": "^2.0.10",
|
"react-feather": "^2.0.10",
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
"framer-motion": "^10.16.4",
|
"framer-motion": "^10.16.4",
|
||||||
"fuse.js": "^6.6.2",
|
"fuse.js": "^6.6.2",
|
||||||
"google-libphonenumber": "^3.2.33",
|
"google-libphonenumber": "^3.2.33",
|
||||||
"jssip": "^3.2.17",
|
"jssip": "^3.10.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-feather": "^2.0.10",
|
"react-feather": "^2.0.10",
|
||||||
|
|||||||
+8
-1
@@ -73,5 +73,12 @@ export interface CallHistory {
|
|||||||
isSaved?: boolean;
|
isSaved?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SipClientStatus = "online" | "offline";
|
export type SipClientStatus =
|
||||||
|
| "start"
|
||||||
|
| "stop"
|
||||||
|
| "connecting"
|
||||||
|
| "connected"
|
||||||
|
| "disconnected"
|
||||||
|
| "online"
|
||||||
|
| "offline";
|
||||||
export type SipCallDirection = "" | "outgoing" | "incoming";
|
export type SipCallDirection = "" | "outgoing" | "incoming";
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
VStack,
|
VStack,
|
||||||
|
useToast,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import {
|
import {
|
||||||
@@ -53,6 +54,7 @@ import { v4 as uuidv4 } from "uuid";
|
|||||||
import IconButtonMenu, { IconButtonMenuItems } from "src/components/menu";
|
import IconButtonMenu, { IconButtonMenuItems } from "src/components/menu";
|
||||||
import { getApplications, getQueues, getRegisteredUser } from "src/api";
|
import { getApplications, getQueues, getRegisteredUser } from "src/api";
|
||||||
import JambonzSwitch from "src/components/switch";
|
import JambonzSwitch from "src/components/switch";
|
||||||
|
import { DEFAULT_TOAST_DURATION } from "src/common/constants";
|
||||||
|
|
||||||
type PhoneProbs = {
|
type PhoneProbs = {
|
||||||
sipDomain: string;
|
sipDomain: string;
|
||||||
@@ -96,6 +98,8 @@ export const Phone = ({
|
|||||||
const sipPasswordRef = useRef("");
|
const sipPasswordRef = useRef("");
|
||||||
const sipServerAddressRef = useRef("");
|
const sipServerAddressRef = useRef("");
|
||||||
const sipDisplayNameRef = useRef("");
|
const sipDisplayNameRef = useRef("");
|
||||||
|
const [isForceChangeUaStatus, setIsForceChangeUaStatus] = useState(false);
|
||||||
|
const toast = useToast();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
sipDomainRef.current = sipDomain;
|
sipDomainRef.current = sipDomain;
|
||||||
@@ -151,6 +155,10 @@ export const Phone = ({
|
|||||||
}
|
}
|
||||||
}, [calledANumber]);
|
}, [calledANumber]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsForceChangeUaStatus(false);
|
||||||
|
}, [status]);
|
||||||
|
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// chrome.runtime.onMessage.addListener(function (request) {
|
// chrome.runtime.onMessage.addListener(function (request) {
|
||||||
// const msg = request as Message<any>;
|
// const msg = request as Message<any>;
|
||||||
@@ -218,6 +226,16 @@ export const Phone = ({
|
|||||||
} else {
|
} else {
|
||||||
clientGoOffline();
|
clientGoOffline();
|
||||||
}
|
}
|
||||||
|
toast({
|
||||||
|
title: `User is not registered${args.cause ? `, ${args.cause}` : ""}`,
|
||||||
|
status: "warning",
|
||||||
|
duration: DEFAULT_TOAST_DURATION,
|
||||||
|
isClosable: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
sipClient.on(SipConstants.UA_DISCONNECTED, (args) => {
|
||||||
|
setStatus("disconnected");
|
||||||
});
|
});
|
||||||
// Call Status
|
// Call Status
|
||||||
sipClient.on(SipConstants.SESSION_RINGING, (args) => {
|
sipClient.on(SipConstants.SESSION_RINGING, (args) => {
|
||||||
@@ -402,8 +420,9 @@ export const Phone = ({
|
|||||||
<JambonzSwitch
|
<JambonzSwitch
|
||||||
onlabel="Online"
|
onlabel="Online"
|
||||||
offLabel="Offline"
|
offLabel="Offline"
|
||||||
initialCheck={status === "online"}
|
initialCheck={isOnline() || isForceChangeUaStatus}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
|
setIsForceChangeUaStatus(true);
|
||||||
handleGoOffline(v ? "online" : "offline");
|
handleGoOffline(v ? "online" : "offline");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import PasswordInput from "src/components/password-input";
|
import PasswordInput from "src/components/password-input";
|
||||||
import { getSettings, saveSettings } from "src/storage";
|
import { getSettings, saveSettings } from "src/storage";
|
||||||
import InfoIcon from "src/imgs/icons/Info.svg";
|
|
||||||
import ResetIcon from "src/imgs/icons/Reset.svg";
|
import ResetIcon from "src/imgs/icons/Reset.svg";
|
||||||
import { AppSettings } from "src/common/types";
|
import { AppSettings } from "src/common/types";
|
||||||
import { DEFAULT_TOAST_DURATION } from "src/common/constants";
|
import { DEFAULT_TOAST_DURATION } from "src/common/constants";
|
||||||
|
|||||||
Reference in New Issue
Block a user