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