mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
feat(calling/dial): update interfaces
This commit is contained in:
1 parent
8ad85d8209
commit
c7b185014d
7 files changed
+8
-38
No files matched your search
+1
-1
@@ -30,7 +30,7 @@ import config from './config/default.json';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { useCallService } from './modal/hooks/useCallService';
|
||||
import { useModal } from './modal/hooks/useModal';
|
||||
import { useDailService } from './apps/dialer/hooks/useDailService';
|
||||
import { useDailService } from './apps/dialer/hooks/useDialService';
|
||||
|
||||
// Inject mock data when in development env.
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
import DialPage from './views/DialPage';
|
||||
import DialerNavBar from './DialerNavBar';
|
||||
import { useDailHistory } from '../hooks/useDailHistory';
|
||||
import { useDailHistory } from '../hooks/useDialHistory';
|
||||
|
||||
export const DialerApp = () => {
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ListItem } from '../../../../ui/components/ListItem';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui'
|
||||
import { useSimcard } from '../../../../os/simcard/hooks/useSimcard';
|
||||
import { useContacts } from '../../../contacts/hooks/useContacts';
|
||||
import { ICall } from '../../../../common/typings/call';
|
||||
|
||||
|
||||
export const DialerHistory = ({ calls }) => {
|
||||
@@ -25,7 +26,7 @@ export const DialerHistory = ({ calls }) => {
|
||||
|
||||
return (
|
||||
<List disablePadding>
|
||||
{calls.map((call) => call.transmitter === number ? (
|
||||
{calls.map((call: ICall) => call.transmitter === number ? (
|
||||
<ListItem key={call.id} divider button onClick={() => handleCall(call.receiver)}>
|
||||
<ListItemText primary={getDisplayByNumber(call.receiver)} secondary={call.timestamp} />
|
||||
{<PhoneForwardedIcon />}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { ICallUI } from '../../../common/typings/call';
|
||||
import { dailerState } from './state';
|
||||
|
||||
interface ICall {
|
||||
history: ICallUI[]
|
||||
}
|
||||
|
||||
export const useDailHistory = () => {
|
||||
const history = useRecoilValue(dailerState.history);
|
||||
return history;
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { dailerState } from './state';
|
||||
import { useDailHistory } from './useDailHistory';
|
||||
|
||||
export const useDailService = () => {
|
||||
const setHistory = useSetRecoilState(dailerState.history);
|
||||
useNuiEvent('DAILER', 'setHistory', setHistory);
|
||||
|
||||
return useDailHistory();
|
||||
};
|
||||
@@ -3,20 +3,13 @@ export interface CallProps {
|
||||
isTransmitter: boolean;
|
||||
transmitter: string;
|
||||
receiver: string;
|
||||
phone_number: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface ICall {
|
||||
id?: number;
|
||||
transmitter: string;
|
||||
transmitterSource: number;
|
||||
transmitterSource?: number;
|
||||
receiver: string;
|
||||
receiverSource: number;
|
||||
receiverSource?: number;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface ICallUI {
|
||||
transmitter: string;
|
||||
receiver: string;
|
||||
timestamp: string;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ export const CallModal = () => {
|
||||
const classes = useStyles();
|
||||
|
||||
const handleAcceptCall = () => {
|
||||
console.log('NUI CALL: ', call.phone_number);
|
||||
Nui.send('phone:acceptCall', {
|
||||
transmitterNumber: call.transmitter,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user