Author SHA1 Message Date
Christopher 6c06f26271 feat(resources/main): disable controls 2021-04-04 02:30:39 +02:00
Christopher 4bf3248168 tweak(phone/dialer): remove type number from dialer input
this is temporary
2021-04-03 22:32:09 +02:00
J Francisco Rader cb1aa80f83 bugfix(messages-app): Remove paste from clipboard feature (#195) 2021-04-02 18:04:44 -03:00
J Francisco Rader 9896f2384e Add kiddo theme :D 2021-04-01 16:07:32 -03:00
Taso 289207beb9 tweak(phone/twitter): Refactored nui events to use enums for method" 2021-04-01 12:37:56 -04:00
Taso 8bfdc1b8b2 fix(phone/types): Replaced debug inject methods with new enums" 2021-04-01 12:28:14 -04:00
J Francisco Rader d315d72e93 Fix first time login 2021-04-01 11:42:28 -03:00
Christopher 2992a644fe tweak(phone/apps): hiding bank app while bank resource gets done 2021-04-01 14:31:38 +02:00
victorBOY 2b633c9e80 Update pt-BR translation (#188)
* Update pt-BR translation

* Update ptbr.json

* Fix missing translations
2021-03-31 22:58:40 +02:00
Christopher dab4c1eaf7 fix(phone/dialer): missing translation 2021-03-31 20:47:39 +02:00
Dillon Skaggs 48e0dd2443 fix(sql): don't include extra SQL data (#187) 2021-03-31 15:10:34 -03:00
Christopher 3157cafd5a fix(phone/settings): fix settingsSchema properties for custom wallpaper 2021-03-30 22:30:05 +02:00
Christopher c82a48b012 remove slutty import, smh' 2021-03-30 22:23:32 +02:00
Christopher 4d46566811 feat(phone/settings): custom background 2021-03-30 22:21:41 +02:00
Christopher ee7e3a3ae1 tweak(phone/twitter): change position of tweet & showMore button 2021-03-30 16:27:07 +02:00
Christopher 31241c7e8f Merge branch 'master' of https://github.com/project-error/new-phone-who-dis 2021-03-30 16:06:04 +02:00
Christopher 5f2dce2dda fix(phone/marketplace): use enums events for injectData 2021-03-30 16:05:39 +02:00
29 changed files with 400 additions and 126 deletions

No files matched your search

+2 -2
View File
@@ -68,7 +68,7 @@ CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`),
UNIQUE KEY `identifier_UNIQUE` (`identifier`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
);
CREATE TABLE IF NOT EXISTS `npwd_match_views` (
`id` int NOT NULL AUTO_INCREMENT,
@@ -80,7 +80,7 @@ CREATE TABLE IF NOT EXISTS `npwd_match_views` (
PRIMARY KEY (`id`),
KEY `match_profile_idx` (`profile`),
CONSTRAINT `match_profile` FOREIGN KEY (`profile`) REFERENCES `npwd_match_profiles` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=131 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
);
CREATE TABLE IF NOT EXISTS npwd_notes (
id int(11) NOT NULL AUTO_INCREMENT,
+3 -1
View File
@@ -104,7 +104,9 @@ function Phone() {
id="phone"
className="PhoneScreen"
style={{
backgroundImage: `url(media/backgrounds/${settings.wallpaper.value})`,
backgroundImage: settings.customWallpaper
? `url(${settings.customWallpaper})`
: `url(media/backgrounds/${settings.wallpaper.value})`,
}}
>
{isPhoneReady ? (
@@ -5,11 +5,12 @@ import { GalleryGrid } from './grid/GalleryGrid';
import { GalleryModal } from './modal/GalleryModal';
import InjectDebugData from '../../../os/debug/InjectDebugData';
import { Route, Switch } from 'react-router-dom';
import { PhotoEvents } from '../../../../../typings/photo';
InjectDebugData([
{
app: 'CAMERA',
method: 'setPhotos',
method: PhotoEvents.SEND_PHOTOS,
data: [
{
id: 1,
@@ -1,8 +1,9 @@
import { useSetRecoilState } from 'recoil';
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { photoState } from './state';
import { PhotoEvents } from '../../../../../typings/photo';
export const usePhotoService = () => {
const setPhotos = useSetRecoilState(photoState.photos);
useNuiEvent('CAMERA', 'setPhotos', setPhotos);
useNuiEvent('CAMERA', PhotoEvents.SEND_PHOTOS, setPhotos);
};
@@ -9,6 +9,7 @@ import { Route } from 'react-router-dom';
import ContactsInfoPage from './views/ContactInfo';
import { ContactPage } from './views/ContactsPage';
import { ContactsThemeProvider } from '../providers/ContactsThemeProvider';
import { ContactEvents } from '../../../../../typings/contact';
export const ContactsApp = () => {
const contacts = useApp('CONTACTS');
@@ -29,7 +30,7 @@ export const ContactsApp = () => {
InjectDebugData([
{
app: 'CONTACTS',
method: 'setContacts',
method: ContactEvents.SEND_CONTACTS,
data: [
{
id: 1,
@@ -11,6 +11,7 @@ import { useDialHistory } from '../hooks/useDialHistory';
import InjectDebugData from '../../../os/debug/InjectDebugData';
import { ContactList } from '../../contacts/components/List/ContactList';
import { DialerThemeProvider } from '../providers/DialerThemeProvider';
import { CallEvents } from '../../../../../typings/call';
export const DialerApp = () => {
const history = useDialHistory();
@@ -40,7 +41,7 @@ export const DialerApp = () => {
InjectDebugData([
{
app: 'DIALER',
method: 'setHistory',
method: CallEvents.SET_CALL_HISTORY,
data: [
{
id: 1,
@@ -7,6 +7,7 @@ import { DialInputCtx, IDialInputCtx } from '../context/InputContext';
import Nui from '../../../os/nui-events/utils/Nui';
import { useHistory } from 'react-router-dom';
import { CallEvents } from '../../../../../typings/call';
import { useTranslation } from 'react-i18next';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -30,6 +31,7 @@ const useStyles = makeStyles((theme: Theme) => ({
export const DialerInput = () => {
const classes = useStyles();
const history = useHistory();
const { t } = useTranslation();
const { inputVal, set } = useContext<IDialInputCtx>(DialInputCtx);
@@ -46,11 +48,10 @@ export const DialerInput = () => {
return (
<Box component={Paper} className={classes.root}>
<InputBase
placeholder="Enter a number"
placeholder={t('APPS_DIALER_INPUT_PLACEHOLDER')}
className={classes.input}
value={inputVal}
onChange={(e) => set(e.target.value)}
type="number"
/>
<IconButton color="primary" className={classes.iconBtn} disabled={inputVal <= ''}>
<PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} />
@@ -5,6 +5,7 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
import PhoneIcon from '@material-ui/icons/Phone';
import PersonIcon from '@material-ui/icons/Person';
import HistoryIcon from '@material-ui/icons/History';
import { useTranslation } from 'react-i18next';
const useStyles = makeStyles((theme: Theme) => ({
root: {
@@ -20,6 +21,7 @@ const DialerNavBar = () => {
const classes = useStyles();
const { pathname } = useLocation();
const [page, setPage] = useState(pathname);
const { t } = useTranslation();
const handleChange = (_e, newPage) => {
setPage(newPage);
@@ -28,14 +30,14 @@ const DialerNavBar = () => {
return (
<BottomNavigation value={page} onChange={handleChange} showLabels className={classes.root}>
<BottomNavigationAction
label="History"
label={t('APPS_DIALER_NAVBAR_HISTORY')}
value="/phone"
component={NavLink}
icon={<HistoryIcon />}
to="/phone"
/>
<BottomNavigationAction
label="Dial"
label={t('APPS_DIALER_NAVBAR_DIAL')}
value="/phone/dial"
color="secondary"
component={NavLink}
@@ -43,7 +45,7 @@ const DialerNavBar = () => {
to="/phone/dial"
/>
<BottomNavigationAction
label="Contacts"
label={t('APPS_DIALER_NAVBAR_CONTACTS')}
value="/phone/contacts"
color="secondary"
component={NavLink}
+3 -3
View File
@@ -54,7 +54,7 @@ InjectDebugData(
[
{
app: 'MATCH',
method: 'phone:getMatchProfilesSuccess',
method: MatchEvents.GET_PROFILES_SUCCESS,
data: [
{
id: 1,
@@ -102,7 +102,7 @@ InjectDebugData(
},
{
app: 'MATCH',
method: 'phone:getMyProfileSuccess',
method: MatchEvents.GET_MY_PROFILE_SUCCESS,
data: {
id: 4,
image:
@@ -120,7 +120,7 @@ InjectDebugData(
},
{
app: 'MATCH',
method: 'phone:getMatchesSuccess',
method: MatchEvents.GET_MATCHES_SUCCESS,
data: [
{
id: 5,
@@ -53,7 +53,7 @@ export const MessagesApp = () => {
InjectDebugData([
{
app: 'MESSAGES',
method: 'phone:fetchMessageGroupsSuccess',
method: MessageEvents.FETCH_MESSAGE_GROUPS_SUCCESS,
data: [
{
groupId: '2',
@@ -93,7 +93,7 @@ InjectDebugData(
[
{
app: 'MESSAGES',
method: 'phone:fetchMessagesSuccess',
method: MessageEvents.FETCH_MESSAGES_SUCCESS,
data: [
{
id: 1,
@@ -3,9 +3,7 @@ import qs from 'qs';
import Nui from '../../../../os/nui-events/utils/Nui';
import Modal from '../../../../ui/components/Modal';
import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrary';
import { Box, Typography, TextField, Button } from '@material-ui/core';
import FileCopyIcon from '@material-ui/icons/FileCopy';
import useStyles from './modal.styles';
import { Box, Typography, Button } from '@material-ui/core';
import { useHistory, useLocation } from 'react-router-dom';
import { ContextMenu } from '../../../../ui/components/ContextMenu';
import { deleteQueryFromLocation } from '../../../../common/utils/deleteQueryFromLocation';
@@ -20,12 +18,8 @@ interface IProps {
}
export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IProps) => {
const classes = useStyles();
const history = useHistory();
const { pathname, search } = useLocation();
const [message, setMessage] = useState('');
const [pasteVisible, setPasteVisible] = useState(false);
const [queryParamImagePreview, setQueryParamImagePreview] = useState(null);
const removeQueryParamImage = useCallback(() => {
@@ -55,21 +49,10 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
useEffect(() => {
if (!image) return;
setQueryParamImagePreview(image);
}, [image, sendFromQueryParam]);
const sendFromClipboard = (event) => {
if (event.key === 'Enter') {
sendImageMessage(message);
}
};
}, [image]);
const menuOptions = useMemo(
() => [
{
label: 'Paste from clipboard',
icon: <FileCopyIcon />,
onClick: () => setPasteVisible(true),
},
{
label: 'Camera / Gallery',
icon: <PhotoLibraryIcon />,
@@ -90,7 +73,7 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
<Modal visible={queryParamImagePreview} handleClose={removeQueryParamImage}>
<Box py={1}>
<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
fullWidth
variant="contained"
@@ -101,21 +84,6 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
</Button>
</Box>
</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>
</>
);
};
+2 -1
View File
@@ -12,6 +12,7 @@ import useStyles from './notes.styles';
import InjectDebugData from '../../os/debug/InjectDebugData';
import { NotesThemeProvider } from './providers/NotesThemeProvider';
import { Route, useHistory } from 'react-router-dom';
import { NotesEvents } from '../../../../typings/notes';
export const NotesApp = () => {
const classes = useStyles();
@@ -43,7 +44,7 @@ export const NotesApp = () => {
InjectDebugData([
{
app: 'NOTES',
method: 'setNotes',
method: NotesEvents.SEND_NOTE,
data: [
{
id: 1,
@@ -10,7 +10,10 @@ 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;
@@ -106,3 +109,15 @@ export const SettingItemIconAction = ({
</ListItem>
</>
);
export const SettingItemModal = ({ icon, label, secondary, onClick }) => (
<ListItem divider>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={label} secondary={secondary} />
<ListItemSecondaryAction>
<IconButton onClick={onClick}>
<CreateIcon />
</IconButton>
</ListItemSecondaryAction>
</ListItem>
);
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import { AppWrapper } from '../../../ui/components';
import { AppTitle } from '../../../ui/components/AppTitle';
import { AppContent } from '../../../ui/components/AppContent';
@@ -12,6 +12,7 @@ import {
SettingItemIconAction,
SettingItemSlider,
SettingSwitch,
SettingItemModal,
} from './SettingItem';
import { useTranslation } from 'react-i18next';
import VisibilityOffIcon from '@material-ui/icons/VisibilityOff';
@@ -28,12 +29,13 @@ import {
Book,
DeleteForever,
} from '@material-ui/icons';
import { makeStyles } from '@material-ui/core/styles';
import { ListSubheader } from '@material-ui/core';
import { useResetSettings, useSettings } from '../hooks/useSettings';
import { useCustomWallpaperModal, useResetSettings, useSettings } from '../hooks/useSettings';
import { setClipboard } from '../../../os/phone/hooks/useClipboard';
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
import { IContextMenuOption } from '../../../ui/components/ContextMenu';
import WallpaperModal from './WallpaperModal';
const SubHeaderComp = (props: { text: string }) => (
<ListSubheader color="primary" component="div" disableSticky>
@@ -41,12 +43,26 @@ const SubHeaderComp = (props: { text: string }) => (
</ListSubheader>
);
const useStyles = makeStyles({
backgroundModal: {
background: 'black',
opacity: '0.6',
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: 5,
},
});
export const SettingsApp = () => {
const settingsApp = useApp('SETTINGS');
const [config] = useConfig();
const simcard = useSimcard();
const [settings, setSettings] = useSettings();
const { t } = useTranslation();
const { customWallpaperModal, setCustomWallpaperModal } = useCustomWallpaperModal();
const { addAlert } = useSnackbar();
@@ -123,9 +139,12 @@ export const SettingsApp = () => {
};
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
const classes = useStyles();
return (
<AppWrapper>
<AppTitle app={settingsApp} />
<WallpaperModal />
<div className={customWallpaperModal ? classes.backgroundModal : undefined} />
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
<List disablePadding subheader={<SubHeaderComp text={t('SETTINGS.CATEGORY.PHONE')} />}>
<SettingItemIconAction
@@ -194,6 +213,13 @@ export const SettingsApp = () => {
onClick={openMenu}
icon={<Wallpaper />}
/>
{/* CUSTOM BACKGROUND */}
<SettingItemModal
icon={<Wallpaper />}
label={t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER')}
secondary={settings.customWallpaper}
onClick={() => setCustomWallpaperModal(true)}
/>
<SettingItem
label={t('APPS_SETTINGS_OPTION_FRAME')}
value={settings.frame.label}
@@ -0,0 +1,86 @@
import React, { useState } from 'react';
import Modal from '../../../ui/components/Modal';
import { useCustomWallpaperModal, useSettings } from '../hooks/useSettings';
import { Box, Button, TextField } from '@material-ui/core';
import { PictureThumbnail } from '../../../ui/components/PictureThumbnail';
import { useTranslation } from 'react-i18next';
import { makeStyles } from '@material-ui/core/styles';
import { StatusButton } from '../../../ui/components/StatusButton';
const useStyles = makeStyles({
input: {
marginTop: 10,
marginBottom: 10,
},
inputProps: {
fontSize: 18,
},
});
export default function WallpaperModal() {
const { customWallpaperModal, setCustomWallpaperModal } = useCustomWallpaperModal();
const [settings, setSettings] = useSettings();
const { t } = useTranslation();
const [value, setValue] = useState(settings.customWallpaper ? settings.customWallpaper : '');
const classes = useStyles();
const isImage = (url) => {
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
};
const handleCloseModal = () => {
setCustomWallpaperModal(false);
};
const handleSettingChange = (key: string | number, value: unknown) => {
setSettings({ ...settings, [key]: value });
};
const handleNewWallpaper = () => {
handleSettingChange('customWallpaper', value);
};
const handleRemoveWallpaper = () => {
handleSettingChange('customWallpaper', '');
};
return (
<Modal visible={customWallpaperModal} handleClose={handleCloseModal}>
<Box
display="flex"
justifyContent="center"
alignItems="center"
textAlign="center"
flexDirection="column"
>
{settings.customWallpaper && (
<PictureThumbnail src={settings.customWallpaper} alt="chipisbest" />
)}
<TextField
value={value}
variant="outlined"
className={classes.input}
onChange={(e) => setValue(e.currentTarget.value)}
inputProps={{
className: classes.inputProps,
}}
placeholder="Image URL"
/>
<Button
color="primary"
variant="contained"
disabled={!isImage(value)}
onClick={handleNewWallpaper}
style={{ marginBottom: 10 }}
>
{t('APPS_SETTINGS_SET_CUSTOM_WALLPAPER')}
</Button>
{settings.customWallpaper && (
<StatusButton color="error" variant="contained" onClick={handleRemoveWallpaper}>
{t('GENERIC_DELETE')}
</StatusButton>
)}
</Box>
</Modal>
);
}
@@ -23,6 +23,7 @@ const settingsSchema: Schema = {
properties: {
language: { $ref: '/SettingOption' },
wallpaper: { $ref: '/SettingOption' },
customWallpaper: { type: 'string' },
frame: { $ref: '/SettingOption' },
theme: { $ref: '/SettingOption' },
zoom: { $ref: '/SettingOption' },
@@ -63,6 +64,7 @@ export function isSettingsSchemaValid(): boolean {
export interface IPhoneSettings {
language: SettingOption;
wallpaper: SettingOption;
customWallpaper: string;
frame: SettingOption;
theme: SettingOption;
zoom: SettingOption;
@@ -110,6 +112,11 @@ export const settingsState = atom({
effects_UNSTABLE: [localStorageEffect(NPWD_STORAGE_KEY)],
});
const customWallpaperState = atom({
key: 'customWallpaperState',
default: false,
});
export const useSettings = () => {
return useRecoilState(settingsState);
};
@@ -117,3 +124,8 @@ export const useSettings = () => {
export const useResetSettings = () => {
return useResetRecoilState(settingsState);
};
export const useCustomWallpaperModal = () => {
const [customWallpaperModal, setCustomWallpaperModal] = useRecoilState(customWallpaperState);
return { customWallpaperModal, setCustomWallpaperModal };
};
@@ -1,8 +1,7 @@
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import { Switch, Route } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
import Nui from '../../../os/nui-events/utils/Nui';
import { AppWrapper } from '../../../ui/components';
import { AppContent } from '../../../ui/components/AppContent';
import TweetListContainer from './tweet/TweetListContainer';
@@ -78,7 +77,7 @@ export const TwitterApp = () => {
InjectDebugData([
{
app: 'TWITTER',
method: 'getOrCreateTwitterProfile',
method: TwitterEvents.GET_OR_CREATE_PROFILE,
data: {
profile_name: 'Angular_Dev',
bio: 'Angular FTW',
@@ -89,7 +88,7 @@ InjectDebugData([
},
{
app: 'TWITTER',
method: 'fetchTweets',
method: TwitterEvents.FETCH_TWEETS,
data: [
{
id: 59,
@@ -150,7 +149,7 @@ InjectDebugData(
[
{
app: 'TWITTER',
method: 'createTweetBroadcast',
method: TwitterEvents.CREATE_TWEET_BROADCAST,
data: {
id: 111,
profile_id: 111,
@@ -162,7 +161,7 @@ InjectDebugData(
},
{
app: 'TWITTER',
method: 'createTweetBroadcast',
method: TwitterEvents.CREATE_TWEET_BROADCAST,
data: {
id: 111,
profile_id: 111,
@@ -7,7 +7,7 @@ const useStyles = makeStyles(() => ({
root: {
position: 'absolute',
bottom: '75px',
right: '15px',
right: '10px',
},
button: {
background: '#00acee',
@@ -37,7 +37,12 @@ export const ShowMore = ({ id, isReported, isMine }) => {
return (
<>
<Button aria-controls="simple-menu" aria-haspopup="true" onClick={_handleClick}>
<Button
aria-controls="simple-menu"
aria-haspopup="true"
onClick={_handleClick}
style={{ marginRight: 15 }}
>
<MoreIcon />
</Button>
<Menu
@@ -8,7 +8,7 @@ import { twitterState } from './state';
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useTwitterNotifications } from './useTwitterNotifications';
import { useTranslation } from 'react-i18next';
import { Tweet, FormattedTweet, Profile } from '../../../../../typings/twitter';
import { Tweet, FormattedTweet, Profile, TwitterEvents } from '../../../../../typings/twitter';
/**
* Perform all necessary processing/transforms from the raw database
@@ -83,15 +83,15 @@ export const useTwitterService = () => {
});
};
useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfile', setProfile);
useNuiEvent(APP_TWITTER, 'getOrCreateTwitterProfileNull', setDefaultProfileNames);
useNuiEvent(APP_TWITTER, 'phone:createProfileResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'updateProfileLoading', setUpdateProfileLoading);
useNuiEvent(APP_TWITTER, 'updateProfileResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'fetchTweets', _setTweets);
useNuiEvent(APP_TWITTER, 'fetchTweetsFiltered', _setFilteredTweets);
useNuiEvent(APP_TWITTER, 'createTweetLoading', setCreateLoading);
useNuiEvent(APP_TWITTER, 'createTweetResult', handleAddAlert);
useNuiEvent(APP_TWITTER, 'createTweetBroadcast', handleTweetBroadcast);
useNuiEvent(APP_TWITTER, 'phone:retweetExists', handleAddAlert);
useNuiEvent(APP_TWITTER, TwitterEvents.GET_OR_CREATE_PROFILE, setProfile);
useNuiEvent(APP_TWITTER, TwitterEvents.GET_OR_CREATE_PROFILE_NULL, setDefaultProfileNames);
useNuiEvent(APP_TWITTER, TwitterEvents.CREATE_PROFILE_RESULT, handleAddAlert);
useNuiEvent(APP_TWITTER, TwitterEvents.UPDATE_PROFILE_LOADING, setUpdateProfileLoading);
useNuiEvent(APP_TWITTER, TwitterEvents.UPDATE_PROFILE_RESULT, handleAddAlert);
useNuiEvent(APP_TWITTER, TwitterEvents.FETCH_TWEETS, _setTweets);
useNuiEvent(APP_TWITTER, TwitterEvents.FETCH_TWEETS_FILTERED, _setFilteredTweets);
useNuiEvent(APP_TWITTER, TwitterEvents.CREATE_TWEET_LOADING, setCreateLoading);
useNuiEvent(APP_TWITTER, TwitterEvents.CREATE_TWEET_RESULT, handleAddAlert);
useNuiEvent(APP_TWITTER, TwitterEvents.CREATE_TWEET_BROADCAST, handleTweetBroadcast);
useNuiEvent(APP_TWITTER, TwitterEvents.RETWEET_EXISTS, handleAddAlert);
};
+5
View File
@@ -144,6 +144,7 @@
"label": "Project Error",
"value": "projecterror.jpg"
},
"customWallpaper": "",
"frame": {
"label": "Default",
"value": "default.png"
@@ -190,6 +191,10 @@
{
"label": "Default Light",
"value": "default-light"
},
{
"label": "Kiddo Dark",
"value": "kiddo-dark"
}
],
"debug": {
+16 -1
View File
@@ -34,5 +34,20 @@
}
},
"divider": "rgba(255, 255, 255, 0.12)"
},
"kiddo-dark": {
"palette": {
"type": "dark",
"primary": {
"main": "#EBFEF3"
},
"secondary": {
"main": "#5E0035"
},
"background": {
"default": "#033A18",
"paper": "#011308"
}
}
}
}
}
+6
View File
@@ -56,7 +56,11 @@
"APPS_DIALER_ACCEPT_CALL": "Accept",
"APPS_DIALER_REJECT_CALL": "Reject",
"APPS_DIALER_END_CALL": "End",
"APPS_DIALER_INPUT_PLACEHOLDER": "Enter a number",
"APPS_DIALER_NO_HISTORY": "You have no call history",
"APPS_DIALER_NAVBAR_HISTORY": "History",
"APPS_DIALER_NAVBAR_DIAL": "Dial",
"APPS_DIALER_NAVBAR_CONTACTS": "Contacts",
"APPS_TWITTER_TWEET": "Tweet",
"APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "What's happening?",
@@ -180,6 +184,7 @@
"APPS_SETTINGS_PHONE_NUMBER": "Phone Number",
"APPS_SETTINGS_OPTION_WALLPAPER": "Wallpaper",
"APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER": "Custom Wallpaper",
"APPS_SETTINGS_OPTION_FRAME": "Frame",
"APPS_SETTINGS_OPTION_THEME": "Theme",
"APPS_SETTINGS_OPTION_ZOOM": "Zoom",
@@ -190,6 +195,7 @@
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
"APPS_SETTING_STREAMER_MODE_DESC": "Hide images before they are shown",
"APPS_SETTINGS_SET_CUSTOM_WALLPAPER": "Set new wallpaper",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing",
"APPS_MARKETPLACE_CREATE_LISTING_FAILED": "Failed to create a new listing",
+125 -43
View File
@@ -1,7 +1,38 @@
{
"translation": {
"DATE_FORMAT": "MM/DD/YYYY",
"DATE_TIME_FORMAT": "MM/DD/YYYY hh:mm A",
"DATE_FORMAT": "DD/MM/YYYY",
"DATE_TIME_FORMAT": "DD/MM/YYYY hh:mm A",
"SETTINGS": {
"CATEGORY": {
"APPEARANCE": "Aparência",
"PHONE": "Telefone",
"ACTIONS": "Ações"
},
"OPTIONS": {
"LANGUAGE": "Idioma",
"RESET_SETTINGS": "Redefinir as configurações",
"RESET_SETTINGS_DESC": "Isso limpará seus dados armazenados localmente"
},
"MESSAGES": {
"INVALID_SETTINGS": "Configurações armazenadas inválidas! Redefina no aplicativo Configurações.",
"SETTINGS_RESET": "As configurações foram redefinidas!"
}
},
"RELATIVE_TIME": {
"future": "em %s",
"past": "%s atrás",
"s": "alguns segundos",
"m": "um minuto",
"mm": "%d minutos",
"h": "uma hora",
"hh": "%d horas",
"d": "um dia",
"dd": "%d dias",
"M": "um mês",
"MM": "%d meses",
"y": "um ano",
"yy": "%d anos"
},
"COMING_SOON": "Em breve...",
"INITIALIZING": "Inicializando",
@@ -10,32 +41,38 @@
"APPS_CONTACTS": "Contatos",
"APPS_MESSAGES": "Mensagens",
"APPS_CALCULATOR": "Calculadora",
"APPS_SETTINGS": "Configurações​",
"APPS_SETTINGS": "Configurações",
"APPS_BANK": "Banco WhoDis",
"APPS_NOTES": "Notas",
"APPS_EXAMPLE": "Aplicativo de exemplo",
"APPS_TWITTER": "Twitter",
"APPS_SELLOUT": "Market",
"APPS_SELLOUT": "Mercado",
"APPS_CAMERA": "Camera",
"APPS_DIALER_INCOMING_CALL_TITLE": "Ligaçao",
"APPS_DIALER_INCOMING_CALL_TITLE": "Ligação",
"APPS_DIALER_CURRENT_CALL_TITLE": "Chamada atual",
"APPS_DIALER_CURRENT_CALL_WITH": "Em ligaçao com {{ transmitter }}",
"APPS_DIALER_CURRENT_CALL_WITH": "Em ligação com {{ transmitter }}",
"APPS_DIALER_TRANSMITTER_IS_CALLING": "{{ transmitter }} Esta te ligando!",
"APPS_DIALER_ACCEPT_CALL": "Atender",
"APPS_DIALER_REJECT_CALL": "Desligar",
"APPS_DIALER_REJECT_CALL": "Rejeitar",
"APPS_DIALER_END_CALL": "Fim",
"APPS_DIALER_INPUT_PLACEHOLDER": "Insira um númeror",
"APPS_DIALER_NO_HISTORY": "Você não tem histórico de chamadas",
"APPS_DIALER_NAVBAR_HISTORY": "Histórico",
"APPS_DIALER_NAVBAR_DIAL": "Discar",
"APPS_DIALER_NAVBAR_CONTACTS": "Contatos",
"APPS_TWITTER_TWEET": "Tweet",
"APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "O que está acontecendo?",
"APPS_TWITTER_IMAGE_PLACEHOLDER": "Link para sua foto de perfil",
"APPS_TWITTER_IMAGE_PLACEHOLDER": "Link da sua foto de perfil",
"APPS_TWITTER_SUBMIT_IMAGE": "Adcionar foto",
"APPS_TWITTER_CLOSE_IMAGE": "Fechar",
"APPS_TWITTER_CLOSE": "Fechar",
"APPS_TWITTER_DELETE": "Deletar",
"APPS_TWITTER_REPORT": "Reportar",
"APPS_TWITTER_REPORTED": " Reportado",
"APPS_TWITTER_JUST_NOW": "Agora",
"APPS_TWITTER_RETWEETED": "Retweetado",
"APPS_TWITTER_JUST_NOW": "Agora Mesmo",
"APPS_TWITTER_SEARCH_TWEETS": "Procurar por tweets",
"APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Procurar por nome de perfil ou mensagem",
"APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Mensagem está ultrapassando o limite de caracteres",
@@ -44,34 +81,52 @@
"APPS_TWITTER_CREATE_FAILED": "Seu tweet não foi enviado",
"APPS_TWITTER_EDIT_PROFILE_AVATAR": "URL do Avatar",
"APPS_TWITTER_EDIT_PROFILE_NAME": "Nome de perfil",
"APPS_TWITTER_EDIT_DEFAULT_PROFILE_NAME": "Escolher o nome do perfil",
"APPS_TWITTER_EDIT_PROFILE_BIO": "Bio",
"APPS_MARKETPLACE_DELETE_LISTING_FAILED": "Falha em deletar lista",
"APPS_MARKETPLACE_DELETE_LISTING_SUCCESS": "Lista deletada com sucesso",
"APPS_MARKETPLACE_REPORT_LISTING_FAILED": "Esta lista ja foi reportada",
"APPS_MARKETPLACE_REPORT_LISTING_SUCCESS": "Lista reportada com sucesso",
"APPS_TWITTER_EDIT_PROFILE_LOCATION": "Localização",
"APPS_TWITTER_EDIT_PROFILE_JOB": "Emprego",
"APPS_TWITTER_CREATE_PROFILE_SUCCESS": "Seu perfil foi criado com sucesso",
"APPS_TWITTER_CREATE_PROFILE_FAILURE": "Falha ao criar o seu perfil",
"APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Seu perfil foi atualizado com sucesso",
"APPS_TWITTER_EDIT_PROFILE_FAILURE": "Não foi possivel atualizar seu perfil",
"APPS_TWITTER_TIME_JUST_NOW": "agora",
"APPS_TWITTER_EDIT_PROFILE_FAILURE": "Falha ao atualizar o seu perfil",
"APPS_TWITTER_RETWEET_EXISTS": "Você já retuitou este tweet!",
"APPS_TWITTER_TIME_JUST_NOW": "Agora mesmo",
"APPS_TWITTER_TIME_MINUTES": "m",
"APPS_TWITTER_TIME_HOURS": "h",
"APPS_TWITTER_TIME_DAYS": "d",
"APPS_MESSAGES_ME": "Eu",
"APPS_MESSAGES_MEMBERS_TITLE": "Membros",
"APPS_TWITTER_NEW_BROADCAST": "Novo tweet de @{{ profile_name }}!",
"APPS_TWITTER_UNREAD_MESSAGES": "Voce tem {{ count }} novos tweets na sua timeline!",
"APPS_MESSAGES_UNREAD_MESSAGES": "Voce tem {{ count }} Mensagens nao lidas",
"APPS_SETTINGS_OPTION_NOTIFICATION_FILTER": "Filtro de notificaçao",
"APPS_TWITTER_NEW_RETWEET_BROADCAST": "@{{ profile_name }} Retweetou alguem!",
"APPS_TWITTER_RETWEET_EXISTS": "Voce ja retweetou isso!",
"APPS_TWITTER_RETWEETED": "Retweetado",
"GENERIC_CALL": "Call",
"GENERIC_MESSAGE": "Mensagem",
"GENERIC_REPORT": "Reporte",
"GENERIC_WAIT": "Por favor aguarde...",
"GENERIC_WRITE_TO_CLIPBOARD_MESSAGE": "Copiado {{content}} para a área de transferência!!",
"GENERIC_WRITE_TO_CLIPBOARD_TOOLTIP": "Copiar {{ content }}",
"APPS_TWITTER_NEW_RETWEET_BROADCAST": "@{{ profile_name }} retuitou alguém!",
"APPS_TWITTER_UNREAD_MESSAGES": "Você tem {{ count }} novos tweets em sua linha do tempo!",
"APPS_MATCH": "Matchmaker",
"APPS_MATCH_LIKED": "CURTIR",
"APPS_MATCH_NOPE": "NÃO",
"APPS_MATCH_LIKE": "Curtir",
"APPS_MATCH_DISLIKE": "Não curtir",
"APPS_MATCH_NO_PROFILES": "Nenhum perfil recente encontrado",
"APPS_MATCH_NO_MATCHES": "Nenhum match encontrado",
"APPS_MATCH_PROFILES_ERROR": "Erro ao carregar perfis",
"APPS_MATCH_MATCHES_ERROR": "Erro ao carregar matches",
"APPS_MATCH_PROFILE_CONFIGURATION": "O aplicativo está configurado incorretamente - não foi possível criar o perfil. Entre em contato com um administrador.",
"APPS_MATCH_MY_PROFILE_ERROR": "Erro ao carregar o perfil.",
"APPS_MATCH_PROFILE_LAST_ACTIVE": "Última atividade:: {{ lastActive }}",
"APPS_MATCH_PROFILE_MATCHED_AT": "Matched: {{ matchedAt }}",
"APPS_MATCH_EDIT_PROFILE_PREVIEW": "Ver Preview",
"APPS_MATCH_EDIT_PROFILE_IMAGE": "URL da imagem",
"APPS_MATCH_EDIT_PROFILE_NAME": "Nome do perfil",
"APPS_MATCH_EDIT_PROFILE_BIO": "Bio",
"APPS_MATCH_EDIT_PROFILE_LOCATION": "Localização",
"APPS_MATCH_EDIT_PROFILE_JOB": "Emprego",
"APPS_MATCH_EDIT_PROFILE_TAGS": "Tags",
"APPS_MATCH_GET_MY_PROFILE_FAILED": "Falha ao recuperar o perfil do jogador",
"APPS_MATCH_GET_PROFILES_FAILED": "Falha ao recuperar perfis",
"APPS_MATCH_GET_MATCHES_FAILED": "Falha ao recuperar matches",
"APPS_MATCH_UPDATE_PROFILE_SUCCEEDED": "Perfil atualizado com sucesso",
"APPS_MATCH_UPDATE_PROFILE_FAILED": "Falha ao atualizar o seu pefil",
"APPS_MATCH_CREATE_PROFILE_FAILED": "Falha ao criar o seu perfil",
"APPS_MATCH_SAVE_LIKES_FAILED": "Falha ao salvar curtidas",
"APPS_MATCH_SAVE_LIKES_SUCCEDED": "Curtidas salvas com sucesso",
"APPS_MATCH_NEW_LIKE_FOUND": "Novo match encontrado!",
"APPS_BANK_TRANSFER": "Transferir",
"APPS_BANK_HOME_TITLE": "Bem vindo",
@@ -82,19 +137,25 @@
"APPS_BANK_ACCOUNT_SEE_TRANSACTION": "Ver tudo",
"APPS_BANK_ACTIONS_TRANSFER": "Transferir",
"APPS_BANK_ALERT_TRANSFER_SUCCESS": "Transferencia realizada com sucesso!",
"APPS_BANK_ALERT_TRANSFER_FAILURE": "Transferencia nao foi realizada",
"APPS_BANK_ALERT_TRANSFER_FAILURE": "Transferencia não foi realizada",
"APPS_MESSAGES_SEARCH_PLACEHOLDER": "Procurar mensagem...",
"APPS_MESSAGES_NEW_MESSAGE": "Mensagem...",
"APPS_MESSAGES_NEW_MESSAGE_FAILED:": "Mensagem nao pode ser enviada",
"APPS_MESSAGES_NEW_MESSAGE_FAILED:": "Mensagem não pode ser enviada",
"APPS_MESSAGES_NEW_MESSAGE_GROUP": "Números de telefone...",
"APPS_MESSAGES_GROUP_CHAT_LABEL": "Nome do chat em grupo...",
"APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT": "Enviar",
"APPS_MESSAGES_INVALID_PHONE_NUMBER": "Numero de telefone invalido: ",
"APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Esse grupo ja existe",
"APPS_MESSAGES_INVALID_PHONE_NUMBER": "Numero de telefone inválido: ",
"APPS_MESSAGES_MESSAGE_GROUP_DUPLICATE": "Esse grupo já existe",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_FAILED": "Falha ao criar grupo de mensagens",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Voce nao pode adcionar voce mesmo!",
"APPS_MESSAGES_INPUT_NAME_OR_NUMBER": "Procure por contatos ou numero e aperte enter",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_MINE": "Voce não pode adcionar você mesmo!",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_ALL_NUMBERS_FAILED": "Nenhum dos números de telefone foi encontrado!",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_ONE_NUMBER_FAILED": "{{ number }} não é um número registrado",
"APPS_MESSAGES_MESSAGE_GROUP_CREATE_SOME_NUMBERS_FAILED": "({{ numbers }}) não são números registrados.",
"APPS_MESSAGES_INPUT_NAME_OR_NUMBER": "Pesquise contatos ou digite o número e pressione Enter",
"APPS_MESSAGES_UNREAD_MESSAGES": "Você tem {{ count }} mensagens não lidas",
"APPS_MESSAGES_MEMBERS_TITLE": "Membros",
"APPS_MESSAGES_ME": "Eu",
"APPS_CONTACT_FORM_NAME": "Nome",
"APPS_CONTACT_FORM_NUMBER": "Número",
@@ -121,25 +182,46 @@
"APPS_CALCULATOR_COPIED": "Resultado foi copiado para a área de transferência!",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Lista sendo criada com sucesso",
"APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Falha em criar nova lista",
"APPS_SETTINGS_PHONE_NUMBER": "Número de telefone",
"APPS_SETTINGS_OPTION_WALLPAPER": "Papel de parede",
"APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER": "Papel de parede customizado",
"APPS_SETTINGS_OPTION_FRAME": "Frame",
"APPS_SETTINGS_OPTION_THEME": "Tema",
"APPS_SETTINGS_OPTION_ZOOM": "Zoom",
"APPS_SETTINGS_OPTION_STREAMER_MODE": "Modo Streamer",
"APPS_SETTINGS_OPTION_RINGTONE": "Toque",
"APPS_SETTINGS_OPTION_RINGTONEVOL": "Volume do toque",
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notificaçao",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Volume da notificaçao",
"APPS_SETTINGS_OPTION_NOTIFICATION_FILTER": "Filtros de Notificação",
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notificação",
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Volume das notificações",
"APPS_SETTING_STREAMER_MODE_DESC": "Ocultar as imagens antes de serem mostradas",
"APPS_SETTINGS_SET_CUSTOM_WALLPAPER": "Definir novo papel de parede",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Lista sendo criada com sucesso",
"APPS_MARKETPLACE_CREATE_LISTING_FAILED": "Falha em criar nova lista",
"APPS_MARKETPLACE_DELETE_LISTING_SUCCESS": "Lista excluída com sucesso",
"APPS_MARKETPLACE_DELETE_LISTING_FAILED": "Falha ao excluir lista",
"APPS_MARKETPLACE_REPORT_LISTING_FAILED": "Esta lista já foi reportada",
"APPS_MARKETPLACE_REPORT_LISTING_SUCCESS": "Lista reportada com sucesso",
"APPS_MARKETPLACE_REQUIRED_FIELDS": "Todos os campos devem ser preenchidos!",
"APPS_MARKETPLACE_FORM_TITLE": "Título",
"APPS_MARKETPLACE_FORM_IMAGE": "Imagem ou URL",
"APPS_MARKETPLACE_FORM_DESCRIPTION": "Descrição",
"GENERIC_CLICK_TO_REVEAL": "Clique para revelar",
"GENERIC_WAIT": "Por favor, espere...",
"GENERIC_SAVE": "Salvar",
"GENERIC_UPDATE": "Atualizar",
"GENERIC_DELETE": "Deletar",
"GENERIC_REQUIRED": "Requerido",
"GENERIC_DELETE": "Apagar",
"GENERIC_REPORT": "Reportar",
"GENERIC_CALL": "Chamar",
"GENERIC_MESSAGE": "Mensagem",
"GENERIC_CLOSE": "Fechar",
"GENERIC_CANCEL": "Cancelar",
"GENERIC_TITLE": "Titulo",
"GENERIC_CONTENT": "Conteudo"
"GENERIC_TITLE": "Título",
"GENERIC_CONTENT": "Conteúdo",
"GENERIC_WRITE_TO_CLIPBOARD_TOOLTIP": "Copiar {{ content }}",
"GENERIC_WRITE_TO_CLIPBOARD_MESSAGE": "{{content}} copiado(a) para a área de transferência!"
}
}
+3 -2
View File
@@ -112,7 +112,8 @@ export const APPS: IAppConfig[] = [
path: '/settings',
Route: () => <AppRoute id="SETTINGS" path="/settings" component={SettingsApp} />,
},
{
/* Hiding the bank app while the bank resource gets done */
/*{
id: 'BANK',
nameLocale: 'APPS_BANK',
icon: <FontAwesomeIcon icon={faWonSign} />,
@@ -121,7 +122,7 @@ export const APPS: IAppConfig[] = [
color: common.white,
path: '/bank',
Route: () => <AppRoute id="BANK" path="/bank" component={BankApp} />,
},
},*/
{
id: 'MATCH',
nameLocale: 'APPS_MATCH',
+31
View File
@@ -11,6 +11,7 @@ import { BankEvents } from '../../typings/bank';
import { PhotoEvents } from '../../typings/photo';
import { CallEvents } from '../../typings/call';
import { MatchEvents } from '../../typings/match';
import { Delay } from '../utils/fivem';
let isPhoneOpen = false;
let isPhoneReady = false;
@@ -51,6 +52,7 @@ const getCurrentGameTime = () => {
const showPhone = async (): Promise<void> => {
isPhoneOpen = true;
disableControls();
const time = getCurrentGameTime();
await phoneOpenAnim(); // Animation starts before the phone is open
emitNet('phone:getCredentials');
@@ -58,6 +60,7 @@ const showPhone = async (): Promise<void> => {
sendMessage('PHONE', 'setVisibility', true);
sendMessage('PHONE', 'setTime', time);
SetNuiFocus(true, true);
SetNuiFocusKeepInput(true);
};
const hidePhone = async (): Promise<void> => {
@@ -65,6 +68,7 @@ const hidePhone = async (): Promise<void> => {
sendMessage('PHONE', 'setVisibility', false);
await phoneCloseAnim();
SetNuiFocus(false, false);
SetNuiFocusKeepInput(false);
};
/* * * * * * * * * * * * *
@@ -196,3 +200,30 @@ on(`__cfx_nui:${PhoneEvents.CLOSE_PHONE}`, async (data: any, cb: Function) => {
// const time = getCurrentGameTime()
// sendMessage('PHONE', 'setTime', time)
// }, 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);
}
},
);
}
+1 -1
View File
@@ -76,7 +76,7 @@ const handleCameraExit = () => {
};
onNet(PhotoEvents.SEND_PHOTOS, (photos: string[]) => {
sendCameraEvent('setPhotos', photos);
sendCameraEvent(PhotoEvents.SEND_PHOTOS, photos);
});
function takePhoto() {
+3 -1
View File
@@ -70,7 +70,7 @@ function getRandomPhoneNumber() {
return randomNumber;
}
export async function generatePhoneNumber(identifier: string): Promise<void> {
export async function generatePhoneNumber(identifier: string): Promise<string> {
const getQuery = `SELECT phone_number FROM users WHERE identifier = ?`;
const [results] = await pool.query(getQuery, [identifier]);
const result = <any[]>results;
@@ -90,5 +90,7 @@ export async function generatePhoneNumber(identifier: string): Promise<void> {
mainLogger.debug(`Inserting number into Database: ${newNumber}`);
const query = 'UPDATE users SET phone_number = ? WHERE identifier = ?';
await pool.query(query, [newNumber, identifier]);
return newNumber;
}
return phoneNumber;
}
+13 -2
View File
@@ -32,10 +32,21 @@ export async function handlePlayerAdd(pSource: number) {
const username = GetPlayerName(pSource.toString());
playerLogger.info(`Started loading for ${username} (${pSource})`);
// Ensure phone number exists or generate
await generatePhoneNumber(playerIdentifer);
const phone_number = await generatePhoneNumber(playerIdentifer);
// Get player info to populate class instance
const { firstname, lastname, phone_number } = await getPlayerInfo(playerIdentifer);
let playerInfo = { firstname: '', lastname: '' };
try {
playerInfo = await getPlayerInfo(playerIdentifer);
} catch (e) {
playerLogger.debug(
`Failed to get player info, defaulting to phone number as profile, ${e.message}`,
{
source: pSource,
},
);
}
const { firstname, lastname } = playerInfo;
const newPlayer = new Player({
identifier: playerIdentifer,