diff --git a/phone/src/apps/messages/components/MessagesApp.tsx b/phone/src/apps/messages/components/MessagesApp.tsx index 67f3668..f3dfeb6 100644 --- a/phone/src/apps/messages/components/MessagesApp.tsx +++ b/phone/src/apps/messages/components/MessagesApp.tsx @@ -36,9 +36,6 @@ export const MessagesApp = () => { render={() => ( <> - history.push('/messages/new')} - /> )} /> @@ -51,6 +48,9 @@ export const MessagesApp = () => { /> + history.push('/messages/new')} + /> ); @@ -72,6 +72,94 @@ InjectDebugData([ isMine: false, updatedAt: Date.now(), }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: false, + updatedAt: Date.now(), + }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: false, + updatedAt: Date.now(), + }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: false, + updatedAt: Date.now(), + }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: false, + updatedAt: Date.now(), + }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: false, + updatedAt: Date.now(), + }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: true, + updatedAt: Date.now(), + }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: false, + updatedAt: Date.now(), + }, + { + id: 1, + message: 'sup!', + user_identifier: '1234', + phone_number: '444-4444', + display: 'kidz', + avatar: null, + isRead: true, + isMine: true, + updatedAt: Date.now(), + }, ], }, { diff --git a/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx b/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx index 5e09974..389b77e 100644 --- a/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx +++ b/phone/src/apps/messages/components/buttons/NewMessageGroupButton.tsx @@ -3,11 +3,11 @@ import { makeStyles } from '@material-ui/core/styles'; import { Fab } from '@material-ui/core'; import AddIcon from '@material-ui/icons/Add'; -const useStyles = makeStyles(() => ({ +const useStyles = makeStyles((theme) => ({ root: { position: 'absolute', - bottom: '25px', - right: '15px', + bottom: theme.spacing(2), + right: theme.spacing(3), }, })); @@ -21,11 +21,13 @@ export function NewMessageGroupButton({ const classes = useStyles(); return ( -
- + -
); } diff --git a/phone/src/apps/messages/components/form/MessageInput.tsx b/phone/src/apps/messages/components/form/MessageInput.tsx index 60af078..0391b6c 100644 --- a/phone/src/apps/messages/components/form/MessageInput.tsx +++ b/phone/src/apps/messages/components/form/MessageInput.tsx @@ -1,7 +1,6 @@ import React, { FormEvent, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { Paper, TextField, Button } from '@material-ui/core'; -import useStyles from './form.styles'; +import { Paper, TextField, Button, Box, makeStyles } from '@material-ui/core'; import SendIcon from '@material-ui/icons/Send'; import ImageIcon from '@material-ui/icons/Image'; import Nui from '../../../../os/nui-events/utils/Nui'; @@ -11,9 +10,13 @@ interface IProps { messageGroupId: string | undefined; } +const useStyles = makeStyles({ + root: { position: 'absolute', bottom: 0, width: '100%' }, +}); + const MessageInput = ({ messageGroupId, onAddImageClick }: IProps) => { - const classes = useStyles(); const { t } = useTranslation(); + const classes = useStyles(); const [message, setMessage] = useState(''); const handleSubmit = (event: FormEvent) => { @@ -31,24 +34,28 @@ const MessageInput = ({ messageGroupId, onAddImageClick }: IProps) => { if (!messageGroupId) return null; return ( - -
- setMessage(e.target.value)} - placeholder={t('APPS_MESSAGES_NEW_MESSAGE')} - className={classes.input} - inputRef={(input) => input && input.focus()} - inputProps={{ - className: classes.messagesInput, - }} - /> - - + + + + + setMessage(e.target.value)} + placeholder={t('APPS_MESSAGES_NEW_MESSAGE')} + inputRef={(input) => input && input.focus()} + /> + + + + + + ); diff --git a/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx b/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx index 0fb6fd3..7e02b2f 100644 --- a/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx +++ b/phone/src/apps/messages/components/form/NewMessageGroupForm.tsx @@ -1,86 +1,110 @@ -import React, { FormEvent, useCallback, useEffect, useMemo, useState } from 'react'; +import React, { FormEvent, useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { TextField, Button } from '@material-ui/core'; +import { TextField, Button, Box } from '@material-ui/core'; -import useStyles from './form.styles'; import Nui from '../../../../os/nui-events/utils/Nui'; import { useHistory } from 'react-router-dom'; - -const sendNuiCreateMessageGroup = ({ parts, isGroupChat, labelValue }) => - Nui.send('phone:createMessageGroup', { - phoneNumbers: parts, - label: isGroupChat && labelValue ? labelValue : null, - }); +import { Autocomplete } from '@material-ui/lab'; +import { useContacts } from '../../../contacts/hooks/useContacts'; +import { Contact } from '../../../../common/typings/contact'; const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => { - const classes = useStyles(); const history = useHistory(); const { t } = useTranslation(); - const [participants, setParticipants] = useState(''); + const [participants, setParticipants] = useState([]); const [label, setLabel] = useState(''); - - // handles phone numbers in a csv format and strips all spaces and - // external characters out of them: - // 123-4567, 987-6543, 333-4444 - const getGroupParts = useCallback( - (numbers) => numbers.split(',').map((part) => part.replace(/[^0-9]/g, '')), - [] - ); - - const parts = useMemo(() => getGroupParts(participants), [participants, getGroupParts]); - - const isGroupChat = parts.length > 1; - - const labelValue = label.trim(); + const { contacts } = useContacts(); useEffect(() => { if (phoneNumber) { - sendNuiCreateMessageGroup({ parts: getGroupParts(phoneNumber), isGroupChat: false, labelValue: null }); - history.push('/messages'); + const find = contacts.find((c) => c.number === phoneNumber); + const newPart = find || { number: phoneNumber }; + setParticipants((all) => [...all, newPart]); } - }, [phoneNumber, labelValue, history, getGroupParts]); + }, [phoneNumber, contacts]); - const handleSubmit = (event: FormEvent) => { - event.preventDefault(); - if (parts.length > 0) { - sendNuiCreateMessageGroup({ parts, isGroupChat, labelValue }); - setParticipants(''); - history.push('/messages'); + const isGroupChat = participants.length > 1; + + const handleSubmit = useCallback( + (event: FormEvent) => { + event.preventDefault(); + + // handles phone numbers in a csv format and strips all spaces and + // external characters out of them: + // 123-4567, 987-6543, 333-4444 + const phoneNumbers = participants.map(({ number }) => + number.replace(/[^0-9]/g, '') + ); + const labelValue = isGroupChat ? label.trim() : null; + + if (phoneNumbers.length) { + Nui.send('phone:createMessageGroup', { + phoneNumbers, + label: labelValue, + }); + setParticipants([]); + history.push('/messages'); + } + }, + [history, label, participants, isGroupChat] + ); + + const onAutocompleteChange = useCallback((_e, value: any) => { + const lastIdx = value.length - 1; + if (typeof value[lastIdx] === 'string') { + value.splice(lastIdx, 1, { number: value[lastIdx] }); + setParticipants(value); + return; } - }; + setParticipants(value as any[]); + }, []); + + const renderAutocompleteInput = useCallback( + (params) => ( + + ), + [t] + ); + + const submitDisabled = !participants.length || (isGroupChat && !label); return ( -
- setParticipants(e.target.value || '')} - placeholder={t('APPS_MESSAGES_NEW_MESSAGE_GROUP')} - className={classes.newGroupinput} - autoFocus - inputProps={{ - className: classes.messagesInput, - }} - multiline - /> - {isGroupChat && ( - setLabel(e.target.value)} - placeholder={t('APPS_MESSAGES_GROUP_CHAT_LABEL')} - className={classes.newGroupinput} - inputProps={{ - className: classes.messagesInput, - }} + + + + value={participants} + multiple + freeSolo + autoHighlight + options={contacts || []} + getOptionLabel={(c) => c.display || c.number} + onChange={onAutocompleteChange} + renderInput={renderAutocompleteInput} /> + + {isGroupChat && ( + + setLabel(e.target.value)} + placeholder={t('APPS_MESSAGES_GROUP_CHAT_LABEL')} + /> + )} - + + + ); }; diff --git a/phone/src/apps/messages/components/form/form.styles.ts b/phone/src/apps/messages/components/form/form.styles.ts deleted file mode 100644 index 4bc363b..0000000 --- a/phone/src/apps/messages/components/form/form.styles.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { makeStyles } from '@material-ui/core'; - -const useStyles = makeStyles((theme) => ({ - sendButton: { - float: 'right', - }, - paper: { - position: 'absolute', - bottom: 0, - width: '100%', - }, - form: { - display: 'flex', - }, - input: { - width: '100%', - margin: 10, - }, - newGroupForm: { - position: 'absolute', - top: 65, - display: 'flex', - flexFlow: 'column nowrap', - justifyContent: 'flex-start', - width: '100%', - }, - newGroupSubmitButton: { - margin: '15px 8px 0px 8px', - }, - newGroupinput: { - margin: '0px 8px 15px 8px', - }, - messagesInput: { - fontSize: 20, - }, -})); - -export default useStyles; diff --git a/phone/src/apps/messages/components/modal/Conversation.tsx b/phone/src/apps/messages/components/modal/Conversation.tsx index e51a1d9..e5dcf33 100644 --- a/phone/src/apps/messages/components/modal/Conversation.tsx +++ b/phone/src/apps/messages/components/modal/Conversation.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { Paper, Typography } from '@material-ui/core'; +import { Box, Paper, Typography } from '@material-ui/core'; import { Message, MessageGroup } from '../../../../common/typings/messages'; import MessageInput from '../form/MessageInput'; @@ -32,9 +32,16 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => { isOpen={imageModalOpen} messageGroupId={activeMessageGroup.groupId} /> -
+ {messages.map((message) => ( -
+
{
))} -
+
setImageModalOpen(true)} diff --git a/phone/src/apps/messages/components/modal/modal.styles.ts b/phone/src/apps/messages/components/modal/modal.styles.ts index b572844..d3711cc 100644 --- a/phone/src/apps/messages/components/modal/modal.styles.ts +++ b/phone/src/apps/messages/components/modal/modal.styles.ts @@ -15,6 +15,9 @@ const useStyles = makeStyles((theme) => ({ flexFlow: 'row nowrap', padding: '3px 0px', }, + overflowAutoY: { + overflowY: 'auto', + }, groupdisplay: { width: '300px', paddingTop: '8px', @@ -28,15 +31,6 @@ const useStyles = makeStyles((theme) => ({ paddingTop: '8px', fontSize: '20px', }, - messageList: { - height: '90%', - overflowY: 'auto', - paddingBottom: '40px', - }, - messageContainer: { - marginTop: 25, - width: '100%', - }, sourceSms: { float: 'right', margin: 10, diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 953a6d6..9e8e908 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -66,11 +66,12 @@ "APPS_MESSAGES_NEW_MESSAGE": "Message...", "APPS_MESSAGES_NEW_MESSAGE_GROUP": "Phone numbers...", "APPS_MESSAGES_GROUP_CHAT_LABEL": "Group chat label...", - "APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Submit", + "APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Send", "APPS_MESSAGES_INVALID_PHONE_NUMBER": "Invalid phone number: ", "APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "This message group already exists", "APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Failed to create message group", "APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "You cannot add yourself!", + "APPS_MESSAGES_INPUT_NAME_OR_NUMBER": "Search contacts or type number and press enter", "APPS_CONTACT_ADD_SUCCESS": "Successfully created contact!", "APPS_CONTACT_ADD_FAILED": "Failed to created contact!", diff --git a/phone/src/locale/fr.json b/phone/src/locale/fr.json index 294b9cd..ed6615d 100644 --- a/phone/src/locale/fr.json +++ b/phone/src/locale/fr.json @@ -2,9 +2,9 @@ "translation": { "DATE_FORMAT": "DD/MM/AAAA", "DATE_TIME_FORMAT": "DD/MM/AAAA hh:mm A", - + "COMING_SOON": "En cours...", - + "APPS_DIALER": "Téléphone", "APPS_CONTACTS": "Contacts", "APPS_MESSAGES": "Messages", @@ -16,11 +16,10 @@ "APPS_TWITTER": "Twitter", "APPS_SELLOUT": "Marché", "APPS_CAMERA": "Caméra", - + "APPS_BANK_TRANSFER": "Transfert", "APPS_SETTINGS_OPTIONS_WALLPAPER": "Fond d'écran", "APPS_SETTINGS_OPTIONS_FRAME": "Cadre/Coque", - "APPS_TWITTER": "Twitter", "APPS_TWITTER_TWEET": "Tweet", "APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "Quoi de neuf ?", "APPS_TWITTER_IMAGE_PLACEHOLDER": "Lien vers votre image/GIF", @@ -83,7 +82,7 @@ "APPS_CONTACT_MODAL_PLACEHOLDER_NUMBER": "Numéro", "APPS_CONTACT_MODAL_PLACEHOLDER_AVATAR": "Photo", "APPS_CONTACT_MODAL_BUTTON_ADD": "Ajouter un contact", - + "APPS_NOTES_ADD_SUCCESS": "Note sauvegardée avec succès.", "APPS_NOTES_ADD_FAILED": "Erreur lors de la suppression d'une note.", "APPS_NOTES_UPDATE_SUCCESS": "Mise à jour d'une note réalisée avec succès.", diff --git a/phone/yarn.lock b/phone/yarn.lock index 930b7f6..0d75824 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -1132,13 +1132,20 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.3.1", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": version "7.11.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736" integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw== dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.7": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.13.tgz#0a21452352b02542db0ffb928ac2d3ca7cb6d66d" + integrity sha512-8+3UMPBrjFa/6TtKi/7sehPKqfAm4g6K+YQjyyFOLUTxzOngcRZTlAVY8sc2CORJYqdHQY8gRPHmn+qo15rCBw== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.10.4", "@babel/template@^7.4.0", "@babel/template@^7.8.6": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" @@ -1446,21 +1453,21 @@ chalk "^4.0.0" "@material-ui/core@^4.11.0": - version "4.11.0" - resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.11.0.tgz#b69b26e4553c9e53f2bfaf1053e216a0af9be15a" - integrity sha512-bYo9uIub8wGhZySHqLQ833zi4ZML+XCBE1XwJ8EuUVSpTWWG57Pm+YugQToJNFsEyiKFhPh8DPD0bgupz8n01g== + version "4.11.3" + resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.11.3.tgz#f22e41775b0bd075e36a7a093d43951bf7f63850" + integrity sha512-Adt40rGW6Uds+cAyk3pVgcErpzU/qxc7KBR94jFHBYretU4AtWZltYcNsbeMn9tXL86jjVL1kuGcIHsgLgFGRw== dependencies: "@babel/runtime" "^7.4.4" - "@material-ui/styles" "^4.10.0" - "@material-ui/system" "^4.9.14" + "@material-ui/styles" "^4.11.3" + "@material-ui/system" "^4.11.3" "@material-ui/types" "^5.1.0" - "@material-ui/utils" "^4.10.2" + "@material-ui/utils" "^4.11.2" "@types/react-transition-group" "^4.2.0" clsx "^1.0.4" hoist-non-react-statics "^3.3.2" popper.js "1.16.1-lts" prop-types "^15.7.2" - react-is "^16.8.0" + react-is "^16.8.0 || ^17.0.0" react-transition-group "^4.4.0" "@material-ui/icons@^4.9.1": @@ -1471,45 +1478,45 @@ "@babel/runtime" "^7.4.4" "@material-ui/lab@^4.0.0-alpha.56": - version "4.0.0-alpha.56" - resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.56.tgz#ff63080949b55b40625e056bbda05e130d216d34" - integrity sha512-xPlkK+z/6y/24ka4gVJgwPfoCF4RCh8dXb1BNE7MtF9bXEBLN/lBxNTK8VAa0qm3V2oinA6xtUIdcRh0aeRtVw== + version "4.0.0-alpha.57" + resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.57.tgz#e8961bcf6449e8a8dabe84f2700daacfcafbf83a" + integrity sha512-qo/IuIQOmEKtzmRD2E4Aa6DB4A87kmY6h0uYhjUmrrgmEAgbbw9etXpWPVXuRK6AGIQCjFzV6WO2i21m1R4FCw== dependencies: "@babel/runtime" "^7.4.4" - "@material-ui/utils" "^4.10.2" + "@material-ui/utils" "^4.11.2" clsx "^1.0.4" prop-types "^15.7.2" - react-is "^16.8.0" + react-is "^16.8.0 || ^17.0.0" -"@material-ui/styles@^4.10.0": - version "4.10.0" - resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.10.0.tgz#2406dc23aa358217aa8cc772e6237bd7f0544071" - integrity sha512-XPwiVTpd3rlnbfrgtEJ1eJJdFCXZkHxy8TrdieaTvwxNYj42VnnCyFzxYeNW9Lhj4V1oD8YtQ6S5Gie7bZDf7Q== +"@material-ui/styles@^4.11.3": + version "4.11.3" + resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.11.3.tgz#1b8d97775a4a643b53478c895e3f2a464e8916f2" + integrity sha512-HzVzCG+PpgUGMUYEJ2rTEmQYeonGh41BYfILNFb/1ueqma+p1meSdu4RX6NjxYBMhf7k+jgfHFTTz+L1SXL/Zg== dependencies: "@babel/runtime" "^7.4.4" "@emotion/hash" "^0.8.0" "@material-ui/types" "^5.1.0" - "@material-ui/utils" "^4.9.6" + "@material-ui/utils" "^4.11.2" clsx "^1.0.4" csstype "^2.5.2" hoist-non-react-statics "^3.3.2" - jss "^10.0.3" - jss-plugin-camel-case "^10.0.3" - jss-plugin-default-unit "^10.0.3" - jss-plugin-global "^10.0.3" - jss-plugin-nested "^10.0.3" - jss-plugin-props-sort "^10.0.3" - jss-plugin-rule-value-function "^10.0.3" - jss-plugin-vendor-prefixer "^10.0.3" + jss "^10.5.1" + jss-plugin-camel-case "^10.5.1" + jss-plugin-default-unit "^10.5.1" + jss-plugin-global "^10.5.1" + jss-plugin-nested "^10.5.1" + jss-plugin-props-sort "^10.5.1" + jss-plugin-rule-value-function "^10.5.1" + jss-plugin-vendor-prefixer "^10.5.1" prop-types "^15.7.2" -"@material-ui/system@^4.9.14": - version "4.9.14" - resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.9.14.tgz#4b00c48b569340cefb2036d0596b93ac6c587a5f" - integrity sha512-oQbaqfSnNlEkXEziDcJDDIy8pbvwUmZXWNqlmIwDqr/ZdCK8FuV3f4nxikUh7hvClKV2gnQ9djh5CZFTHkZj3w== +"@material-ui/system@^4.11.3": + version "4.11.3" + resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.11.3.tgz#466bc14c9986798fd325665927c963eb47cc4143" + integrity sha512-SY7otguNGol41Mu2Sg6KbBP1ZRFIbFLHGK81y4KYbsV2yIcaEPOmsCK6zwWlp+2yTV3J/VwT6oSBARtGIVdXPw== dependencies: "@babel/runtime" "^7.4.4" - "@material-ui/utils" "^4.9.6" + "@material-ui/utils" "^4.11.2" csstype "^2.5.2" prop-types "^15.7.2" @@ -1518,14 +1525,14 @@ resolved "https://registry.yarnpkg.com/@material-ui/types/-/types-5.1.0.tgz#efa1c7a0b0eaa4c7c87ac0390445f0f88b0d88f2" integrity sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A== -"@material-ui/utils@^4.10.2", "@material-ui/utils@^4.9.6": - version "4.10.2" - resolved "https://registry.yarnpkg.com/@material-ui/utils/-/utils-4.10.2.tgz#3fd5470ca61b7341f1e0468ac8f29a70bf6df321" - integrity sha512-eg29v74P7W5r6a4tWWDAAfZldXIzfyO1am2fIsC39hdUUHm/33k6pGOKPbgDjg/U/4ifmgAePy/1OjkKN6rFRw== +"@material-ui/utils@^4.11.2": + version "4.11.2" + resolved "https://registry.yarnpkg.com/@material-ui/utils/-/utils-4.11.2.tgz#f1aefa7e7dff2ebcb97d31de51aecab1bb57540a" + integrity sha512-Uul8w38u+PICe2Fg2pDKCaIG7kOyhowZ9vjiC1FsVwPABTW8vPPKfF6OvxRq3IiBaI1faOJmgdvMG7rMJARBhA== dependencies: "@babel/runtime" "^7.4.4" prop-types "^15.7.2" - react-is "^16.8.0" + react-is "^16.8.0 || ^17.0.0" "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" @@ -2025,7 +2032,15 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^16.9.51": +"@types/react@*": + version "17.0.2" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.2.tgz#3de24c4efef902dd9795a49c75f760cbe4f7a5a8" + integrity sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA== + dependencies: + "@types/prop-types" "*" + csstype "^3.0.2" + +"@types/react@^16.9.51": version "16.9.51" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.51.tgz#f8aa51ffa9996f1387f63686696d9b59713d2b60" integrity sha512-lQa12IyO+DMlnSZ3+AGHRUiUcpK47aakMMoBG8f7HGxJT8Yfe+WE128HIXaHOHVPReAW0oDS3KAI0JI2DDe1PQ== @@ -4389,14 +4404,14 @@ cssstyle@^1.0.0, cssstyle@^1.1.1: cssom "0.3.x" csstype@^2.5.2: - version "2.6.13" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.13.tgz#a6893015b90e84dd6e85d0e3b442a1e84f2dbe0f" - integrity sha512-ul26pfSQTZW8dcOnD2iiJssfXw0gdNVX9IJDH/X3K5DGPfj+fUYe3kB+swUY6BF3oZDxaID3AJt+9/ojSAE05A== + version "2.6.15" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.15.tgz#655901663db1d652f10cb57ac6af5a05972aea1f" + integrity sha512-FNeiVKudquehtR3t9TRRnsHL+lJhuHF5Zn9dt01jpojlurLEPDhhEtUkWmAUJ7/fOLaLG4dCDEnUsR0N1rZSsg== csstype@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.3.tgz#2b410bbeba38ba9633353aff34b05d9755d065f8" - integrity sha512-jPl+wbWPOWJ7SXsWyqGRk3lGecbar0Cb0OvZF/r/ZU011R4YqiRehgkQ9p4eQfo9DSDLqLL3wHwfxeJiuIsNag== + version "3.0.6" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.6.tgz#865d0b5833d7d8d40f4e5b8a6d76aea3de4725ef" + integrity sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw== cyclist@^1.0.1: version "1.0.1" @@ -6810,6 +6825,13 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= +indefinite-observable@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/indefinite-observable/-/indefinite-observable-2.0.1.tgz#574af29bfbc17eb5947793797bddc94c9d859400" + integrity sha512-G8vgmork+6H9S8lUAg1gtXEj2JxIQTo0g2PbFiYOdjkziSI0F7UYBiVwhZRuixhBCNGczAls34+5HJPyZysvxQ== + dependencies: + symbol-observable "1.2.0" + indent-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" @@ -7991,73 +8013,74 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jss-plugin-camel-case@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.4.0.tgz#46c75ff7fd61c304984c21af5817823f0f501ceb" - integrity sha512-9oDjsQ/AgdBbMyRjc06Kl3P8lDCSEts2vYZiPZfGAxbGCegqE4RnMob3mDaBby5H9vL9gWmyyImhLRWqIkRUCw== +jss-plugin-camel-case@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.5.1.tgz#427b24a9951b4c2eaa7e3d5267acd2e00b0934f9" + integrity sha512-9+oymA7wPtswm+zxVti1qiowC5q7bRdCJNORtns2JUj/QHp2QPXYwSNRD8+D2Cy3/CEMtdJzlNnt5aXmpS6NAg== dependencies: "@babel/runtime" "^7.3.1" hyphenate-style-name "^1.0.3" - jss "10.4.0" + jss "10.5.1" -jss-plugin-default-unit@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.4.0.tgz#2b10f01269eaea7f36f0f5fd1cfbfcc76ed42854" - integrity sha512-BYJ+Y3RUYiMEgmlcYMLqwbA49DcSWsGgHpVmEEllTC8MK5iJ7++pT9TnKkKBnNZZxTV75ycyFCR5xeLSOzVm4A== +jss-plugin-default-unit@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.5.1.tgz#2be385d71d50aee2ee81c2a9ac70e00592ed861b" + integrity sha512-D48hJBc9Tj3PusvlillHW8Fz0y/QqA7MNmTYDQaSB/7mTrCZjt7AVRROExoOHEtd2qIYKOYJW3Jc2agnvsXRlQ== dependencies: "@babel/runtime" "^7.3.1" - jss "10.4.0" + jss "10.5.1" -jss-plugin-global@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.4.0.tgz#19449425a94e4e74e113139b629fd44d3577f97d" - integrity sha512-b8IHMJUmv29cidt3nI4bUI1+Mo5RZE37kqthaFpmxf5K7r2aAegGliAw4hXvA70ca6ckAoXMUl4SN/zxiRcRag== +jss-plugin-global@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.5.1.tgz#0e1793dea86c298360a7e2004721351653c7e764" + integrity sha512-jX4XpNgoaB8yPWw/gA1aPXJEoX0LNpvsROPvxlnYe+SE0JOhuvF7mA6dCkgpXBxfTWKJsno7cDSCgzHTocRjCQ== dependencies: "@babel/runtime" "^7.3.1" - jss "10.4.0" + jss "10.5.1" -jss-plugin-nested@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.4.0.tgz#017d0c02c0b6b454fd9d7d3fc33470a15eea9fd1" - integrity sha512-cKgpeHIxAP0ygeWh+drpLbrxFiak6zzJ2toVRi/NmHbpkNaLjTLgePmOz5+67ln3qzJiPdXXJB1tbOyYKAP4Pw== +jss-plugin-nested@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.5.1.tgz#8753a80ad31190fb6ac6fdd39f57352dcf1295bb" + integrity sha512-xXkWKOCljuwHNjSYcXrCxBnjd8eJp90KVFW1rlhvKKRXnEKVD6vdKXYezk2a89uKAHckSvBvBoDGsfZrldWqqQ== dependencies: "@babel/runtime" "^7.3.1" - jss "10.4.0" + jss "10.5.1" tiny-warning "^1.0.2" -jss-plugin-props-sort@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.4.0.tgz#7110bf0b6049cc2080b220b506532bf0b70c0e07" - integrity sha512-j/t0R40/2fp+Nzt6GgHeUFnHVY2kPGF5drUVlgkcwYoHCgtBDOhTTsOfdaQFW6sHWfoQYgnGV4CXdjlPiRrzwA== +jss-plugin-props-sort@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.5.1.tgz#ab1c167fd2d4506fb6a1c1d66c5f3ef545ff1cd8" + integrity sha512-t+2vcevNmMg4U/jAuxlfjKt46D/jHzCPEjsjLRj/J56CvP7Iy03scsUP58Iw8mVnaV36xAUZH2CmAmAdo8994g== dependencies: "@babel/runtime" "^7.3.1" - jss "10.4.0" + jss "10.5.1" -jss-plugin-rule-value-function@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.4.0.tgz#7cff4a91e84973536fa49b6ebbdbf7f339b01c82" - integrity sha512-w8504Cdfu66+0SJoLkr6GUQlEb8keHg8ymtJXdVHWh0YvFxDG2l/nS93SI5Gfx0fV29dO6yUugXnKzDFJxrdFQ== +jss-plugin-rule-value-function@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.5.1.tgz#37f4030523fb3032c8801fab48c36c373004de7e" + integrity sha512-3gjrSxsy4ka/lGQsTDY8oYYtkt2esBvQiceGBB4PykXxHoGRz14tbCK31Zc6DHEnIeqsjMUGbq+wEly5UViStQ== dependencies: "@babel/runtime" "^7.3.1" - jss "10.4.0" + jss "10.5.1" tiny-warning "^1.0.2" -jss-plugin-vendor-prefixer@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.4.0.tgz#2a78f3c5d57d1e024fe7ad7c41de34d04e72ecc0" - integrity sha512-DpF+/a+GU8hMh/948sBGnKSNfKkoHg2p9aRFUmyoyxgKjOeH9n74Ht3Yt8lOgdZsuWNJbPrvaa3U4PXKwxVpTQ== +jss-plugin-vendor-prefixer@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.5.1.tgz#45a183a3a0eb097bdfab0986b858d99920c0bbd8" + integrity sha512-cLkH6RaPZWHa1TqSfd2vszNNgxT1W0omlSjAd6hCFHp3KIocSrW21gaHjlMU26JpTHwkc+tJTCQOmE/O1A4FKQ== dependencies: "@babel/runtime" "^7.3.1" css-vendor "^2.0.8" - jss "10.4.0" + jss "10.5.1" -jss@10.4.0, jss@^10.0.3: - version "10.4.0" - resolved "https://registry.yarnpkg.com/jss/-/jss-10.4.0.tgz#473a6fbe42e85441020a07e9519dac1e8a2e79ca" - integrity sha512-l7EwdwhsDishXzqTc3lbsbyZ83tlUl5L/Hb16pHCvZliA9lRDdNBZmHzeJHP0sxqD0t1mrMmMR8XroR12JBYzw== +jss@10.5.1, jss@^10.5.1: + version "10.5.1" + resolved "https://registry.yarnpkg.com/jss/-/jss-10.5.1.tgz#93e6b2428c840408372d8b548c3f3c60fa601c40" + integrity sha512-hbbO3+FOTqVdd7ZUoTiwpHzKXIo5vGpMNbuXH1a0wubRSWLWSBvwvaq4CiHH/U42CmjOnp6lVNNs/l+Z7ZdDmg== dependencies: "@babel/runtime" "^7.3.1" csstype "^3.0.2" + indefinite-observable "^2.0.1" is-in-browser "^1.1.3" tiny-warning "^1.0.2" @@ -10873,11 +10896,16 @@ react-i18next@^11.7.1: "@babel/runtime" "^7.3.1" html-parse-stringify2 "2.0.1" -react-is@^16.12.0, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: +react-is@^16.12.0, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +"react-is@^16.8.0 || ^17.0.0": + version "17.0.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.1.tgz#5b3531bd76a645a4c9fb6e693ed36419e3301339" + integrity sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA== + react-popper@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-2.2.3.tgz#33d425fa6975d4bd54d9acd64897a89d904b9d97" @@ -12443,6 +12471,11 @@ svgo@^1.0.0, svgo@^1.2.2: unquote "~1.1.1" util.promisify "~1.0.0" +symbol-observable@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== + symbol-tree@^3.2.2: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts index 15d65e8..1457873 100644 --- a/resources/client/cl_main.ts +++ b/resources/client/cl_main.ts @@ -269,6 +269,7 @@ const togglePhoneVisible = async (): Promise => { * * * * * * * * * * * * */ async function Phone(): Promise { + fetchOnInitialize() if (config.PhoneAsItem) { // TODO: Do promise callback here // const hasPhoneItem = await emitNetPromise('phone:hasPhoneItem') @@ -314,7 +315,6 @@ onNet('phone:sendCredentials', (number: string) => { }); - // DO NOT CHANGE THIS EITHER, PLEASE - CHIP /* * * * * * * * * * * * * @@ -323,12 +323,10 @@ onNet('phone:sendCredentials', (number: string) => { * * * * * * * * * * * * * */ -// contacts app -RegisterNuiCallbackType(events.OPEN_APP_CONTACTS); -on(`__cfx_nui:${events.OPEN_APP_CONTACTS}`, (data: any, cb: Function) => { +function fetchOnInitialize() { emitNet(events.CONTACTS_GET_CONTACTS); - cb(); -}); +} + RegisterNuiCallbackType(events.OPEN_APP_LISTINGS); on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => { @@ -357,7 +355,6 @@ on(`__cfx_nui:${events.OPEN_APP_CAMERA}`, (data: any, cb: Function) => { RegisterNuiCallbackType(events.OPEN_APP_DAILER); on(`__cfx_nui:${events.OPEN_APP_DAILER}`, (data: any, cb: Function) => { - emitNet(events.CONTACTS_GET_CONTACTS); emitNet(events.PHONE_CALL_FETCH_CALLS); cb(); });