mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-01 14:38:47 +00:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3697201afe | ||
|
|
833efedec4 | ||
|
|
ffd21c4e6d | ||
|
|
b1b83b5021 | ||
|
|
214da78056 | ||
|
|
b9243e9ca3 | ||
|
|
d15273b7b1 | ||
|
|
7b1d30f265 | ||
|
|
9610891a04 | ||
|
|
e6deff23da | ||
|
|
a0c5f94514 | ||
|
|
75500a01f8 | ||
|
|
2ee206b83e | ||
|
|
c3ee168d55 | ||
|
|
8b746c8185 | ||
|
|
d363866a34 |
No files matched your search
+46
-44
@@ -1,13 +1,15 @@
|
||||
# comment this out if your server has a different table/location for phone_number
|
||||
# or if it already exists in the users table
|
||||
ALTER TABLE `users` ADD COLUMN `phone_number` VARCHAR(20) DEFAULT NULL;
|
||||
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('phone', 'Phone', 1, 0, 1);
|
||||
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('dphone', 'Destroyed Phone', 1, 0, 1);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_phone_contacts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) DEFAULT NULL,
|
||||
`avatar` varchar(512) DEFAULT NULL,
|
||||
`number` varchar(10) DEFAULT NULL,
|
||||
`display` varchar(60) NOT NULL DEFAULT '',
|
||||
CREATE TABLE IF NOT EXISTS npwd_phone_contacts (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
identifier varchar(60) DEFAULT NULL,
|
||||
avatar varchar(512) DEFAULT NULL,
|
||||
number varchar(10) DEFAULT NULL,
|
||||
display varchar(60) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@@ -17,7 +19,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`likes` int NOT NULL DEFAULT '0',
|
||||
`identifier` varchar(48) NOT NULL,
|
||||
`identifier` varchar(40) NOT NULL,
|
||||
`visible` tinyint NOT NULL DEFAULT '1',
|
||||
`images` varchar(1000) DEFAULT '',
|
||||
`retweet` int DEFAULT NULL,
|
||||
@@ -28,7 +30,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
|
||||
CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`profile_name` varchar(90) NOT NULL,
|
||||
`identifier` varchar(48) NOT NULL,
|
||||
`identifier` varchar(40) NOT NULL,
|
||||
# Default Profile avatar can be set here
|
||||
`avatar_url` varchar(255) DEFAULT 'https://beta.iodine.gg/QrEvq.png',
|
||||
`bio` varchar(512) DEFAULT NULL,
|
||||
@@ -54,7 +56,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_likes` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) NOT NULL,
|
||||
`identifier` varchar(255) NOT NULL,
|
||||
`name` varchar(90) NOT NULL,
|
||||
`image` varchar(255) NOT NULL,
|
||||
`bio` varchar(512) DEFAULT NULL,
|
||||
@@ -70,7 +72,7 @@ CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_match_views` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) NOT NULL,
|
||||
`identifier` varchar(40) NOT NULL,
|
||||
`profile` int NOT NULL,
|
||||
`liked` tinyint DEFAULT '0',
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
@@ -80,32 +82,32 @@ CREATE TABLE IF NOT EXISTS `npwd_match_views` (
|
||||
CONSTRAINT `match_profile` FOREIGN KEY (`profile`) REFERENCES `npwd_match_profiles` (`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_notes` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`content` varchar(255) NOT NULL,
|
||||
CREATE TABLE IF NOT EXISTS npwd_notes (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
identifier varchar(255) NOT NULL,
|
||||
title varchar(255) NOT NULL,
|
||||
content varchar(255) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_marketplace_listings` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) DEFAULT NULL,
|
||||
`username` varchar(255) DEFAULT NULL,
|
||||
`name` varchar(50) DEFAULT NULL,
|
||||
`number` varchar(255) NOT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`url` varchar(255) DEFAULT NULL,
|
||||
`description` varchar(255) NOT NULL,
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
CREATE TABLE IF NOT EXISTS npwd_marketplace_listings (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
identifier varchar(255) DEFAULT NULL,
|
||||
username varchar(255) DEFAULT NULL,
|
||||
name varchar(50) DEFAULT NULL,
|
||||
number varchar(255) NOT NULL,
|
||||
title varchar(255) DEFAULT NULL,
|
||||
url varchar(255) DEFAULT NULL,
|
||||
description varchar(255) NOT NULL,
|
||||
createdAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updatedAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_marketplace_reports` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`listing_id` int(11) DEFAULT NULL,
|
||||
`profile` varchar(255) DEFAULT NULL,
|
||||
CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
listing_id int(11) DEFAULT NULL,
|
||||
profile varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@@ -123,11 +125,11 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`user_identifier` varchar(48) NOT NULL,
|
||||
`user_identifier` varchar(40) NOT NULL,
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`group_id` varchar(512) NOT NULL,
|
||||
`participant_identifier` varchar(48) NOT NULL,
|
||||
`participant_identifier` varchar(40) NOT NULL,
|
||||
`label` varchar(60) DEFAULT '',
|
||||
`unreadCount` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
@@ -135,7 +137,7 @@ CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`user_identifier` varchar(48) NOT NULL,
|
||||
`user_identifier` varchar(40) NOT NULL,
|
||||
`label` varchar(60) NOT NULL,
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
@@ -146,7 +148,7 @@ CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
|
||||
CREATE TABLE IF NOT EXISTS `npwd_messages` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`message` varchar(512) NOT NULL,
|
||||
`user_identifier` varchar(48) NOT NULL,
|
||||
`user_identifier` varchar(40) NOT NULL,
|
||||
`group_id` varchar(512) NOT NULL,
|
||||
`isRead` tinyint NOT NULL DEFAULT '0',
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
@@ -155,20 +157,20 @@ CREATE TABLE IF NOT EXISTS `npwd_messages` (
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `npwd_calls` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) DEFAULT NULL,
|
||||
`transmitter` varchar(255) NOT NULL,
|
||||
`receiver` varchar(255) NOT NULL,
|
||||
`is_accepted` tinyint(4) DEFAULT 0,
|
||||
`start` varchar(255) DEFAULT NULL,
|
||||
CREATE TABLE IF NOT EXISTS npwd_calls (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
identifier varchar(255) DEFAULT NULL,
|
||||
transmitter varchar(255) NOT NULL,
|
||||
receiver varchar(255) NOT NULL,
|
||||
is_accepted tinyint(4) DEFAULT 0,
|
||||
start varchar(255) DEFAULT NULL,
|
||||
end varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS npwd_phone_gallery (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(48) DEFAULT NULL,
|
||||
`image` varchar(255) DEFAULT NULL,
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
identifier varchar(255) DEFAULT NULL,
|
||||
image varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
+10
-5
@@ -5,7 +5,6 @@ import { Route } from 'react-router-dom';
|
||||
import { CallModal } from './os/call/components/CallModal';
|
||||
import { HomeApp } from './apps/home/components/Home';
|
||||
import { Box, Paper, Slide, Typography } from '@material-ui/core';
|
||||
import { useKeyboardService } from './os/keyboard/hooks/useKeyboardService';
|
||||
import { NotificationBar } from './os/notifications/components/NotificationBar';
|
||||
import { Navigation } from './os/navigation-bar/components/Navigation';
|
||||
import { useNuiService } from './os/nui-events/hooks/useNuiService';
|
||||
@@ -33,6 +32,8 @@ import WindowSnackbar from './ui/components/WindowSnackbar';
|
||||
import { usePhone } from './os/phone/hooks/usePhone';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSnackbar } from './ui/hooks/useSnackbar';
|
||||
import { PhoneEvents } from '../../typings/phone';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
function Phone() {
|
||||
const { t, i18n } = useTranslation();
|
||||
@@ -62,7 +63,6 @@ function Phone() {
|
||||
}, []);
|
||||
|
||||
useNuiService();
|
||||
useKeyboardService();
|
||||
usePhoneService();
|
||||
useSimcardService();
|
||||
useContactsService();
|
||||
@@ -151,15 +151,20 @@ function Phone() {
|
||||
|
||||
export default Phone;
|
||||
|
||||
InjectDebugData([
|
||||
InjectDebugData<any>([
|
||||
{
|
||||
app: 'PHONE',
|
||||
method: 'setVisibility',
|
||||
method: PhoneEvents.SET_VISIBILITY,
|
||||
data: true,
|
||||
},
|
||||
{
|
||||
app: 'PHONE',
|
||||
method: 'setPhoneReady',
|
||||
method: PhoneEvents.SET_PHONE_READY,
|
||||
data: true,
|
||||
},
|
||||
{
|
||||
app: 'PHONE',
|
||||
method: PhoneEvents.SET_TIME,
|
||||
data: dayjs().format('hh:mm'),
|
||||
},
|
||||
]);
|
||||
@@ -7,7 +7,6 @@ import { useBankNotification } from './useBankNotification';
|
||||
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BankEvents } from '../../../../../typings/bank';
|
||||
import { PhoneEvents } from '../../../../../typings/phone';
|
||||
|
||||
export const useBankService = () => {
|
||||
const setTransaction = useSetRecoilState(bankState.transactions);
|
||||
|
||||
@@ -7,9 +7,8 @@ import ShareIcon from '@material-ui/icons/Share';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||
import { ICameraPhoto } from '../../hooks/usePhotos';
|
||||
import { ShareModal } from './ShareModal';
|
||||
import { PhotoEvents } from '../../../../../../typings/photo';
|
||||
import { IPhoto, PhotoEvents } from '../../../../../../typings/photo';
|
||||
|
||||
export const GalleryModal = () => {
|
||||
const classes = useStyles();
|
||||
@@ -19,10 +18,9 @@ export const GalleryModal = () => {
|
||||
|
||||
const [shareOpen, setShareOpen] = useState(null);
|
||||
|
||||
const meta: ICameraPhoto = useMemo(
|
||||
() => ({ id: query.id as string, image: query.image as string }),
|
||||
[query],
|
||||
);
|
||||
const meta: IPhoto = useMemo(() => ({ id: parseInt(query.id), image: query.image as string }), [
|
||||
query,
|
||||
]);
|
||||
|
||||
const _handleClose = () => {
|
||||
history.push(referal);
|
||||
|
||||
@@ -5,11 +5,11 @@ import MessageIcon from '@material-ui/icons/Message';
|
||||
import { setClipboard } from '../../../../os/phone/hooks/useClipboard';
|
||||
|
||||
import useStyles from './modal.styles';
|
||||
import { ICameraPhoto } from '../../hooks/usePhotos';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { IPhoto } from '../../../../../../typings/photo';
|
||||
|
||||
interface IShareModalProps {
|
||||
meta: ICameraPhoto;
|
||||
meta: IPhoto;
|
||||
referal: string;
|
||||
onClose(): void;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { atom } from 'recoil';
|
||||
import { IPhoto } from '../../../../../typings/photo';
|
||||
|
||||
export const photoState = {
|
||||
photos: atom({
|
||||
photos: atom<IPhoto[]>({
|
||||
key: 'galleryPhotos',
|
||||
default: null,
|
||||
default: [],
|
||||
}),
|
||||
};
|
||||
@@ -1,11 +1,6 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { photoState } from './state';
|
||||
|
||||
export interface ICameraPhoto {
|
||||
id: string;
|
||||
image: string;
|
||||
}
|
||||
|
||||
export const usePhotos = (): ICameraPhoto[] | null => {
|
||||
return useRecoilValue<ICameraPhoto[] | null>(photoState.photos);
|
||||
export const usePhotos = () => {
|
||||
return useRecoilValue(photoState.photos);
|
||||
};
|
||||
@@ -1,24 +1,17 @@
|
||||
import { atom } from 'recoil';
|
||||
import { Contact } from '../../../../../typings/contact';
|
||||
|
||||
export const contactsState = {
|
||||
contacts: atom({
|
||||
contacts: atom<Contact[]>({
|
||||
key: 'contactsList',
|
||||
default: [],
|
||||
}),
|
||||
showModal: atom({
|
||||
showModal: atom<boolean>({
|
||||
key: 'showModal',
|
||||
default: false,
|
||||
}),
|
||||
filterContacts: atom({
|
||||
filterContacts: atom<string>({
|
||||
key: 'filterContacts',
|
||||
default: '',
|
||||
}),
|
||||
showContactsModal: atom({
|
||||
key: 'showContactModal',
|
||||
default: false,
|
||||
}),
|
||||
contactDetail: atom({
|
||||
key: 'contactDetail',
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -3,7 +3,7 @@ import { contactsState } from './state';
|
||||
|
||||
interface FilterdContactsProps {
|
||||
filteredContacts: string;
|
||||
setFilteredContacts: (contact: any) => void;
|
||||
setFilteredContacts: (searchTerm: string) => void;
|
||||
}
|
||||
|
||||
export const useFilteredContacts = (): FilterdContactsProps => {
|
||||
|
||||
@@ -8,7 +8,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 { CallEvents, ICall } from '../../../../../../typings/call';
|
||||
import { CallEvents, CallHistoryItem } from '../../../../../../typings/call';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Box, IconButton, ListItemIcon, ListItemText } from '@material-ui/core';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
@@ -55,7 +55,7 @@ export const DialerHistory = ({ calls }) => {
|
||||
|
||||
return (
|
||||
<List disablePadding>
|
||||
{calls.map((call: ICall) =>
|
||||
{calls.map((call: CallHistoryItem) =>
|
||||
call.transmitter === myNumber ? (
|
||||
<ListItem key={call.id} divider>
|
||||
<ListItemIcon>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { atom } from 'recoil';
|
||||
import { CallHistoryItem } from '../../../../../typings/call';
|
||||
|
||||
export const dialState = {
|
||||
history: atom({
|
||||
history: atom<CallHistoryItem[]>({
|
||||
key: 'dialHistory',
|
||||
default: [],
|
||||
}),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { ICall } from '../../../../../typings/call';
|
||||
import { dialState } from './state';
|
||||
|
||||
export const useDialHistory = () => {
|
||||
return useRecoilValue<ICall[]>(dialState.history);
|
||||
return useRecoilValue(dialState.history);
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { makeStyles, Button, TextField, Typography } from '@material-ui/core';
|
||||
import { makeStyles, Button, TextField } from '@material-ui/core';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { MarketplaceEvents } from '../../../../../../typings/marketplace';
|
||||
import { useSnackbar } from '../../../../ui/hooks/useSnackbar';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { atom } from 'recoil';
|
||||
import { MarketplaceListing } from '../../../../../typings/marketplace';
|
||||
|
||||
export const selloutState = {
|
||||
listing: atom({
|
||||
listing: atom<MarketplaceListing[]>({
|
||||
key: 'listing',
|
||||
default: [],
|
||||
}),
|
||||
|
||||
@@ -15,8 +15,6 @@ const useStyles = makeStyles({
|
||||
export function MatchBottomNavigation({ activePage, handleChange }) {
|
||||
const classes = useStyles();
|
||||
|
||||
console.log(activePage);
|
||||
|
||||
return (
|
||||
<BottomNavigation value={activePage} onChange={handleChange} className={classes.root}>
|
||||
<BottomNavigationAction component={Link} to="/match" icon={<HomeIcon />} />
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { atom } from 'recoil';
|
||||
import { FormattedMatch, FormattedProfile } from '../../../../../typings/match';
|
||||
|
||||
export const matchState = {
|
||||
profiles: atom({
|
||||
profiles: atom<FormattedProfile[]>({
|
||||
key: 'profiles',
|
||||
default: null,
|
||||
}),
|
||||
@@ -9,19 +10,19 @@ export const matchState = {
|
||||
key: 'errorLoadingProfiles',
|
||||
default: false,
|
||||
}),
|
||||
matches: atom({
|
||||
matches: atom<FormattedMatch[]>({
|
||||
key: 'matches',
|
||||
default: null,
|
||||
}),
|
||||
errorLoadingMatches: atom({
|
||||
errorLoadingMatches: atom<boolean>({
|
||||
key: 'errorLoadingMatches',
|
||||
default: false,
|
||||
}),
|
||||
myProfile: atom({
|
||||
myProfile: atom<FormattedProfile | null>({
|
||||
key: 'myProfile',
|
||||
default: null,
|
||||
}),
|
||||
noProfileExists: atom({
|
||||
noProfileExists: atom<boolean>({
|
||||
key: 'noProfileExists',
|
||||
default: false,
|
||||
}),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Box, List } from '@material-ui/core';
|
||||
import { MessageEvents, MessageGroup } from '../../../../../../typings/messages';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
import { MessageGroup } from '../../../../../../typings/messages';
|
||||
import useMessages from '../../hooks/useMessages';
|
||||
import MessageGroupItem from './MessageGroupItem';
|
||||
import useStyles from './list.styles';
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
import { atom } from 'recoil';
|
||||
import { CreateMessageGroupResult, Message, MessageGroup } from '../../../../../typings/messages';
|
||||
|
||||
export const messageState = {
|
||||
messageGroups: atom({
|
||||
messageGroups: atom<MessageGroup[]>({
|
||||
key: 'messageGroups',
|
||||
default: null,
|
||||
default: [],
|
||||
}),
|
||||
messages: atom({
|
||||
messages: atom<Message[]>({
|
||||
key: 'messages',
|
||||
default: null,
|
||||
}),
|
||||
activeMessageGroup: atom({
|
||||
activeMessageGroup: atom<MessageGroup>({
|
||||
key: 'activeMessageGroup',
|
||||
default: null,
|
||||
}),
|
||||
showNewMessageGroup: atom({
|
||||
showNewMessageGroup: atom<boolean>({
|
||||
key: 'showNewMessageGroup',
|
||||
default: false,
|
||||
}),
|
||||
createMessageGroupResult: atom({
|
||||
createMessageGroupResult: atom<CreateMessageGroupResult>({
|
||||
key: 'createMessageGroupResult',
|
||||
default: null,
|
||||
}),
|
||||
imageModal: atom({
|
||||
imageModal: atom<boolean>({
|
||||
key: 'useImageModal',
|
||||
default: false,
|
||||
}),
|
||||
unreadMessagesCount: atom({
|
||||
unreadMessagesCount: atom<number>({
|
||||
key: 'unreadMessagesCount',
|
||||
default: 0,
|
||||
})
|
||||
}),
|
||||
};
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { matchPath, useHistory } from 'react-router-dom';
|
||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
|
||||
@@ -14,7 +14,7 @@ interface IUseMessages {
|
||||
activeMessageGroup: MessageGroup | null;
|
||||
}
|
||||
|
||||
export default (): IUseMessages => {
|
||||
export default function useMessages(): IUseMessages {
|
||||
const [messages, setMessages] = useRecoilState<Message[] | null>(messageState.messages);
|
||||
const messageGroups = useRecoilValue<MessageGroup[] | null>(messageState.messageGroups);
|
||||
const [activeMessageGroup, _setActiveMessageGroup] = useRecoilState<MessageGroup | null>(
|
||||
@@ -54,4 +54,4 @@ export default (): IUseMessages => {
|
||||
activeMessageGroup,
|
||||
setActiveMessageGroup,
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -10,10 +10,8 @@ import {
|
||||
Tooltip,
|
||||
Typography,
|
||||
Switch,
|
||||
TextField,
|
||||
} from '@material-ui/core';
|
||||
import CreateIcon from '@material-ui/icons/Create';
|
||||
import { PictureThumbnail } from '../../../ui/components/PictureThumbnail';
|
||||
|
||||
interface ISettingItem {
|
||||
options?: any;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { AppWrapper } from '../../../ui/components';
|
||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
|
||||
@@ -106,7 +106,7 @@ const localStorageEffect = (key) => ({ setSelf, onSet }) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const settingsState = atom({
|
||||
export const settingsState = atom<IPhoneSettings>({
|
||||
key: 'settings',
|
||||
default: config.defaultSettings,
|
||||
effects_UNSTABLE: [localStorageEffect(NPWD_STORAGE_KEY)],
|
||||
|
||||
@@ -191,10 +191,6 @@
|
||||
{
|
||||
"label": "Default Light",
|
||||
"value": "default-light"
|
||||
},
|
||||
{
|
||||
"label": "Kiddo Dark",
|
||||
"value": "kiddo-dark"
|
||||
}
|
||||
],
|
||||
"debug": {
|
||||
|
||||
@@ -34,20 +34,5 @@
|
||||
}
|
||||
},
|
||||
"divider": "rgba(255, 255, 255, 0.12)"
|
||||
},
|
||||
"kiddo-dark": {
|
||||
"palette": {
|
||||
"type": "dark",
|
||||
"primary": {
|
||||
"main": "#EBFEF3"
|
||||
},
|
||||
"secondary": {
|
||||
"main": "#5E0035"
|
||||
},
|
||||
"background": {
|
||||
"default": "#033A18",
|
||||
"paper": "#011308"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,7 @@
|
||||
import React from 'react';
|
||||
import { blue, common, grey, purple } from '@material-ui/core/colors';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import {
|
||||
faAd,
|
||||
faPlaneArrival,
|
||||
faPhoneAlt,
|
||||
faWonSign,
|
||||
faStickyNote,
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import { faAd, faPlaneArrival, faPhoneAlt, faStickyNote } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faTwitter } from '@fortawesome/free-brands-svg-icons';
|
||||
|
||||
import ContactsIcon from '@material-ui/icons/Contacts';
|
||||
@@ -20,7 +14,6 @@ import { DialerApp } from '../../../apps/dialer/components/DialerApp';
|
||||
import { ContactsApp } from '../../../apps/contacts/components/ContactsApp';
|
||||
import { CalculatorApp } from '../../../apps/calculator/components/CalculatorApp';
|
||||
import { SettingsApp } from '../../../apps/settings/components/SettingsApp';
|
||||
import { BankApp } from '../../../apps/bank/components/BankApp';
|
||||
import { MessagesApp } from '../../../apps/messages/components/MessagesApp';
|
||||
import { MatchApp } from '../../../apps/match/components/MatchApp';
|
||||
import { TwitterApp } from '../../../apps/twitter/components/TwitterApp';
|
||||
|
||||
@@ -2,10 +2,10 @@ import React from 'react';
|
||||
import { Box, makeStyles } from '@material-ui/core';
|
||||
import { CallControls } from './CallControls';
|
||||
|
||||
interface ICallNotificationProps {
|
||||
onAccept(): void;
|
||||
onReject(): void;
|
||||
}
|
||||
// interface ICallNotificationProps {
|
||||
// onAccept(): void;
|
||||
// onReject(): void;
|
||||
// }
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { atom } from 'recoil';
|
||||
import { ActiveCall } from '../../../../../typings/call';
|
||||
|
||||
export const callerState = {
|
||||
currentCall: atom({
|
||||
currentCall: atom<ActiveCall>({
|
||||
key: 'currentCall',
|
||||
default: null,
|
||||
}),
|
||||
callModal: atom({
|
||||
callModal: atom<boolean>({
|
||||
key: 'callingModal',
|
||||
default: false,
|
||||
}),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { CallProps } from '../../../../../typings/call';
|
||||
import { ActiveCall } from '../../../../../typings/call';
|
||||
import Nui from '../../nui-events/utils/Nui';
|
||||
import { callerState } from './state';
|
||||
import { CallEvents } from '../../../../../typings/call';
|
||||
|
||||
interface CallHook {
|
||||
call: CallProps;
|
||||
call: ActiveCall;
|
||||
setCall: (details: any) => void;
|
||||
acceptCall(): void;
|
||||
rejectCall(): void;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { CallProps } from '../../../../../typings/call';
|
||||
import { ActiveCall } from '../../../../../typings/call';
|
||||
import { useApp } from '../../apps/hooks/useApps';
|
||||
import { useNotifications } from '../../notifications/hooks/useNotifications';
|
||||
import { useRingtoneSound } from '../../sound/hooks/useRingtoneSound';
|
||||
@@ -27,7 +27,7 @@ export const useCallNotifications = () => {
|
||||
notificationIcon,
|
||||
};
|
||||
|
||||
const setNotification = (call: CallProps) => {
|
||||
const setNotification = (call: ActiveCall) => {
|
||||
stop();
|
||||
if (!call || !call.active) {
|
||||
removeId(NOTIFICATION_ID);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useCall } from './useCall';
|
||||
import { CallEvents, CallProps } from '../../../../../typings/call';
|
||||
import { CallEvents, ActiveCall } from '../../../../../typings/call';
|
||||
import InjectDebugData from '../../debug/InjectDebugData';
|
||||
import { useCallModal } from './useCallModal';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
@@ -10,7 +10,7 @@ import { callerState } from './state';
|
||||
import { useCallNotifications } from './useCallNotifications';
|
||||
import { useDuration } from './useDuration';
|
||||
|
||||
InjectDebugData<CallProps | boolean>([
|
||||
InjectDebugData<ActiveCall | boolean>([
|
||||
/* {
|
||||
app: 'CALL',
|
||||
method: 'setCaller',
|
||||
@@ -56,11 +56,11 @@ export const useCallService = () => {
|
||||
}
|
||||
}, [history, modal, pathname, modalHasBeenOpenedThisCall]);
|
||||
|
||||
const _setCall = (_call: CallProps) => {
|
||||
const _setCall = (_call: ActiveCall) => {
|
||||
resetDuration();
|
||||
setCall(_call);
|
||||
setNotification(_call);
|
||||
};
|
||||
useNuiEvent<CallProps>('CALL', CallEvents.SET_CALLER, _setCall, call);
|
||||
useNuiEvent<ActiveCall>('CALL', CallEvents.SET_CALLER, _setCall, call);
|
||||
useNuiEvent<boolean>('CALL', CallEvents.SET_CALL_MODAL, setModal);
|
||||
};
|
||||
@@ -1,109 +0,0 @@
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { atom, useSetRecoilState, useRecoilValue } from 'recoil';
|
||||
import { usePhone } from '../../phone/hooks/usePhone';
|
||||
|
||||
const keyboardState = {
|
||||
ArrowRight: atom({
|
||||
key: 'ArrowRight',
|
||||
default: null,
|
||||
}),
|
||||
ArrowLeft: atom({
|
||||
key: 'ArrowLeft',
|
||||
default: null,
|
||||
}),
|
||||
ArrowUp: atom({
|
||||
key: 'ArrowUp',
|
||||
default: null,
|
||||
}),
|
||||
ArrowDown: atom({
|
||||
key: 'ArrowDown',
|
||||
default: null,
|
||||
}),
|
||||
Backspace: atom({
|
||||
key: 'Backspace',
|
||||
default: null,
|
||||
}),
|
||||
Enter: atom({
|
||||
key: 'Enter',
|
||||
default: null,
|
||||
}),
|
||||
Escape: atom({
|
||||
key: 'Escape',
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
|
||||
const validKeys = [
|
||||
'ArrowRight',
|
||||
'ArrowLeft',
|
||||
'ArrowUp',
|
||||
'ArrowDown',
|
||||
'Backspace',
|
||||
'Enter',
|
||||
'Escape',
|
||||
];
|
||||
|
||||
const isKeyValid = (key) => validKeys.indexOf(key) !== -1;
|
||||
|
||||
export const useKeyboardService = () => {
|
||||
const history = useHistory();
|
||||
const { closePhone } = usePhone();
|
||||
const getters = {
|
||||
ArrowRight: useRecoilValue(keyboardState.ArrowRight),
|
||||
ArrowLeft: useRecoilValue(keyboardState.ArrowLeft),
|
||||
ArrowUp: useRecoilValue(keyboardState.ArrowUp),
|
||||
ArrowDown: useRecoilValue(keyboardState.ArrowDown),
|
||||
Backspace: useRecoilValue(keyboardState.Backspace),
|
||||
Enter: useRecoilValue(keyboardState.Enter),
|
||||
Escape: useRecoilValue(keyboardState.Escape),
|
||||
};
|
||||
|
||||
const handlers = useRef(new Map());
|
||||
const setEscape = useSetRecoilState<any>(keyboardState.Escape);
|
||||
const setBackspace = useSetRecoilState(keyboardState.Backspace);
|
||||
|
||||
useEffect(
|
||||
function registerCustomKeys() {
|
||||
Object.keys(getters).forEach((g) => {
|
||||
handlers.current.set(g, getters[g]);
|
||||
});
|
||||
},
|
||||
[getters],
|
||||
);
|
||||
|
||||
useEffect(
|
||||
function handleNUIKeyboardMessage() {
|
||||
function onKeyUp(event) {
|
||||
const { key } = event;
|
||||
const callback = handlers.current.get(key);
|
||||
if (isKeyValid(key) && callback && callback.call) {
|
||||
return callback(event);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('keyup', onKeyUp);
|
||||
return () => window.removeEventListener('keyup', onKeyUp);
|
||||
},
|
||||
[getters],
|
||||
);
|
||||
|
||||
const backspaceHandler = useCallback(
|
||||
(event) => {
|
||||
if (['input', 'textarea'].includes(event.target.nodeName.toLowerCase())) {
|
||||
// Dont anything if we are typing something :)
|
||||
return;
|
||||
}
|
||||
history.goBack();
|
||||
},
|
||||
[history],
|
||||
);
|
||||
|
||||
useEffect(
|
||||
function registerDefaultHandlers() {
|
||||
handlers.current.set('Escape', () => closePhone());
|
||||
handlers.current.set('Backspace', backspaceHandler);
|
||||
},
|
||||
[setEscape, setBackspace, history, backspaceHandler, closePhone],
|
||||
);
|
||||
};
|
||||
@@ -26,7 +26,7 @@ function getParams(event, data): [RequestInfo, RequestInit] {
|
||||
];
|
||||
}
|
||||
|
||||
export default {
|
||||
const NuiUtils = {
|
||||
async send(event: any, data = {}) {
|
||||
return fetch(...getParams(event, data));
|
||||
},
|
||||
@@ -34,3 +34,5 @@ export default {
|
||||
return abortableFetch(...getParams(event, data));
|
||||
},
|
||||
};
|
||||
|
||||
export default NuiUtils;
|
||||
@@ -1,12 +0,0 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const phoneSettings = {
|
||||
theme: atom({
|
||||
key: 'settingTheme',
|
||||
default: 'default-dark',
|
||||
}),
|
||||
zoom: atom({
|
||||
key: 'settingZoom',
|
||||
default: '100%',
|
||||
}),
|
||||
};
|
||||
@@ -1,19 +1,20 @@
|
||||
import { atom } from 'recoil';
|
||||
import { IServerConfig } from '../../../../../typings/config';
|
||||
|
||||
export const phoneState = {
|
||||
visibility: atom({
|
||||
visibility: atom<boolean>({
|
||||
key: 'phoneVisibility',
|
||||
default: false,
|
||||
}),
|
||||
phoneConfig: atom({
|
||||
phoneConfig: atom<IServerConfig>({
|
||||
key: 'phoneConfig',
|
||||
default: undefined,
|
||||
default: null,
|
||||
}),
|
||||
phoneReady: atom({
|
||||
phoneReady: atom<boolean>({
|
||||
key: 'phoneReady',
|
||||
default: false,
|
||||
}),
|
||||
phoneTime: atom({
|
||||
phoneTime: atom<string>({
|
||||
key: 'phoneTime',
|
||||
default: null,
|
||||
}),
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { phoneState } from './state';
|
||||
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
|
||||
import { PhoneEvents } from '../../../../../typings/phone';
|
||||
|
||||
export const usePhoneService = () => {
|
||||
const setVisibility = useSetRecoilState(phoneState.visibility);
|
||||
const setPhoneConfig = useSetRecoilState(phoneState.phoneConfig);
|
||||
const setPhoneReady = useSetRecoilState(phoneState.phoneReady);
|
||||
const setPhoneTime = useSetRecoilState(phoneState.phoneTime);
|
||||
useNuiEvent('PHONE', 'setVisibility', setVisibility);
|
||||
useNuiEvent('PHONE', 'setPhoneReady', setPhoneReady);
|
||||
useNuiEvent('PHONE', 'phoneConfig', setPhoneConfig);
|
||||
useNuiEvent('PHONE', 'setTime', setPhoneTime);
|
||||
useNuiEvent('PHONE', PhoneEvents.SET_VISIBILITY, setVisibility);
|
||||
useNuiEvent('PHONE', PhoneEvents.SET_PHONE_READY, setPhoneReady);
|
||||
useNuiEvent('PHONE', PhoneEvents.SET_CONFIG, setPhoneConfig);
|
||||
useNuiEvent('PHONE', PhoneEvents.SET_TIME, setPhoneTime);
|
||||
};
|
||||
@@ -3,6 +3,7 @@ import { useSetRecoilState } from 'recoil';
|
||||
import { simcardState } from './state';
|
||||
import { useSimcard } from './useSimcard';
|
||||
import InjectDebugData from '../../debug/InjectDebugData';
|
||||
import { PhoneEvents } from '../../../../../typings/phone';
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
@@ -14,6 +15,6 @@ InjectDebugData([
|
||||
|
||||
export const useSimcardService = () => {
|
||||
const setNumber = useSetRecoilState(simcardState.number);
|
||||
useNuiEvent('SIMCARD', 'setNumber', setNumber);
|
||||
useNuiEvent('SIMCARD', PhoneEvents.SET_NUMBER, setNumber);
|
||||
return useSimcard();
|
||||
};
|
||||
@@ -2,13 +2,11 @@ import React from 'react';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
import Snackbar from '@material-ui/core/Snackbar';
|
||||
import Fade from '@material-ui/core/Fade';
|
||||
import { createMuiTheme, ThemeProvider } from '@material-ui/core';
|
||||
import { ThemeProvider } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { usePhone } from '../../os/phone/hooks/usePhone';
|
||||
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { settingsState } from '../../apps/settings/hooks/useSettings';
|
||||
import themeConfig from '../../config/default.json';
|
||||
import { usePhoneTheme } from '../../os/phone/hooks/usePhoneTheme';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
paper: {
|
||||
@@ -25,15 +23,14 @@ function Notification({ children, handleClose, open }) {
|
||||
const classes = useStyles();
|
||||
const { config } = usePhone();
|
||||
|
||||
const [settings] = useRecoilState(settingsState);
|
||||
const currentTheme = usePhoneTheme();
|
||||
|
||||
if (!config) return null;
|
||||
|
||||
const { horizontal, vertical } = config.notificationPosition;
|
||||
const currentTheme = () => createMuiTheme(themeConfig.themes[settings.theme.value]);
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={currentTheme()}>
|
||||
<ThemeProvider theme={currentTheme}>
|
||||
<Snackbar
|
||||
className={classes.snackBar}
|
||||
anchorOrigin={{ horizontal, vertical }}
|
||||
|
||||
+22
-19
@@ -1,5 +1,5 @@
|
||||
import { CallEvents } from '../../typings/call';
|
||||
import { ICall } from '../../typings/call';
|
||||
import { CallHistoryItem } from '../../typings/call';
|
||||
import { phoneCallStartAnim, phoneCallEndAnim } from './functions';
|
||||
|
||||
const exp = (global as any).exports;
|
||||
@@ -34,23 +34,26 @@ on(`__cfx_nui:${CallEvents.ACCEPT_CALL}`, (data: any, cb: Function) => {
|
||||
cb();
|
||||
});
|
||||
|
||||
onNet(CallEvents.WAS_ACCEPTED, (channelId: number, currentCall: ICall, isTransmitter: boolean) => {
|
||||
exp['mumble-voip'].SetCallChannel(channelId);
|
||||
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: CallEvents.SET_CALLER,
|
||||
data: {
|
||||
active: true,
|
||||
transmitter: currentCall.transmitter,
|
||||
receiver: currentCall.receiver,
|
||||
isTransmitter: isTransmitter,
|
||||
accepted: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
});
|
||||
onNet(
|
||||
CallEvents.WAS_ACCEPTED,
|
||||
(channelId: number, currentCall: CallHistoryItem, isTransmitter: boolean) => {
|
||||
exp['mumble-voip'].SetCallChannel(channelId);
|
||||
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'CALL',
|
||||
method: CallEvents.SET_CALLER,
|
||||
data: {
|
||||
active: true,
|
||||
transmitter: currentCall.transmitter,
|
||||
receiver: currentCall.receiver,
|
||||
isTransmitter: isTransmitter,
|
||||
accepted: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
RegisterNuiCallbackType(CallEvents.REJECTED); // Fires when cancelling and rejecting a call.
|
||||
on(`__cfx_nui:${CallEvents.REJECTED}`, (data: any, cb: Function) => {
|
||||
@@ -115,7 +118,7 @@ function openCallModal(show: boolean) {
|
||||
);
|
||||
}
|
||||
|
||||
onNet(CallEvents.SEND_HISTORY, (calls: ICall) => {
|
||||
onNet(CallEvents.SEND_HISTORY, (calls: CallHistoryItem[]) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: 'DIALER',
|
||||
|
||||
@@ -25,8 +25,8 @@ function fetchOnInitialize() {
|
||||
emitNet(ContactEvents.GET_CONTACTS);
|
||||
emitNet(MessageEvents.FETCH_MESSAGE_GROUPS);
|
||||
emitNet(TwitterEvents.GET_OR_CREATE_PROFILE);
|
||||
sendMessage('PHONE', 'setPhoneReady', isPhoneReady);
|
||||
sendMessage('PHONE', 'phoneConfig', config);
|
||||
sendMessage('PHONE', PhoneEvents.SET_PHONE_READY, isPhoneReady);
|
||||
sendMessage('PHONE', PhoneEvents.SET_CONFIG, config);
|
||||
}
|
||||
|
||||
RegisterKeyMapping('phone', 'Open Phone', 'keyboard', 'f1');
|
||||
@@ -55,14 +55,14 @@ const showPhone = async (): Promise<void> => {
|
||||
await phoneOpenAnim(); // Animation starts before the phone is open
|
||||
emitNet('phone:getCredentials');
|
||||
SetCursorLocation(0.9, 0.922); //Experimental
|
||||
sendMessage('PHONE', 'setVisibility', true);
|
||||
sendMessage('PHONE', 'setTime', time);
|
||||
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, true);
|
||||
sendMessage('PHONE', PhoneEvents.SET_TIME, time);
|
||||
SetNuiFocus(true, true);
|
||||
};
|
||||
|
||||
const hidePhone = async (): Promise<void> => {
|
||||
isPhoneOpen = false;
|
||||
sendMessage('PHONE', 'setVisibility', false);
|
||||
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, false);
|
||||
await phoneCloseAnim();
|
||||
SetNuiFocus(false, false);
|
||||
};
|
||||
@@ -115,15 +115,15 @@ onNet(PhoneEvents.PLAYER_IS_READY, fetchOnInitialize);
|
||||
|
||||
AddEventHandler('onResourceStop', function (resource: string) {
|
||||
if (resource === GetCurrentResourceName()) {
|
||||
sendMessage('PHONE', 'setVisibility', false);
|
||||
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, false);
|
||||
SetNuiFocus(false, false);
|
||||
removePhoneProp(); //Deletes the phone incase it was attached.
|
||||
ClearPedTasks(PlayerPedId()); //Leave here until launch as it'll fix any stuck animations.
|
||||
}
|
||||
});
|
||||
|
||||
onNet('phone:sendCredentials', (number: string) => {
|
||||
sendMessage('SIMCARD', 'setNumber', number);
|
||||
onNet(PhoneEvents.SEND_CREDENTIALS, (number: string) => {
|
||||
sendMessage('SIMCARD', PhoneEvents.SET_NUMBER, number);
|
||||
});
|
||||
|
||||
// DO NOT CHANGE THIS EITHER, PLEASE - CHIP
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { PhotoEvents } from '../../typings/photo';
|
||||
import { Delay } from '../utils/fivem';
|
||||
import { sendMessage, sendCameraEvent } from '../utils/messages';
|
||||
import { PhoneEvents } from '../../typings/phone';
|
||||
const SCREENSHOT_BASIC_TOKEN = GetConvar('SCREENSHOT_BASIC_TOKEN', 'none');
|
||||
|
||||
const exp = (global as any).exports;
|
||||
@@ -9,12 +10,12 @@ let inCameraMode = false;
|
||||
|
||||
function closePhoneTemp() {
|
||||
SetNuiFocus(false, false);
|
||||
sendMessage('PHONE', 'setVisibility', false);
|
||||
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, false);
|
||||
}
|
||||
|
||||
function openPhoneTemp() {
|
||||
SetNuiFocus(true, true);
|
||||
sendMessage('PHONE', 'setVisibility', true);
|
||||
sendMessage('PHONE', PhoneEvents.SET_VISIBILITY, true);
|
||||
}
|
||||
|
||||
function CellFrontCamActivate(activate: boolean) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CallEvents } from '../../typings/call';
|
||||
import { getIdentifierByPhoneNumber, getPlayer, getSource } from './functions';
|
||||
import { getPlayerFromIdentifier } from './functions';
|
||||
import { ICall } from '../../typings/call';
|
||||
import { CallHistoryItem } from '../../typings/call';
|
||||
|
||||
import { pool } from './db';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@@ -9,25 +9,25 @@ import { mainLogger } from './sv_logger';
|
||||
|
||||
const callLogger = mainLogger.child({ module: 'calls' });
|
||||
|
||||
async function saveCall(call: ICall) {
|
||||
async function saveCall(call: CallHistoryItem) {
|
||||
const query =
|
||||
'INSERT INTO npwd_calls (identifier, transmitter, receiver, start) VALUES (?, ?, ?, ?)';
|
||||
await pool.query(query, [call.identifier, call.transmitter, call.receiver, call.start]);
|
||||
}
|
||||
|
||||
async function updateCall(call: ICall, isAccepted: boolean, end: number) {
|
||||
async function updateCall(call: CallHistoryItem, isAccepted: boolean, end: number) {
|
||||
const query = 'UPDATE npwd_calls SET is_accepted=?, end=? WHERE identifier = ?';
|
||||
await pool.query(query, [isAccepted, end, call.identifier]);
|
||||
}
|
||||
|
||||
async function fetchCalls(phoneNumber: string): Promise<ICall[]> {
|
||||
async function fetchCalls(phoneNumber: string): Promise<CallHistoryItem[]> {
|
||||
const query = 'SELECT * FROM npwd_calls WHERE receiver = ? OR transmitter = ? ORDER BY id DESC';
|
||||
const [result] = await pool.query(query, [phoneNumber, phoneNumber]);
|
||||
const calls = <ICall[]>result;
|
||||
const calls = <CallHistoryItem[]>result;
|
||||
return calls;
|
||||
}
|
||||
|
||||
let calls: Map<string, ICall> = new Map();
|
||||
let calls: Map<string, CallHistoryItem> = new Map();
|
||||
|
||||
onNet(CallEvents.INITIALIZE_CALL, async (phoneNumber: string) => {
|
||||
const _source = getSource();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { pool } from './db';
|
||||
import { getIdentifier, getSource } from './functions';
|
||||
import { mainLogger } from './sv_logger';
|
||||
import { PhoneEvents } from '../../typings/phone';
|
||||
|
||||
interface Credentials {
|
||||
phone_number: string;
|
||||
@@ -19,7 +20,7 @@ onNet('phone:getCredentials', async () => {
|
||||
try {
|
||||
const identifier = getIdentifier(_source);
|
||||
const number = await getCredentials(identifier);
|
||||
emitNet('phone:sendCredentials', _source, number);
|
||||
emitNet(PhoneEvents.SEND_CREDENTIALS, _source, number);
|
||||
} catch (e) {
|
||||
mainLogger.error(`Failed to get a number, ${e.message}`, {
|
||||
source: _source,
|
||||
|
||||
+2
-9
@@ -1,4 +1,4 @@
|
||||
export interface CallProps {
|
||||
export interface ActiveCall {
|
||||
active: boolean;
|
||||
accepted: boolean;
|
||||
isTransmitter: boolean;
|
||||
@@ -6,7 +6,7 @@ export interface CallProps {
|
||||
receiver: string;
|
||||
}
|
||||
|
||||
export interface ICall {
|
||||
export interface CallHistoryItem {
|
||||
id?: number;
|
||||
identifier: string;
|
||||
transmitter: string;
|
||||
@@ -18,13 +18,6 @@ export interface ICall {
|
||||
accepted: boolean;
|
||||
}
|
||||
|
||||
export interface ICallDuration {
|
||||
ms: number;
|
||||
s: number;
|
||||
m: number;
|
||||
h: number;
|
||||
}
|
||||
|
||||
export enum CallEvents {
|
||||
INITIALIZE_CALL = 'npwd:beginCall',
|
||||
START_CALL = 'npwd:startCall',
|
||||
|
||||
@@ -11,5 +11,11 @@ export enum PhoneEvents {
|
||||
OPEN_PHONE = 'npwd:open',
|
||||
CLOSE_PHONE = 'npwd:close',
|
||||
SET_ALERT = 'npwd:setAlert',
|
||||
SET_VISIBILITY = 'npwd:setVisibility',
|
||||
SET_NOTIFICATION = 'npwd:setNotification',
|
||||
SET_NUMBER = 'npwd:setNumber',
|
||||
SET_PHONE_READY = 'npwd:phoneReady',
|
||||
SET_CONFIG = 'npwd:setPhoneConfig',
|
||||
SET_TIME = 'npwd:setGameTime',
|
||||
SEND_CREDENTIALS = 'npwd:sendCredentials',
|
||||
}
|
||||
Reference in new issue
Block a user