4 changed files with 80 additions and 80 deletions

No files matched your search

+46 -44
View File
@@ -1,13 +1,15 @@
# comment this out if your server has a different table/location for phone_number # comment this out if your server has a different table/location for phone_number
# or if it already exists in the users table # or if it already exists in the users table
ALTER TABLE `users` ADD COLUMN `phone_number` VARCHAR(20) DEFAULT NULL; 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` ( CREATE TABLE IF NOT EXISTS npwd_phone_contacts (
`id` int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL, identifier varchar(60) DEFAULT NULL,
`avatar` varchar(512) DEFAULT NULL, avatar varchar(512) DEFAULT NULL,
`number` varchar(10) DEFAULT NULL, number varchar(10) DEFAULT NULL,
`display` varchar(60) NOT NULL DEFAULT '', display varchar(60) NOT NULL DEFAULT '',
PRIMARY KEY (id) PRIMARY KEY (id)
); );
@@ -17,7 +19,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`likes` int NOT NULL DEFAULT '0', `likes` int NOT NULL DEFAULT '0',
`identifier` varchar(48) NOT NULL, `identifier` varchar(40) NOT NULL,
`visible` tinyint NOT NULL DEFAULT '1', `visible` tinyint NOT NULL DEFAULT '1',
`images` varchar(1000) DEFAULT '', `images` varchar(1000) DEFAULT '',
`retweet` int DEFAULT NULL, `retweet` int DEFAULT NULL,
@@ -28,7 +30,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` ( CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` (
`id` int NOT NULL AUTO_INCREMENT, `id` int NOT NULL AUTO_INCREMENT,
`profile_name` varchar(90) NOT NULL, `profile_name` varchar(90) NOT NULL,
`identifier` varchar(48) NOT NULL, `identifier` varchar(40) NOT NULL,
# Default Profile avatar can be set here # Default Profile avatar can be set here
`avatar_url` varchar(255) DEFAULT 'https://beta.iodine.gg/QrEvq.png', `avatar_url` varchar(255) DEFAULT 'https://beta.iodine.gg/QrEvq.png',
`bio` varchar(512) DEFAULT NULL, `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` ( CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
`id` int NOT NULL AUTO_INCREMENT, `id` int NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) NOT NULL, `identifier` varchar(255) NOT NULL,
`name` varchar(90) NOT NULL, `name` varchar(90) NOT NULL,
`image` varchar(255) NOT NULL, `image` varchar(255) NOT NULL,
`bio` varchar(512) DEFAULT 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` ( CREATE TABLE IF NOT EXISTS `npwd_match_views` (
`id` int NOT NULL AUTO_INCREMENT, `id` int NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) NOT NULL, `identifier` varchar(40) NOT NULL,
`profile` int NOT NULL, `profile` int NOT NULL,
`liked` tinyint DEFAULT '0', `liked` tinyint DEFAULT '0',
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `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`) CONSTRAINT `match_profile` FOREIGN KEY (`profile`) REFERENCES `npwd_match_profiles` (`id`)
); );
CREATE TABLE IF NOT EXISTS `npwd_notes` ( CREATE TABLE IF NOT EXISTS npwd_notes (
`id` int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) NOT NULL, identifier varchar(255) NOT NULL,
`title` varchar(255) NOT NULL, title varchar(255) NOT NULL,
`content` varchar(255) NOT NULL, content varchar(255) NOT NULL,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
CREATE TABLE IF NOT EXISTS `npwd_marketplace_listings` ( CREATE TABLE IF NOT EXISTS npwd_marketplace_listings (
`id` int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL, identifier varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL, username varchar(255) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL, name varchar(50) DEFAULT NULL,
`number` varchar(255) NOT NULL, number varchar(255) NOT NULL,
`title` varchar(255) DEFAULT NULL, title varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL, url varchar(255) DEFAULT NULL,
`description` varchar(255) NOT NULL, description varchar(255) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, createdAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, updatedAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
CREATE TABLE IF NOT EXISTS `npwd_marketplace_reports` ( CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
`id` int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
`listing_id` int(11) DEFAULT NULL, listing_id int(11) DEFAULT NULL,
`profile` varchar(255) DEFAULT NULL, profile varchar(255) DEFAULT NULL,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
@@ -123,11 +125,11 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
CREATE TABLE IF NOT EXISTS `npwd_messages_groups` ( CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
`id` int NOT NULL AUTO_INCREMENT, `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, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`group_id` varchar(512) NOT NULL, `group_id` varchar(512) NOT NULL,
`participant_identifier` varchar(48) NOT NULL, `participant_identifier` varchar(40) NOT NULL,
`label` varchar(60) DEFAULT '', `label` varchar(60) DEFAULT '',
`unreadCount` int(11) NOT NULL DEFAULT 0, `unreadCount` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
@@ -135,7 +137,7 @@ CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
CREATE TABLE IF NOT EXISTS `npwd_messages_labels` ( CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
`id` int NOT NULL AUTO_INCREMENT, `id` int NOT NULL AUTO_INCREMENT,
`user_identifier` varchar(48) NOT NULL, `user_identifier` varchar(40) NOT NULL,
`label` varchar(60) NOT NULL, `label` varchar(60) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE 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` ( CREATE TABLE IF NOT EXISTS `npwd_messages` (
`id` int NOT NULL AUTO_INCREMENT, `id` int NOT NULL AUTO_INCREMENT,
`message` varchar(512) NOT NULL, `message` varchar(512) NOT NULL,
`user_identifier` varchar(48) NOT NULL, `user_identifier` varchar(40) NOT NULL,
`group_id` varchar(512) NOT NULL, `group_id` varchar(512) NOT NULL,
`isRead` tinyint NOT NULL DEFAULT '0', `isRead` tinyint NOT NULL DEFAULT '0',
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -155,20 +157,20 @@ CREATE TABLE IF NOT EXISTS `npwd_messages` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
); );
CREATE TABLE IF NOT EXISTS `npwd_calls` ( CREATE TABLE IF NOT EXISTS npwd_calls (
`id` int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL, identifier varchar(255) DEFAULT NULL,
`transmitter` varchar(255) NOT NULL, transmitter varchar(255) NOT NULL,
`receiver` varchar(255) NOT NULL, receiver varchar(255) NOT NULL,
`is_accepted` tinyint(4) DEFAULT 0, is_accepted tinyint(4) DEFAULT 0,
`start` varchar(255) DEFAULT NULL, start varchar(255) DEFAULT NULL,
end varchar(255) DEFAULT NULL, end varchar(255) DEFAULT NULL,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
CREATE TABLE IF NOT EXISTS npwd_phone_gallery ( CREATE TABLE IF NOT EXISTS npwd_phone_gallery (
`id` int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(48) DEFAULT NULL, identifier varchar(255) DEFAULT NULL,
`image` varchar(255) DEFAULT NULL, image varchar(255) DEFAULT NULL,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
@@ -52,7 +52,6 @@ export const DialerInput = () => {
className={classes.input} className={classes.input}
value={inputVal} value={inputVal}
onChange={(e) => set(e.target.value)} onChange={(e) => set(e.target.value)}
type="number"
/> />
<IconButton color="primary" className={classes.iconBtn} disabled={inputVal <= ''}> <IconButton color="primary" className={classes.iconBtn} disabled={inputVal <= ''}>
<PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} /> <PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} />
@@ -3,9 +3,7 @@ import qs from 'qs';
import Nui from '../../../../os/nui-events/utils/Nui'; import Nui from '../../../../os/nui-events/utils/Nui';
import Modal from '../../../../ui/components/Modal'; import Modal from '../../../../ui/components/Modal';
import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrary'; import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrary';
import { Box, Typography, TextField, Button } from '@material-ui/core'; import { Box, Typography, Button } from '@material-ui/core';
import FileCopyIcon from '@material-ui/icons/FileCopy';
import useStyles from './modal.styles';
import { useHistory, useLocation } from 'react-router-dom'; import { useHistory, useLocation } from 'react-router-dom';
import { ContextMenu } from '../../../../ui/components/ContextMenu'; import { ContextMenu } from '../../../../ui/components/ContextMenu';
import { deleteQueryFromLocation } from '../../../../common/utils/deleteQueryFromLocation'; import { deleteQueryFromLocation } from '../../../../common/utils/deleteQueryFromLocation';
@@ -20,12 +18,8 @@ interface IProps {
} }
export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IProps) => { export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IProps) => {
const classes = useStyles();
const history = useHistory(); const history = useHistory();
const { pathname, search } = useLocation(); const { pathname, search } = useLocation();
const [message, setMessage] = useState('');
const [pasteVisible, setPasteVisible] = useState(false);
const [queryParamImagePreview, setQueryParamImagePreview] = useState(null); const [queryParamImagePreview, setQueryParamImagePreview] = useState(null);
const removeQueryParamImage = useCallback(() => { const removeQueryParamImage = useCallback(() => {
@@ -55,21 +49,10 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
useEffect(() => { useEffect(() => {
if (!image) return; if (!image) return;
setQueryParamImagePreview(image); setQueryParamImagePreview(image);
}, [image, sendFromQueryParam]); }, [image]);
const sendFromClipboard = (event) => {
if (event.key === 'Enter') {
sendImageMessage(message);
}
};
const menuOptions = useMemo( const menuOptions = useMemo(
() => [ () => [
{
label: 'Paste from clipboard',
icon: <FileCopyIcon />,
onClick: () => setPasteVisible(true),
},
{ {
label: 'Camera / Gallery', label: 'Camera / Gallery',
icon: <PhotoLibraryIcon />, icon: <PhotoLibraryIcon />,
@@ -90,7 +73,7 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
<Modal visible={queryParamImagePreview} handleClose={removeQueryParamImage}> <Modal visible={queryParamImagePreview} handleClose={removeQueryParamImage}>
<Box py={1}> <Box py={1}>
<Typography paragraph>Do you want to share this image?</Typography> <Typography paragraph>Do you want to share this image?</Typography>
<PictureResponsive src={queryParamImagePreview} alt={'Share gallery image preview'} /> <PictureResponsive src={queryParamImagePreview} alt="Share gallery image preview" />
<Button <Button
fullWidth fullWidth
variant="contained" variant="contained"
@@ -101,21 +84,6 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
</Button> </Button>
</Box> </Box>
</Modal> </Modal>
<Modal visible={pasteVisible} handleClose={() => setPasteVisible(false)}>
<Box p={1}>
<TextField
placeholder="A link to your image or gif"
onChange={(e) => setMessage(e.target.value)}
value={message}
fullWidth
inputProps={{
className: classes.messagesInput,
}}
inputRef={(input) => input && input.focus()}
onKeyPress={sendFromClipboard}
/>
</Box>
</Modal>
</> </>
); );
}; };
+31
View File
@@ -11,6 +11,7 @@ import { BankEvents } from '../../typings/bank';
import { PhotoEvents } from '../../typings/photo'; import { PhotoEvents } from '../../typings/photo';
import { CallEvents } from '../../typings/call'; import { CallEvents } from '../../typings/call';
import { MatchEvents } from '../../typings/match'; import { MatchEvents } from '../../typings/match';
import { Delay } from '../utils/fivem';
let isPhoneOpen = false; let isPhoneOpen = false;
let isPhoneReady = false; let isPhoneReady = false;
@@ -51,6 +52,7 @@ const getCurrentGameTime = () => {
const showPhone = async (): Promise<void> => { const showPhone = async (): Promise<void> => {
isPhoneOpen = true; isPhoneOpen = true;
disableControls();
const time = getCurrentGameTime(); const time = getCurrentGameTime();
await phoneOpenAnim(); // Animation starts before the phone is open await phoneOpenAnim(); // Animation starts before the phone is open
emitNet('phone:getCredentials'); emitNet('phone:getCredentials');
@@ -58,6 +60,7 @@ const showPhone = async (): Promise<void> => {
sendMessage('PHONE', 'setVisibility', true); sendMessage('PHONE', 'setVisibility', true);
sendMessage('PHONE', 'setTime', time); sendMessage('PHONE', 'setTime', time);
SetNuiFocus(true, true); SetNuiFocus(true, true);
SetNuiFocusKeepInput(true);
}; };
const hidePhone = async (): Promise<void> => { const hidePhone = async (): Promise<void> => {
@@ -65,6 +68,7 @@ const hidePhone = async (): Promise<void> => {
sendMessage('PHONE', 'setVisibility', false); sendMessage('PHONE', 'setVisibility', false);
await phoneCloseAnim(); await phoneCloseAnim();
SetNuiFocus(false, false); SetNuiFocus(false, false);
SetNuiFocusKeepInput(false);
}; };
/* * * * * * * * * * * * * /* * * * * * * * * * * * *
@@ -196,3 +200,30 @@ on(`__cfx_nui:${PhoneEvents.CLOSE_PHONE}`, async (data: any, cb: Function) => {
// const time = getCurrentGameTime() // const time = getCurrentGameTime()
// sendMessage('PHONE', 'setTime', time) // sendMessage('PHONE', 'setTime', time)
// }, 2000); // }, 2000);
function disableControls(): void {
let timeoutFinished = false;
const loopTick = setTick(
async (useTimeout = false): Promise<void> => {
if (!isPhoneOpen) {
clearTick(loopTick);
return;
}
if (isPhoneOpen) {
DisableControlAction(0, 1, true);
DisableControlAction(0, 2, true);
DisableControlAction(0, 16, true);
DisableControlAction(0, 17, true);
if (useTimeout) {
setTimeout(() => {
timeoutFinished = true;
}, 5000);
}
} else {
await Delay(30000);
}
},
);
}