mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
printWidth: 100
This commit is contained in:
1 parent
d27aeb3b0e
commit
6f4ee009a9
63 files changed
+486
-107
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 120,
|
"printWidth": 100,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"bracketSpacing": true,
|
"bracketSpacing": true,
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||||
|
/>
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Project Error - New Phone Who Dis</title>
|
<title>Project Error - New Phone Who Dis</title>
|
||||||
|
|||||||
@@ -30,9 +30,21 @@ export const NavigationBar = () => {
|
|||||||
showLabels
|
showLabels
|
||||||
className={classes.root}
|
className={classes.root}
|
||||||
>
|
>
|
||||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faHome} />} to="/bank" />
|
<BottomNavigationAction
|
||||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faMoneyCheck} />} to="/bank/account" />
|
component={Link}
|
||||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faList} />} to="/bank/transactions" />
|
icon={<FontAwesomeIcon icon={faHome} />}
|
||||||
|
to="/bank"
|
||||||
|
/>
|
||||||
|
<BottomNavigationAction
|
||||||
|
component={Link}
|
||||||
|
icon={<FontAwesomeIcon icon={faMoneyCheck} />}
|
||||||
|
to="/bank/account"
|
||||||
|
/>
|
||||||
|
<BottomNavigationAction
|
||||||
|
component={Link}
|
||||||
|
icon={<FontAwesomeIcon icon={faList} />}
|
||||||
|
to="/bank/transactions"
|
||||||
|
/>
|
||||||
</BottomNavigation>
|
</BottomNavigation>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -33,7 +33,9 @@ export const TransactionList = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={classes.transcationDiv}>
|
<div className={classes.transcationDiv}>
|
||||||
{transactionList.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((transaction: any) => (
|
{transactionList
|
||||||
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
||||||
|
.map((transaction: any) => (
|
||||||
<div className={classes.transactions}>
|
<div className={classes.transactions}>
|
||||||
<div>
|
<div>
|
||||||
<h1 className={classes.tranSource}>{transaction.source}</h1>
|
<h1 className={classes.tranSource}>{transaction.source}</h1>
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ export const GalleryModal = () => {
|
|||||||
|
|
||||||
const [shareOpen, setShareOpen] = useState(null);
|
const [shareOpen, setShareOpen] = useState(null);
|
||||||
|
|
||||||
const meta: ICameraPhoto = useMemo(() => ({ id: query.id as string, image: query.image as string }), [query]);
|
const meta: ICameraPhoto = useMemo(
|
||||||
|
() => ({ id: query.id as string, image: query.image as string }),
|
||||||
|
[query],
|
||||||
|
);
|
||||||
|
|
||||||
const _handleClose = () => {
|
const _handleClose = () => {
|
||||||
history.push(referal);
|
history.push(referal);
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ export const ShareModal = ({ meta, onClose, referal }: IShareModalProps) => {
|
|||||||
<div className={classes.shareModal}>
|
<div className={classes.shareModal}>
|
||||||
<div className={classes.innerShareModal}>
|
<div className={classes.innerShareModal}>
|
||||||
<>
|
<>
|
||||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>Where do you want to share the photo?</h4>
|
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
||||||
|
Where do you want to share the photo?
|
||||||
|
</h4>
|
||||||
<Button>{<MessageIcon />} Message</Button>
|
<Button>{<MessageIcon />} Message</Button>
|
||||||
<h4>Or just copy the image here:</h4>
|
<h4>Or just copy the image here:</h4>
|
||||||
<Button onClick={handleCopyImage} variant="contained">
|
<Button onClick={handleCopyImage} variant="contained">
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ export const ContactList = () => {
|
|||||||
<SearchContacts />
|
<SearchContacts />
|
||||||
<List>
|
<List>
|
||||||
{contacts
|
{contacts
|
||||||
.filter((contact) => contact.display.match(filteredRegEx) || contact.number.match(filteredRegEx))
|
.filter(
|
||||||
|
(contact) =>
|
||||||
|
contact.display.match(filteredRegEx) || contact.number.match(filteredRegEx),
|
||||||
|
)
|
||||||
.map((contact) => (
|
.map((contact) => (
|
||||||
<ListItem key={contact.id} divider>
|
<ListItem key={contact.id} divider>
|
||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ export const ContactPage = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ContactList />
|
<ContactList />
|
||||||
<Fab color="primary" onClick={() => history.push('/contacts/-1')} className={classes.absolute}>
|
<Fab
|
||||||
|
color="primary"
|
||||||
|
onClick={() => history.push('/contacts/-1')}
|
||||||
|
className={classes.absolute}
|
||||||
|
>
|
||||||
<PersonAddIcon />
|
<PersonAddIcon />
|
||||||
</Fab>
|
</Fab>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -27,7 +27,13 @@ const DialerNavBar = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<BottomNavigation value={page} onChange={handleChange} showLabels className={classes.root}>
|
<BottomNavigation value={page} onChange={handleChange} showLabels className={classes.root}>
|
||||||
<BottomNavigationAction label="History" value="/phone" component={NavLink} icon={<HistoryIcon />} to="/phone" />
|
<BottomNavigationAction
|
||||||
|
label="History"
|
||||||
|
value="/phone"
|
||||||
|
component={NavLink}
|
||||||
|
icon={<HistoryIcon />}
|
||||||
|
to="/phone"
|
||||||
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Dial"
|
label="Dial"
|
||||||
value="/phone/dial"
|
value="/phone/dial"
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ export const DialerHistory = ({ calls }) => {
|
|||||||
|
|
||||||
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
|
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)}
|
onClick={() =>
|
||||||
|
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{<PersonAddIcon />}
|
{<PersonAddIcon />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
@@ -86,7 +88,9 @@ export const DialerHistory = ({ calls }) => {
|
|||||||
|
|
||||||
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
|
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)}
|
onClick={() =>
|
||||||
|
history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{<PersonAddIcon />}
|
{<PersonAddIcon />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ export const ExampleApp = () => {
|
|||||||
<Button color="primary">{example.id}</Button>
|
<Button color="primary">{example.id}</Button>
|
||||||
{/* Here we are using the value in a h3 tag */}
|
{/* Here we are using the value in a h3 tag */}
|
||||||
<h3>{exampleString}</h3>
|
<h3>{exampleString}</h3>
|
||||||
<IconButton onClick={() => (playing ? stop() : play())}>{playing ? <StopIcon /> : <PlayIcon />}</IconButton>
|
<IconButton onClick={() => (playing ? stop() : play())}>
|
||||||
|
{playing ? <StopIcon /> : <PlayIcon />}
|
||||||
|
</IconButton>
|
||||||
<Button onClick={toggleSound}>Change sound on the fly</Button>
|
<Button onClick={toggleSound}>Change sound on the fly</Button>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
|
|||||||
@@ -38,7 +38,11 @@ export const MessagesApp = () => {
|
|||||||
/>
|
/>
|
||||||
</Switch>
|
</Switch>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path={['/messages/new/:phoneNumber', '/messages/new']} render={() => <MessageGroupModal />} />
|
<Route
|
||||||
|
exact
|
||||||
|
path={['/messages/new/:phoneNumber', '/messages/new']}
|
||||||
|
render={() => <MessageGroupModal />}
|
||||||
|
/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
<NewMessageGroupButton onClick={() => history.push('/messages/new')} />
|
<NewMessageGroupButton onClick={() => history.push('/messages/new')} />
|
||||||
|
|||||||
@@ -99,7 +99,13 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Box px={2} py={3}>
|
<Box px={2} py={3}>
|
||||||
<Button disabled={submitDisabled} variant="contained" fullWidth color="primary" type="submit">
|
<Button
|
||||||
|
disabled={submitDisabled}
|
||||||
|
variant="contained"
|
||||||
|
fullWidth
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
|
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ const MessagesList = (): any => {
|
|||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
|
|
||||||
const goToConversation = useCallback(
|
const goToConversation = useCallback(
|
||||||
(messageGroup) => history.push(`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`),
|
(messageGroup) =>
|
||||||
|
history.push(
|
||||||
|
`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`,
|
||||||
|
),
|
||||||
[history],
|
[history],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -55,7 +58,11 @@ const MessagesList = (): any => {
|
|||||||
<MessageSearch value={searchValue} handleChange={(e) => setSearchValue(e.target.value)} />
|
<MessageSearch value={searchValue} handleChange={(e) => setSearchValue(e.target.value)} />
|
||||||
<List className={classes.root}>
|
<List className={classes.root}>
|
||||||
{filteredGroups.map((messageGroup) => (
|
{filteredGroups.map((messageGroup) => (
|
||||||
<MessageGroupItem key={messageGroup.groupId} messageGroup={messageGroup} handleClick={handleClick} />
|
<MessageGroupItem
|
||||||
|
key={messageGroup.groupId}
|
||||||
|
messageGroup={messageGroup}
|
||||||
|
handleClick={handleClick}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -38,10 +38,17 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
|||||||
className={classes.overflowAutoY}
|
className={classes.overflowAutoY}
|
||||||
>
|
>
|
||||||
{messages.map((message) => (
|
{messages.map((message) => (
|
||||||
<MessageBubble key={message.id} message={message} isGroupChat={activeMessageGroup?.isGroupChat} />
|
<MessageBubble
|
||||||
|
key={message.id}
|
||||||
|
message={message}
|
||||||
|
isGroupChat={activeMessageGroup?.isGroupChat}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
<MessageInput messageGroupId={activeMessageGroup.groupId} onAddImageClick={() => setImageModalOpen(true)} />
|
<MessageInput
|
||||||
|
messageGroupId={activeMessageGroup.groupId}
|
||||||
|
onAddImageClick={() => setImageModalOpen(true)}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,13 @@ const isImage = (url) => {
|
|||||||
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
|
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MessageBubble = ({ message, isGroupChat }: { message: Message; isGroupChat: boolean }) => {
|
export const MessageBubble = ({
|
||||||
|
message,
|
||||||
|
isGroupChat,
|
||||||
|
}: {
|
||||||
|
message: Message;
|
||||||
|
isGroupChat: boolean;
|
||||||
|
}) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ export const MessageModal = () => {
|
|||||||
const truncatedHeader = `${header.slice(0, MAX_HEADER_CHARS).trim()}...`;
|
const truncatedHeader = `${header.slice(0, MAX_HEADER_CHARS).trim()}...`;
|
||||||
header = header.length > MAX_HEADER_CHARS ? activeMessageGroup?.label || truncatedHeader : header;
|
header = header.length > MAX_HEADER_CHARS ? activeMessageGroup?.label || truncatedHeader : header;
|
||||||
|
|
||||||
const headerClass = header.length > LARGE_HEADER_CHARS ? classes.largeGroupDisplay : classes.groupdisplay;
|
const headerClass =
|
||||||
|
header.length > LARGE_HEADER_CHARS ? classes.largeGroupDisplay : classes.groupdisplay;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slide direction="left" in={!!activeMessageGroup}>
|
<Slide direction="left" in={!!activeMessageGroup}>
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ export default (): IUseMessages => {
|
|||||||
const [messages, setMessages] = useRecoilState<Message[] | null>(messageState.messages);
|
const [messages, setMessages] = useRecoilState<Message[] | null>(messageState.messages);
|
||||||
const messageGroups = useRecoilValue<MessageGroup[] | null>(messageState.messageGroups);
|
const messageGroups = useRecoilValue<MessageGroup[] | null>(messageState.messageGroups);
|
||||||
|
|
||||||
const [createMessageGroupResult, setCreateMessageGroupResult] = useRecoilState<CreateMessageGroupResult | null>(
|
const [
|
||||||
messageState.createMessageGroupResult,
|
createMessageGroupResult,
|
||||||
);
|
setCreateMessageGroupResult,
|
||||||
|
] = useRecoilState<CreateMessageGroupResult | null>(messageState.createMessageGroupResult);
|
||||||
|
|
||||||
const clearMessageGroupResult = () => setCreateMessageGroupResult(null);
|
const clearMessageGroupResult = () => setCreateMessageGroupResult(null);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
import { Button, TextField, Slide, Paper, Typography, Container, CircularProgress, Box } from '@material-ui/core';
|
import {
|
||||||
|
Button,
|
||||||
|
TextField,
|
||||||
|
Slide,
|
||||||
|
Paper,
|
||||||
|
Typography,
|
||||||
|
Container,
|
||||||
|
CircularProgress,
|
||||||
|
Box,
|
||||||
|
} from '@material-ui/core';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ export const SelloutItem = (listing) => {
|
|||||||
<Typography className={classes.headerTypo} variant="h5">
|
<Typography className={classes.headerTypo} variant="h5">
|
||||||
{listing.name}
|
{listing.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography className={classes.headerTypo} style={{ borderBottom: '1px solid #f44336' }}>
|
<Typography
|
||||||
|
className={classes.headerTypo}
|
||||||
|
style={{ borderBottom: '1px solid #f44336' }}
|
||||||
|
>
|
||||||
{listing.number}
|
{listing.number}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h5" style={{ padding: 5 }}>
|
<Typography variant="h5" style={{ padding: 5 }}>
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ export const NavigationBar = () => {
|
|||||||
showLabels
|
showLabels
|
||||||
className={classes.root}
|
className={classes.root}
|
||||||
>
|
>
|
||||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faHome} />} to="/sellout" />
|
<BottomNavigationAction
|
||||||
|
component={Link}
|
||||||
|
icon={<FontAwesomeIcon icon={faHome} />}
|
||||||
|
to="/sellout"
|
||||||
|
/>
|
||||||
<BottomNavigationAction component={Link} icon={<AddCircleIcon />} to="/sellout/new" />
|
<BottomNavigationAction component={Link} icon={<AddCircleIcon />} to="/sellout/new" />
|
||||||
</BottomNavigation>
|
</BottomNavigation>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,15 @@ import { useApp } from '../../../os/apps/hooks/useApps';
|
|||||||
import { SettingItem } from './SettingItem';
|
import { SettingItem } from './SettingItem';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Brush, Wallpaper, Phone, Smartphone, ZoomIn, LibraryMusic, VolumeUp } from '@material-ui/icons';
|
import {
|
||||||
|
Brush,
|
||||||
|
Wallpaper,
|
||||||
|
Phone,
|
||||||
|
Smartphone,
|
||||||
|
ZoomIn,
|
||||||
|
LibraryMusic,
|
||||||
|
VolumeUp,
|
||||||
|
} from '@material-ui/icons';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
@@ -77,11 +85,15 @@ export const SettingsApp = () => {
|
|||||||
MapStringOptions(settings.ringtone, (val: string) => handleSettingChange('ringtone', val)),
|
MapStringOptions(settings.ringtone, (val: string) => handleSettingChange('ringtone', val)),
|
||||||
);
|
);
|
||||||
const notifications = config.notifications.map(
|
const notifications = config.notifications.map(
|
||||||
MapStringOptions(settings.notification, (val: string) => handleSettingChange('notification', val)),
|
MapStringOptions(settings.notification, (val: string) =>
|
||||||
|
handleSettingChange('notification', val),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const twitterNotifications = config.notifications.map(
|
const twitterNotifications = config.notifications.map(
|
||||||
MapStringOptions(settings.notification, (val: string) => handleSettingChange('TWITTER_notification', val)),
|
MapStringOptions(settings.notification, (val: string) =>
|
||||||
|
handleSettingChange('TWITTER_notification', val),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
|
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
|
||||||
@@ -90,7 +102,11 @@ export const SettingsApp = () => {
|
|||||||
<AppTitle app={settingsApp} />
|
<AppTitle app={settingsApp} />
|
||||||
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
||||||
<List disablePadding subheader={<SubHeaderComp text="Phone" />}>
|
<List disablePadding subheader={<SubHeaderComp text="Phone" />}>
|
||||||
<SettingItem label={t('APPS_SETTINGS_PHONE_NUMBER')} value={simcard.number} icon={<Phone />} />
|
<SettingItem
|
||||||
|
label={t('APPS_SETTINGS_PHONE_NUMBER')}
|
||||||
|
value={simcard.number}
|
||||||
|
icon={<Phone />}
|
||||||
|
/>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label={t('APPS_SETTINGS_OPTION_RINGTONE')}
|
label={t('APPS_SETTINGS_OPTION_RINGTONE')}
|
||||||
value={settings.ringtone}
|
value={settings.ringtone}
|
||||||
@@ -102,7 +118,10 @@ export const SettingsApp = () => {
|
|||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<VolumeUp />
|
<VolumeUp />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={t('APPS_SETTINGS_OPTION_RINGTONEVOL')} secondary={settings.ringtoneVol} />
|
<ListItemText
|
||||||
|
primary={t('APPS_SETTINGS_OPTION_RINGTONEVOL')}
|
||||||
|
secondary={settings.ringtoneVol}
|
||||||
|
/>
|
||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<Box p={2} width={150}>
|
<Box p={2} width={150}>
|
||||||
<Slider
|
<Slider
|
||||||
@@ -126,7 +145,10 @@ export const SettingsApp = () => {
|
|||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<VolumeUp />
|
<VolumeUp />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={t('APPS_SETTINGS_OPTION_NOTIFICATIONVOL')} secondary={settings.notificationVol} />
|
<ListItemText
|
||||||
|
primary={t('APPS_SETTINGS_OPTION_NOTIFICATIONVOL')}
|
||||||
|
secondary={settings.notificationVol}
|
||||||
|
/>
|
||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<Box p={2} width={150}>
|
<Box p={2} width={150}>
|
||||||
<Slider
|
<Slider
|
||||||
@@ -194,7 +216,9 @@ export const SettingsApp = () => {
|
|||||||
min={0}
|
min={0}
|
||||||
max={100}
|
max={100}
|
||||||
onChange={handleSliderChange(2)}
|
onChange={handleSliderChange(2)}
|
||||||
onChangeCommitted={() => handleSettingChange('TWITTER_notificationVol', sliders[2])}
|
onChangeCommitted={() =>
|
||||||
|
handleSettingChange('TWITTER_notificationVol', sliders[2])
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</ListItemSecondaryAction>
|
</ListItemSecondaryAction>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export const getRingtonePath = (name?: string) => `./media/ringtones/${name || 'pixel'}.ogg`;
|
export const getRingtonePath = (name?: string) => `./media/ringtones/${name || 'pixel'}.ogg`;
|
||||||
|
|
||||||
export const getNotificationPath = (name?: string) => `./media/notifications/${name || 'online'}.ogg`;
|
export const getNotificationPath = (name?: string) =>
|
||||||
|
`./media/notifications/${name || 'online'}.ogg`;
|
||||||
@@ -106,7 +106,8 @@ export const AddTweetModal = () => {
|
|||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
message,
|
message,
|
||||||
images: images && images.length > 0 ? images.map((image) => image.link).join(IMAGE_DELIMITER) : '',
|
images:
|
||||||
|
images && images.length > 0 ? images.map((image) => image.link).join(IMAGE_DELIMITER) : '',
|
||||||
realUser: 'testUser',
|
realUser: 'testUser',
|
||||||
};
|
};
|
||||||
Nui.send('phone:createTweet', data);
|
Nui.send('phone:createTweet', data);
|
||||||
@@ -155,10 +156,18 @@ export const AddTweetModal = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal visible={modalVisible} handleClose={_handleClose}>
|
<Modal visible={modalVisible} handleClose={_handleClose}>
|
||||||
<TweetMessage modalVisible={modalVisible} message={message} handleChange={handleMessageChange} />
|
<TweetMessage
|
||||||
|
modalVisible={modalVisible}
|
||||||
|
message={message}
|
||||||
|
handleChange={handleMessageChange}
|
||||||
|
/>
|
||||||
<ImagePrompt visible={showImagePrompt} value={link} handleChange={handleimageChange} />
|
<ImagePrompt visible={showImagePrompt} value={link} handleChange={handleimageChange} />
|
||||||
<EmojiSelect visible={showEmoji} onEmojiClick={handleSelectEmoji} />
|
<EmojiSelect visible={showEmoji} onEmojiClick={handleSelectEmoji} />
|
||||||
<ImageDisplay visible={!showEmoji && images.length > 0} images={images} removeImage={removeImage} />
|
<ImageDisplay
|
||||||
|
visible={!showEmoji && images.length > 0}
|
||||||
|
images={images}
|
||||||
|
removeImage={removeImage}
|
||||||
|
/>
|
||||||
<div className={classes.buttonsContainer}>
|
<div className={classes.buttonsContainer}>
|
||||||
<IconButtons
|
<IconButtons
|
||||||
onImageClick={images.length < config.twitter.maxImages ? toggleShowImagePrompt : null}
|
onImageClick={images.length < config.twitter.maxImages ? toggleShowImagePrompt : null}
|
||||||
|
|||||||
@@ -82,7 +82,9 @@ export const TwitterApp = () => {
|
|||||||
)}
|
)}
|
||||||
</AppContent>
|
</AppContent>
|
||||||
{showTweetButton && <TweetButton openModal={openModal} />}
|
{showTweetButton && <TweetButton openModal={openModal} />}
|
||||||
{!promptProfileName && <BottomNavigation activePage={activePage} handleChange={handlePageChange} />}
|
{!promptProfileName && (
|
||||||
|
<BottomNavigation activePage={activePage} handleChange={handlePageChange} />
|
||||||
|
)}
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPri
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const imagePromptVisible = showImagePrompt && !showEmoji;
|
const imagePromptVisible = showImagePrompt && !showEmoji;
|
||||||
const primaryButtonText = imagePromptVisible ? t('APPS_TWITTER_SUBMIT_IMAGE') : t('APPS_TWITTER_TWEET');
|
const primaryButtonText = imagePromptVisible
|
||||||
|
? t('APPS_TWITTER_SUBMIT_IMAGE')
|
||||||
|
: t('APPS_TWITTER_TWEET');
|
||||||
const showCloseButton = showImagePrompt || showEmoji;
|
const showCloseButton = showImagePrompt || showEmoji;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -30,7 +32,12 @@ export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPri
|
|||||||
{primaryButtonText}
|
{primaryButtonText}
|
||||||
</Button>
|
</Button>
|
||||||
{showCloseButton && (
|
{showCloseButton && (
|
||||||
<Button className={classes.close} variant="contained" color="secondary" onClick={onCloseClick}>
|
<Button
|
||||||
|
className={classes.close}
|
||||||
|
variant="contained"
|
||||||
|
color="secondary"
|
||||||
|
onClick={onCloseClick}
|
||||||
|
>
|
||||||
{t('APPS_TWITTER_CLOSE_IMAGE')}
|
{t('APPS_TWITTER_CLOSE_IMAGE')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -70,13 +70,22 @@ export function Profile() {
|
|||||||
handleChange={handleNameChange}
|
handleChange={handleNameChange}
|
||||||
allowChange={allowEdtiableProfileName}
|
allowChange={allowEdtiableProfileName}
|
||||||
/>
|
/>
|
||||||
<ProfileField label={t('APPS_TWITTER_EDIT_PROFILE_BIO')} value={bio} handleChange={handleBioChange} multiline />
|
<ProfileField
|
||||||
|
label={t('APPS_TWITTER_EDIT_PROFILE_BIO')}
|
||||||
|
value={bio}
|
||||||
|
handleChange={handleBioChange}
|
||||||
|
multiline
|
||||||
|
/>
|
||||||
<ProfileField
|
<ProfileField
|
||||||
label={t('APPS_TWITTER_EDIT_PROFILE_LOCATION')}
|
label={t('APPS_TWITTER_EDIT_PROFILE_LOCATION')}
|
||||||
value={location}
|
value={location}
|
||||||
handleChange={handleLocationChange}
|
handleChange={handleLocationChange}
|
||||||
/>
|
/>
|
||||||
<ProfileField label={t('APPS_TWITTER_EDIT_PROFILE_JOB')} value={job} handleChange={handleJobChange} />
|
<ProfileField
|
||||||
|
label={t('APPS_TWITTER_EDIT_PROFILE_JOB')}
|
||||||
|
value={job}
|
||||||
|
handleChange={handleJobChange}
|
||||||
|
/>
|
||||||
<ProfileUpdateButton handleClick={handleUpdate} />
|
<ProfileUpdateButton handleClick={handleUpdate} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -76,8 +76,12 @@ export const ShowMore = ({ id, isReported, isMine }) => {
|
|||||||
horizontal: 'left',
|
horizontal: 'left',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{allowedToDelete && <MenuItem onClick={handleDeleteTweet}>{t('APPS_TWITTER_DELETE')}</MenuItem>}
|
{allowedToDelete && (
|
||||||
{allowedToReport && <ReportButton handleClose={handleClose} isReported={isReported} tweetId={id} />}
|
<MenuItem onClick={handleDeleteTweet}>{t('APPS_TWITTER_DELETE')}</MenuItem>
|
||||||
|
)}
|
||||||
|
{allowedToReport && (
|
||||||
|
<ReportButton handleClose={handleClose} isReported={isReported} tweetId={id} />
|
||||||
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -56,7 +56,17 @@ const useStyles = makeStyles(() => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
export const Tweet = (tweet) => {
|
export const Tweet = (tweet) => {
|
||||||
const { id, message, images, avatar_url, profile_name, seconds_since_tweet, isLiked, isMine, isReported } = tweet;
|
const {
|
||||||
|
id,
|
||||||
|
message,
|
||||||
|
images,
|
||||||
|
avatar_url,
|
||||||
|
profile_name,
|
||||||
|
seconds_since_tweet,
|
||||||
|
isLiked,
|
||||||
|
isMine,
|
||||||
|
isReported,
|
||||||
|
} = tweet;
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { config } = usePhone();
|
const { config } = usePhone();
|
||||||
@@ -90,7 +100,12 @@ export const Tweet = (tweet) => {
|
|||||||
<div className={classes.content}>
|
<div className={classes.content}>
|
||||||
<div className={classes.primary}>
|
<div className={classes.primary}>
|
||||||
<div className={classes.profile}>{profileName}</div>
|
<div className={classes.profile}>{profileName}</div>
|
||||||
<Typography className={classes.date} component="div" variant="body2" color="textSecondary">
|
<Typography
|
||||||
|
className={classes.date}
|
||||||
|
component="div"
|
||||||
|
variant="body2"
|
||||||
|
color="textSecondary"
|
||||||
|
>
|
||||||
{secondsToHumanReadable(t, seconds_since_tweet)}
|
{secondsToHumanReadable(t, seconds_since_tweet)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -51,10 +51,14 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
|
|||||||
let errorMessage = null;
|
let errorMessage = null;
|
||||||
|
|
||||||
const overCharacterLimit = message.trim().length > characterLimit;
|
const overCharacterLimit = message.trim().length > characterLimit;
|
||||||
const characterWarningPrompt = `${t('APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT')} (${characterLimit})`;
|
const characterWarningPrompt = `${t(
|
||||||
|
'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT',
|
||||||
|
)} (${characterLimit})`;
|
||||||
|
|
||||||
const overNewLineLimit = getNewLineCount(message) > newLineLimit;
|
const overNewLineLimit = getNewLineCount(message) > newLineLimit;
|
||||||
const newLineWarningPrompt = `${t('APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT')} (${newLineLimit})`;
|
const newLineWarningPrompt = `${t(
|
||||||
|
'APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT',
|
||||||
|
)} (${newLineLimit})`;
|
||||||
|
|
||||||
if (overCharacterLimit) {
|
if (overCharacterLimit) {
|
||||||
errorMessage = characterWarningPrompt;
|
errorMessage = characterWarningPrompt;
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ interface IUseProfile {
|
|||||||
export const useProfile = (): IUseProfile => {
|
export const useProfile = (): IUseProfile => {
|
||||||
const profile = useRecoilValue(twitterState.profile);
|
const profile = useRecoilValue(twitterState.profile);
|
||||||
const updateProfileLoading = useRecoilValue(twitterState.updateProfileLoading);
|
const updateProfileLoading = useRecoilValue(twitterState.updateProfileLoading);
|
||||||
const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(twitterState.updateProfileSuccess);
|
const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(
|
||||||
|
twitterState.updateProfileSuccess,
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
profile,
|
profile,
|
||||||
updateProfileLoading,
|
updateProfileLoading,
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import { twitterState } from './state';
|
|||||||
|
|
||||||
export const useTweetStatus = () => {
|
export const useTweetStatus = () => {
|
||||||
const createTweetLoading = useRecoilValue(twitterState.createTweetLoading);
|
const createTweetLoading = useRecoilValue(twitterState.createTweetLoading);
|
||||||
const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(twitterState.createTweetSuccessful);
|
const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(
|
||||||
|
twitterState.createTweetSuccessful,
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
createTweetLoading,
|
createTweetLoading,
|
||||||
createTweetSuccessful,
|
createTweetSuccessful,
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ interface IRouterLocation {
|
|||||||
search: any;
|
search: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleteQueryFromLocation = (location: Record<string, unknown> & IRouterLocation, key = '') => {
|
export const deleteQueryFromLocation = (
|
||||||
|
location: Record<string, unknown> & IRouterLocation,
|
||||||
|
key = '',
|
||||||
|
) => {
|
||||||
const { query } = url(location.pathname + location.search);
|
const { query } = url(location.pathname + location.search);
|
||||||
return `${location.pathname}/?${qs.stringify({
|
return `${location.pathname}/?${qs.stringify({
|
||||||
...query,
|
...query,
|
||||||
|
|||||||
@@ -19,7 +19,15 @@
|
|||||||
"printDebugLogs": true,
|
"printDebugLogs": true,
|
||||||
"logLevel": 1
|
"logLevel": 1
|
||||||
},
|
},
|
||||||
"frames": ["default.png", "blue.png", "gold.png", "kawaii.png", "minimal.png", "pink.png", "white.png"],
|
"frames": [
|
||||||
|
"default.png",
|
||||||
|
"blue.png",
|
||||||
|
"gold.png",
|
||||||
|
"kawaii.png",
|
||||||
|
"minimal.png",
|
||||||
|
"pink.png",
|
||||||
|
"white.png"
|
||||||
|
],
|
||||||
"zoomOptions": [1, 0.9, 0.8],
|
"zoomOptions": [1, 0.9, 0.8],
|
||||||
"ringtones": ["marimba", "pixel"],
|
"ringtones": ["marimba", "pixel"],
|
||||||
"notifications": ["online", "99kr"],
|
"notifications": ["online", "99kr"],
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
|
||||||
'Droid Sans', 'Helvetica Neue', sans-serif;
|
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { blue, common, grey, purple } from '@material-ui/core/colors';
|
import { blue, common, grey, purple } from '@material-ui/core/colors';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faAd, faPlaneArrival, faPhoneAlt, faWonSign, faStickyNote } from '@fortawesome/free-solid-svg-icons';
|
import {
|
||||||
|
faAd,
|
||||||
|
faPlaneArrival,
|
||||||
|
faPhoneAlt,
|
||||||
|
faWonSign,
|
||||||
|
faStickyNote,
|
||||||
|
} from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faTwitter } from '@fortawesome/free-brands-svg-icons';
|
import { faTwitter } from '@fortawesome/free-brands-svg-icons';
|
||||||
|
|
||||||
import ContactsIcon from '@material-ui/icons/Contacts';
|
import ContactsIcon from '@material-ui/icons/Contacts';
|
||||||
@@ -22,9 +28,18 @@ import { NotesApp } from '../../../apps/notes/NotesApp';
|
|||||||
import CameraApp from '../../../apps/camera/components/CameraApp';
|
import CameraApp from '../../../apps/camera/components/CameraApp';
|
||||||
import { AppRoute } from '../components/AppRoute';
|
import { AppRoute } from '../components/AppRoute';
|
||||||
|
|
||||||
import { MESSAGES_APP_PRIMARY_COLOR, MESSAGES_APP_TEXT_COLOR } from '../../../apps/messages/messages.theme';
|
import {
|
||||||
import { CONTACTS_APP_PRIMARY_COLOR, CONTACTS_APP_TEXT_COLOR } from '../../../apps/contacts/contacts.theme';
|
MESSAGES_APP_PRIMARY_COLOR,
|
||||||
import { SELLOUT_APP_PRIMARY_COLOR, SELLOUT_APP_ICON_COLOR } from '../../../apps/sellout/sellout.theme';
|
MESSAGES_APP_TEXT_COLOR,
|
||||||
|
} from '../../../apps/messages/messages.theme';
|
||||||
|
import {
|
||||||
|
CONTACTS_APP_PRIMARY_COLOR,
|
||||||
|
CONTACTS_APP_TEXT_COLOR,
|
||||||
|
} from '../../../apps/contacts/contacts.theme';
|
||||||
|
import {
|
||||||
|
SELLOUT_APP_PRIMARY_COLOR,
|
||||||
|
SELLOUT_APP_ICON_COLOR,
|
||||||
|
} from '../../../apps/sellout/sellout.theme';
|
||||||
import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme';
|
import { NOTES_APP_ICON_COLOR, NOTES_APP_PRIMARY_COLOR } from '../../../apps/notes/notes.theme';
|
||||||
import { DIALER_APP_PRIMARY_COLOR, DIALER_APP_TEXT_COLOR } from '../../../apps/dialer/dialer.theme';
|
import { DIALER_APP_PRIMARY_COLOR, DIALER_APP_TEXT_COLOR } from '../../../apps/dialer/dialer.theme';
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ export const useApps = () => {
|
|||||||
})),
|
})),
|
||||||
[icons],
|
[icons],
|
||||||
);
|
);
|
||||||
const getApp = useCallback((id: string): IAppConfig => apps.find((a) => a.id === id) || null, [apps]);
|
const getApp = useCallback((id: string): IAppConfig => apps.find((a) => a.id === id) || null, [
|
||||||
|
apps,
|
||||||
|
]);
|
||||||
return { apps, getApp };
|
return { apps, getApp };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,15 @@ const keyboardState = {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
const validKeys = ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'Backspace', 'Enter', 'Escape'];
|
const validKeys = [
|
||||||
|
'ArrowRight',
|
||||||
|
'ArrowLeft',
|
||||||
|
'ArrowUp',
|
||||||
|
'ArrowDown',
|
||||||
|
'Backspace',
|
||||||
|
'Enter',
|
||||||
|
'Escape',
|
||||||
|
];
|
||||||
|
|
||||||
const isKeyValid = (key) => validKeys.indexOf(key) !== -1;
|
const isKeyValid = (key) => validKeys.indexOf(key) !== -1;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ export const Navigation = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BottomNavigationAction label="Home" value={() => history.push('/')} icon={<AppsIcon />} />
|
<BottomNavigationAction label="Home" value={() => history.push('/')} icon={<AppsIcon />} />
|
||||||
<BottomNavigationAction label="Close" value={closePhone} icon={<RadioButtonUncheckedIcon />} />
|
<BottomNavigationAction
|
||||||
|
label="Close"
|
||||||
|
value={closePhone}
|
||||||
|
icon={<RadioButtonUncheckedIcon />}
|
||||||
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Back"
|
label="Back"
|
||||||
value={() => !isExact && history.goBack()}
|
value={() => !isExact && history.goBack()}
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { makeStyles, Typography, Grid, IconButton, Slide, Paper, Box, List, Divider } from '@material-ui/core';
|
import {
|
||||||
|
makeStyles,
|
||||||
|
Typography,
|
||||||
|
Grid,
|
||||||
|
IconButton,
|
||||||
|
Slide,
|
||||||
|
Paper,
|
||||||
|
Box,
|
||||||
|
List,
|
||||||
|
Divider,
|
||||||
|
} from '@material-ui/core';
|
||||||
import SignalIcon from '@material-ui/icons/SignalCellular3Bar';
|
import SignalIcon from '@material-ui/icons/SignalCellular3Bar';
|
||||||
import Battery90Icon from '@material-ui/icons/Battery90';
|
import Battery90Icon from '@material-ui/icons/Battery90';
|
||||||
import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp';
|
import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp';
|
||||||
@@ -56,7 +66,13 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
export const NotificationBar = () => {
|
export const NotificationBar = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
const { icons, notifications, removeNotification, barUncollapsed, setBarUncollapsed } = useNotifications();
|
const {
|
||||||
|
icons,
|
||||||
|
notifications,
|
||||||
|
removeNotification,
|
||||||
|
barUncollapsed,
|
||||||
|
setBarUncollapsed,
|
||||||
|
} = useNotifications();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -118,7 +134,11 @@ export const NotificationBar = () => {
|
|||||||
</List>
|
</List>
|
||||||
</Box>
|
</Box>
|
||||||
<Box display="flex">
|
<Box display="flex">
|
||||||
<IconButton className={classes.collapseBtn} size="small" onClick={() => setBarUncollapsed(false)}>
|
<IconButton
|
||||||
|
className={classes.collapseBtn}
|
||||||
|
size="small"
|
||||||
|
onClick={() => setBarUncollapsed(false)}
|
||||||
|
>
|
||||||
<ArrowDropUpIcon />
|
<ArrowDropUpIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import CloseIcon from '@material-ui/icons/Close';
|
import CloseIcon from '@material-ui/icons/Close';
|
||||||
import { IconButton, ListItem, ListItemAvatar, ListItemText, makeStyles, Theme } from '@material-ui/core';
|
import {
|
||||||
|
IconButton,
|
||||||
|
ListItem,
|
||||||
|
ListItemAvatar,
|
||||||
|
ListItemText,
|
||||||
|
makeStyles,
|
||||||
|
Theme,
|
||||||
|
} from '@material-ui/core';
|
||||||
import { INotification } from '../providers/NotificationsProvider';
|
import { INotification } from '../providers/NotificationsProvider';
|
||||||
|
|
||||||
const useStyles = makeStyles<Theme, { cantClose: boolean }>((theme) => ({
|
const useStyles = makeStyles<Theme, { cantClose: boolean }>((theme) => ({
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ export function NotificationsProvider({ children }) {
|
|||||||
const { mount, play } = useSoundProvider();
|
const { mount, play } = useSoundProvider();
|
||||||
|
|
||||||
const alertTimeout = useRef<NodeJS.Timeout>();
|
const alertTimeout = useRef<NodeJS.Timeout>();
|
||||||
const [alerts, setAlerts] = useState<Array<[INotification, boolean, Partial<INotification>, string | undefined]>>([]);
|
const [alerts, setAlerts] = useState<
|
||||||
|
Array<[INotification, boolean, Partial<INotification>, string | undefined]>
|
||||||
|
>([]);
|
||||||
const [currentAlert, setCurrentAlert] = useState<INotificationAlert>();
|
const [currentAlert, setCurrentAlert] = useState<INotificationAlert>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -154,10 +156,16 @@ export function NotificationsProvider({ children }) {
|
|||||||
[addOrUpdateNotification, play],
|
[addOrUpdateNotification, play],
|
||||||
);
|
);
|
||||||
|
|
||||||
const addNotificationAlert = (n: INotification, persist?: boolean, update?: Partial<INotification>) => {
|
const addNotificationAlert = (
|
||||||
|
n: INotification,
|
||||||
|
persist?: boolean,
|
||||||
|
update?: Partial<INotification>,
|
||||||
|
) => {
|
||||||
if (n.sound) {
|
if (n.sound) {
|
||||||
const { sound, volume } = getSoundSettings('notification', settings, n.app);
|
const { sound, volume } = getSoundSettings('notification', settings, n.app);
|
||||||
mount(sound, volume, false).then(({ url }) => setAlerts((curr) => [...curr, [n, persist, update, url]]));
|
mount(sound, volume, false).then(({ url }) =>
|
||||||
|
setAlerts((curr) => [...curr, [n, persist, update, url]]),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setAlerts((curr) => [...curr, [n, persist, update, undefined]]);
|
setAlerts((curr) => [...curr, [n, persist, update, undefined]]);
|
||||||
|
|||||||
@@ -41,7 +41,20 @@ const useSound = (url: string, options: ISoundOptions = DEFAULT_OPTIONS) => {
|
|||||||
}
|
}
|
||||||
volume(url, vol);
|
volume(url, vol);
|
||||||
loop(url, isLoop);
|
loop(url, isLoop);
|
||||||
}, [url, vol, isLoop, isMounted, volume, loop, mount, previousUrl, stop, remove, isPlaying, play]);
|
}, [
|
||||||
|
url,
|
||||||
|
vol,
|
||||||
|
isLoop,
|
||||||
|
isMounted,
|
||||||
|
volume,
|
||||||
|
loop,
|
||||||
|
mount,
|
||||||
|
previousUrl,
|
||||||
|
stop,
|
||||||
|
remove,
|
||||||
|
isPlaying,
|
||||||
|
play,
|
||||||
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (interrupt) {
|
if (interrupt) {
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ export const SoundProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
soundRefs.current = new Map();
|
soundRefs.current = new Map();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const mount = useCallback((url: string, volume: number = 1, loop: boolean = false, autoplay: boolean = false) => {
|
const mount = useCallback(
|
||||||
|
(url: string, volume: number = 1, loop: boolean = false, autoplay: boolean = false) => {
|
||||||
return new Promise<IMountResponse>((res) => {
|
return new Promise<IMountResponse>((res) => {
|
||||||
if (!soundRefs.current) {
|
if (!soundRefs.current) {
|
||||||
soundRefs.current = new Map();
|
soundRefs.current = new Map();
|
||||||
@@ -66,7 +67,9 @@ export const SoundProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
|
|
||||||
instance.once('playerror', onError);
|
instance.once('playerror', onError);
|
||||||
});
|
});
|
||||||
}, []);
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
const play = useCallback(
|
const play = useCallback(
|
||||||
(url: string, volume: number, loop: boolean) => {
|
(url: string, volume: number, loop: boolean) => {
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ const getPath = {
|
|||||||
/**
|
/**
|
||||||
* Gets the configuration for SoundProvider based on settings and apps
|
* Gets the configuration for SoundProvider based on settings and apps
|
||||||
*/
|
*/
|
||||||
export const getSoundSettings = (type: 'ringtone' | 'notification', settings: IPhoneSettings, app?: string) => {
|
export const getSoundSettings = (
|
||||||
|
type: 'ringtone' | 'notification',
|
||||||
|
settings: IPhoneSettings,
|
||||||
|
app?: string,
|
||||||
|
) => {
|
||||||
try {
|
try {
|
||||||
return app
|
return app
|
||||||
? {
|
? {
|
||||||
|
|||||||
@@ -23,13 +23,23 @@ const useStyles = makeStyles(() => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const AppContent = ({ children, style, backdrop, onClickBackdrop, ...props }: AppContentTypes & BoxProps) => {
|
export const AppContent = ({
|
||||||
|
children,
|
||||||
|
style,
|
||||||
|
backdrop,
|
||||||
|
onClickBackdrop,
|
||||||
|
...props
|
||||||
|
}: AppContentTypes & BoxProps) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<Paper className={classes.wrapper} square>
|
<Paper className={classes.wrapper} square>
|
||||||
<Box flexGrow={1} className={classes.box} {...props}>
|
<Box flexGrow={1} className={classes.box} {...props}>
|
||||||
<Paper square elevation={0} className={classes.paper}>
|
<Paper square elevation={0} className={classes.paper}>
|
||||||
<Backdrop className={classes.backdrop} open={backdrop || false} onClick={onClickBackdrop} />
|
<Backdrop
|
||||||
|
className={classes.backdrop}
|
||||||
|
open={backdrop || false}
|
||||||
|
onClick={onClickBackdrop}
|
||||||
|
/>
|
||||||
{children}
|
{children}
|
||||||
</Paper>
|
</Paper>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ export const AppIcon = ({ id, nameLocale, name, icon, backgroundColor, color, no
|
|||||||
TransitionComponent={Zoom}
|
TransitionComponent={Zoom}
|
||||||
>
|
>
|
||||||
<Button className={classes.root}>
|
<Button className={classes.root}>
|
||||||
<Badge color="error" badgeContent={notification?.badge} invisible={!notification || notification.badge < 2}>
|
<Badge
|
||||||
|
color="error"
|
||||||
|
badgeContent={notification?.badge}
|
||||||
|
invisible={!notification || notification.badge < 2}
|
||||||
|
>
|
||||||
<Avatar className={classes.avatar}>{icon || name[0].toUpperCase()}</Avatar>
|
<Avatar className={classes.avatar}>{icon || name[0].toUpperCase()}</Avatar>
|
||||||
</Badge>
|
</Badge>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ const useStyle = makeStyles(
|
|||||||
);
|
);
|
||||||
// Taso: Maybe we should pass an icon (maybe fa?) as a prop as well at somepoint
|
// Taso: Maybe we should pass an icon (maybe fa?) as a prop as well at somepoint
|
||||||
// but need to think about the best way to do that for standardization sake.
|
// but need to think about the best way to do that for standardization sake.
|
||||||
export const AppTitle = ({ app: { backgroundColor, color, nameLocale }, variant = 'h5', ...props }: IProps) => {
|
export const AppTitle = ({
|
||||||
|
app: { backgroundColor, color, nameLocale },
|
||||||
|
variant = 'h5',
|
||||||
|
...props
|
||||||
|
}: IProps) => {
|
||||||
const classes = useStyle({ color, backgroundColor });
|
const classes = useStyle({ color, backgroundColor });
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ const useStyles = makeStyles(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
outlined: {
|
outlined: {
|
||||||
border: ({ color }: IStatusButtonStyleProps) => `1px solid ${fade(theme.palette[color].main, 0.5)}`,
|
border: ({ color }: IStatusButtonStyleProps) =>
|
||||||
|
`1px solid ${fade(theme.palette[color].main, 0.5)}`,
|
||||||
'&:hover': {
|
'&:hover': {
|
||||||
border: ({ color }: IStatusButtonStyleProps) => `1px solid ${theme.palette[color].main}`,
|
border: ({ color }: IStatusButtonStyleProps) => `1px solid ${theme.palette[color].main}`,
|
||||||
},
|
},
|
||||||
@@ -43,5 +44,11 @@ export const StatusButton = ({
|
|||||||
...props
|
...props
|
||||||
}: Omit<ButtonProps, 'color'> & { color: StatusButtonStyleColor }) => {
|
}: Omit<ButtonProps, 'color'> & { color: StatusButtonStyleColor }) => {
|
||||||
const classes = useStyles({ color });
|
const classes = useStyles({ color });
|
||||||
return <Button variant={variant} className={`${classes.root} ${classes[variant] || ''} ${className}`} {...props} />;
|
return (
|
||||||
|
<Button
|
||||||
|
variant={variant}
|
||||||
|
className={`${classes.root} ${classes[variant] || ''} ${className}`}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
@@ -17,7 +17,8 @@ const useStyles = makeStyles(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
outlined: {
|
outlined: {
|
||||||
border: ({ color }: IStatusButtonStyleProps) => `1px solid ${fade(theme.palette[color].main, 0.5)}`,
|
border: ({ color }: IStatusButtonStyleProps) =>
|
||||||
|
`1px solid ${fade(theme.palette[color].main, 0.5)}`,
|
||||||
'&:hover': {
|
'&:hover': {
|
||||||
border: ({ color }: IStatusButtonStyleProps) => `1px solid ${theme.palette[color].main}`,
|
border: ({ color }: IStatusButtonStyleProps) => `1px solid ${theme.palette[color].main}`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -23,5 +23,10 @@ export const useContextMenu = (_options?): UseContextMenu => {
|
|||||||
setOpen(true);
|
setOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
return [onOpen, onClose, () => <ContextMenu open={open} onClose={onClose} options={options} />, open];
|
return [
|
||||||
|
onOpen,
|
||||||
|
onClose,
|
||||||
|
() => <ContextMenu open={open} onClose={onClose} options={options} />,
|
||||||
|
open,
|
||||||
|
];
|
||||||
};
|
};
|
||||||
@@ -16,7 +16,11 @@ function SnackbarProvider({ children }) {
|
|||||||
return () => clearTimeout(timer.current);
|
return () => clearTimeout(timer.current);
|
||||||
}, [alert]);
|
}, [alert]);
|
||||||
|
|
||||||
return <SnackbarContext.Provider value={{ alert, addAlert: setAlert }}>{children}</SnackbarContext.Provider>;
|
return (
|
||||||
|
<SnackbarContext.Provider value={{ alert, addAlert: setAlert }}>
|
||||||
|
{children}
|
||||||
|
</SnackbarContext.Provider>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SnackbarProvider;
|
export default SnackbarProvider;
|
||||||
@@ -35,7 +35,9 @@ on(`__cfx_nui:${events.PHONE_ACCEPT_CALL}`, (data: any, cb: Function) => {
|
|||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
|
|
||||||
onNet(events.PHONE_CALL_WAS_ACCEPTED, (channelId: number, currentCall: ICall, isTransmitter: boolean) => {
|
onNet(
|
||||||
|
events.PHONE_CALL_WAS_ACCEPTED,
|
||||||
|
(channelId: number, currentCall: ICall, isTransmitter: boolean) => {
|
||||||
exp['mumble-voip'].SetCallChannel(channelId);
|
exp['mumble-voip'].SetCallChannel(channelId);
|
||||||
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
|
phoneCallStartAnim(); // Trigger call animation only if the call was accepted.
|
||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
@@ -51,7 +53,8 @@ onNet(events.PHONE_CALL_WAS_ACCEPTED, (channelId: number, currentCall: ICall, is
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
RegisterNuiCallbackType(events.PHONE_CALL_REJECTED); // Fires when cancelling and rejecting a call.
|
RegisterNuiCallbackType(events.PHONE_CALL_REJECTED); // Fires when cancelling and rejecting a call.
|
||||||
on(`__cfx_nui:${events.PHONE_CALL_REJECTED}`, (data: any, cb: Function) => {
|
on(`__cfx_nui:${events.PHONE_CALL_REJECTED}`, (data: any, cb: Function) => {
|
||||||
|
|||||||
@@ -23,10 +23,13 @@ onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS_FAILED, () => {
|
|||||||
* Messages create message group
|
* Messages create message group
|
||||||
*/
|
*/
|
||||||
RegisterNuiCallbackType(events.MESSAGES_CREATE_MESSAGE_GROUP);
|
RegisterNuiCallbackType(events.MESSAGES_CREATE_MESSAGE_GROUP);
|
||||||
on(`__cfx_nui:${events.MESSAGES_CREATE_MESSAGE_GROUP}`, ({ phoneNumbers, label }: any, cb: Function): void => {
|
on(
|
||||||
|
`__cfx_nui:${events.MESSAGES_CREATE_MESSAGE_GROUP}`,
|
||||||
|
({ phoneNumbers, label }: any, cb: Function): void => {
|
||||||
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP, phoneNumbers, label);
|
emitNet(events.MESSAGES_CREATE_MESSAGE_GROUP, phoneNumbers, label);
|
||||||
cb();
|
cb();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
onNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, (result: any): void => {
|
onNet(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, (result: any): void => {
|
||||||
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, result);
|
sendMessageEvent(events.MESSAGES_CREATE_MESSAGE_GROUP_SUCCESS, result);
|
||||||
|
|||||||
@@ -24,7 +24,23 @@ const newPhoneProp = async () => {
|
|||||||
prop = CreateObject(GetHashKey(phoneModel), x, y, z + 0.2, true, true, true);
|
prop = CreateObject(GetHashKey(phoneModel), x, y, z + 0.2, true, true, true);
|
||||||
//prop = CreateObject(GetHashKey(phoneModel), 1.0, 1.0, 1.0, 1, 1, 0)
|
//prop = CreateObject(GetHashKey(phoneModel), 1.0, 1.0, 1.0, 1, 1, 0)
|
||||||
const boneIndex = GetPedBoneIndex(playerPed, 28422);
|
const boneIndex = GetPedBoneIndex(playerPed, 28422);
|
||||||
AttachEntityToEntity(prop, playerPed, boneIndex, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0, true, true, false, true, 1.0, true); //-- Attaches the phone to the player.
|
AttachEntityToEntity(
|
||||||
|
prop,
|
||||||
|
playerPed,
|
||||||
|
boneIndex,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
-0.0,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
1.0,
|
||||||
|
true,
|
||||||
|
); //-- Attaches the phone to the player.
|
||||||
propCreated = true;
|
propCreated = true;
|
||||||
} else if (propCreated) {
|
} else if (propCreated) {
|
||||||
console.log('prop already created');
|
console.log('prop already created');
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import { mainLogger } from './sv_logger';
|
|||||||
// we require set mysql_connection_string to be set in the config
|
// we require set mysql_connection_string to be set in the config
|
||||||
const mysqlConnectionString = GetConvar(CONNECTION_STRING, 'none');
|
const mysqlConnectionString = GetConvar(CONNECTION_STRING, 'none');
|
||||||
if (mysqlConnectionString === 'none') {
|
if (mysqlConnectionString === 'none') {
|
||||||
const error = new Error(`No connection string provided. make sure "${CONNECTION_STRING}" is set in your config.`);
|
const error = new Error(
|
||||||
|
`No connection string provided. make sure "${CONNECTION_STRING}" is set in your config.`,
|
||||||
|
);
|
||||||
mainLogger.error(error.message);
|
mainLogger.error(error.message);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ interface Map {
|
|||||||
export function parseSemiColonFormat(connectionString: string): Map {
|
export function parseSemiColonFormat(connectionString: string): Map {
|
||||||
const parts = connectionString.split(';');
|
const parts = connectionString.split(';');
|
||||||
if (parts.length === 1) {
|
if (parts.length === 1) {
|
||||||
throw new Error(`Connection string ${connectionString} is in the incorrect format. Please follow the README.`);
|
throw new Error(
|
||||||
|
`Connection string ${connectionString} is in the incorrect format. Please follow the README.`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts.reduce((connectionInfo: Map, part) => {
|
return parts.reduce((connectionInfo: Map, part) => {
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ async function getPlayerFromIdentifier(identifier: string): Promise<XPlayer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function saveCall(call: ICall) {
|
async function saveCall(call: ICall) {
|
||||||
const query = 'INSERT INTO npwd_calls (identifier, transmitter, receiver, start) VALUES (?, ?, ?, ?)';
|
const query =
|
||||||
|
'INSERT INTO npwd_calls (identifier, transmitter, receiver, start) VALUES (?, ?, ?, ?)';
|
||||||
await pool.query(query, [call.identifier, call.transmitter, call.receiver, call.start]);
|
await pool.query(query, [call.identifier, call.transmitter, call.receiver, call.start]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +96,13 @@ onNet(events.PHONE_ACCEPT_CALL, async (transmitterNumber: string) => {
|
|||||||
emitNet(events.PHONE_CALL_WAS_ACCEPTED, pSource, channelId, currentCall, false);
|
emitNet(events.PHONE_CALL_WAS_ACCEPTED, pSource, channelId, currentCall, false);
|
||||||
|
|
||||||
// player who is calling
|
// player who is calling
|
||||||
emitNet(events.PHONE_CALL_WAS_ACCEPTED, currentCall.transmitterSource, channelId, currentCall, true);
|
emitNet(
|
||||||
|
events.PHONE_CALL_WAS_ACCEPTED,
|
||||||
|
currentCall.transmitterSource,
|
||||||
|
channelId,
|
||||||
|
currentCall,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
currentCall.accepted = true;
|
currentCall.accepted = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -24,15 +24,28 @@ async function fetchAllContacts(identifier: string): Promise<Contacts[]> {
|
|||||||
return contacts;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addContact(identifier: string, number: string, display: string, avatar: string): Promise<any> {
|
async function addContact(
|
||||||
const query = 'INSERT INTO npwd_phone_contacts (identifier, number, display, avatar) VALUES (?, ?, ?, ?)';
|
identifier: string,
|
||||||
|
number: string,
|
||||||
|
display: string,
|
||||||
|
avatar: string,
|
||||||
|
): Promise<any> {
|
||||||
|
const query =
|
||||||
|
'INSERT INTO npwd_phone_contacts (identifier, number, display, avatar) VALUES (?, ?, ?, ?)';
|
||||||
|
|
||||||
const [result] = await pool.query(query, [identifier, number, display, avatar]);
|
const [result] = await pool.query(query, [identifier, number, display, avatar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateContact(contact: Contacts, identifier: string): Promise<any> {
|
async function updateContact(contact: Contacts, identifier: string): Promise<any> {
|
||||||
const query = 'UPDATE npwd_phone_contacts SET number = ?, display = ?, avatar = ? WHERE id = ? AND identifier = ?';
|
const query =
|
||||||
await pool.query(query, [contact.number, contact.display, contact.avatar, contact.id, identifier]);
|
'UPDATE npwd_phone_contacts SET number = ?, display = ?, avatar = ? WHERE id = ? AND identifier = ?';
|
||||||
|
await pool.query(query, [
|
||||||
|
contact.number,
|
||||||
|
contact.display,
|
||||||
|
contact.avatar,
|
||||||
|
contact.id,
|
||||||
|
identifier,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteContact(contact: ContactId, identifier: string): Promise<any> {
|
async function deleteContact(contact: ContactId, identifier: string): Promise<any> {
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ const manualColorize = (strToColor: string): string => `[\x1b[35m${strToColor}\x
|
|||||||
|
|
||||||
// Format handler passed to winston
|
// Format handler passed to winston
|
||||||
const formatLogs = (log: winston.Logform.TransformableInfo): string => {
|
const formatLogs = (log: winston.Logform.TransformableInfo): string => {
|
||||||
if (log.module) return `${log.label} ${manualColorize(log.module)} [${log.level}]: ${log.message}`;
|
if (log.module)
|
||||||
|
return `${log.label} ${manualColorize(log.module)} [${log.level}]: ${log.message}`;
|
||||||
|
|
||||||
return `${log.label} [${log.level}]: ${log.message}`;
|
return `${log.label} [${log.level}]: ${log.message}`;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import md5 from 'md5';
|
import md5 from 'md5';
|
||||||
|
|
||||||
import events from '../utils/events';
|
import events from '../utils/events';
|
||||||
import { Message, MessageGroup, CreateMessageGroupResult } from '../../phone/src/common/typings/messages';
|
import {
|
||||||
|
Message,
|
||||||
|
MessageGroup,
|
||||||
|
CreateMessageGroupResult,
|
||||||
|
} from '../../phone/src/common/typings/messages';
|
||||||
import { pool, withTransaction } from './db';
|
import { pool, withTransaction } from './db';
|
||||||
import { getSource, getIdentifier } from './functions';
|
import { getSource, getIdentifier } from './functions';
|
||||||
import { mainLogger } from './sv_logger';
|
import { mainLogger } from './sv_logger';
|
||||||
@@ -42,7 +46,11 @@ interface MessageGroupMapping {
|
|||||||
* @param groupId - the message group ID to attach this message to
|
* @param groupId - the message group ID to attach this message to
|
||||||
* @param message - content of the message
|
* @param message - content of the message
|
||||||
*/
|
*/
|
||||||
async function createMessage(userIdentifier: string, groupId: string, message: string): Promise<any> {
|
async function createMessage(
|
||||||
|
userIdentifier: string,
|
||||||
|
groupId: string,
|
||||||
|
message: string,
|
||||||
|
): Promise<any> {
|
||||||
const query = `
|
const query = `
|
||||||
INSERT INTO npwd_messages
|
INSERT INTO npwd_messages
|
||||||
(user_identifier, message, group_id)
|
(user_identifier, message, group_id)
|
||||||
@@ -205,7 +213,8 @@ async function getMessageCountByGroup(groupId: string): Promise<number> {
|
|||||||
*/
|
*/
|
||||||
async function getConsolidatedMessageGroups(userIdentifier: string): Promise<MessageGroupMapping> {
|
async function getConsolidatedMessageGroups(userIdentifier: string): Promise<MessageGroupMapping> {
|
||||||
const messageGroups = await getMessageGroups(userIdentifier);
|
const messageGroups = await getMessageGroups(userIdentifier);
|
||||||
return messageGroups.reduce((mapping: MessageGroupMapping, messageGroup: UnformattedMessageGroup) => {
|
return messageGroups.reduce(
|
||||||
|
(mapping: MessageGroupMapping, messageGroup: UnformattedMessageGroup) => {
|
||||||
const groupId = messageGroup.group_id;
|
const groupId = messageGroup.group_id;
|
||||||
const displayTerm = messageGroup.display || messageGroup.phone_number || '???';
|
const displayTerm = messageGroup.display || messageGroup.phone_number || '???';
|
||||||
|
|
||||||
@@ -221,10 +230,15 @@ async function getConsolidatedMessageGroups(userIdentifier: string): Promise<Mes
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
return mapping;
|
return mapping;
|
||||||
}, {});
|
},
|
||||||
|
{},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getGroupIds(userIdentifier: string, groupMapping: MessageGroupMapping): Promise<string[]> {
|
async function getGroupIds(
|
||||||
|
userIdentifier: string,
|
||||||
|
groupMapping: MessageGroupMapping,
|
||||||
|
): Promise<string[]> {
|
||||||
const groupIds: string[] = [];
|
const groupIds: string[] = [];
|
||||||
for (const groupId of Object.keys(groupMapping)) {
|
for (const groupId of Object.keys(groupMapping)) {
|
||||||
const isMine = groupMapping[groupId].user_identifier === userIdentifier;
|
const isMine = groupMapping[groupId].user_identifier === userIdentifier;
|
||||||
@@ -352,7 +366,9 @@ onNet(events.MESSAGES_FETCH_MESSAGE_GROUPS, async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onNet(events.MESSAGES_CREATE_MESSAGE_GROUP, async (phoneNumbers: string[], label: string = null) => {
|
onNet(
|
||||||
|
events.MESSAGES_CREATE_MESSAGE_GROUP,
|
||||||
|
async (phoneNumbers: string[], label: string = null) => {
|
||||||
const _source = getSource();
|
const _source = getSource();
|
||||||
try {
|
try {
|
||||||
const _identifier = await getIdentifier(_source);
|
const _identifier = await getIdentifier(_source);
|
||||||
@@ -398,7 +414,8 @@ onNet(events.MESSAGES_CREATE_MESSAGE_GROUP, async (phoneNumbers: string[], label
|
|||||||
source: _source,
|
source: _source,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
onNet(events.MESSAGES_FETCH_MESSAGES, async (groupId: string) => {
|
onNet(events.MESSAGES_FETCH_MESSAGES, async (groupId: string) => {
|
||||||
const _source = getSource();
|
const _source = getSource();
|
||||||
|
|||||||
@@ -17,10 +17,22 @@ async function fetchAllListings(): Promise<MarketplaceListing[]> {
|
|||||||
return listings;
|
return listings;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addListing(identifier: string, name: string, number: any, listing: MarketplaceListing): Promise<void> {
|
async function addListing(
|
||||||
|
identifier: string,
|
||||||
|
name: string,
|
||||||
|
number: any,
|
||||||
|
listing: MarketplaceListing,
|
||||||
|
): Promise<void> {
|
||||||
const query =
|
const query =
|
||||||
'INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)';
|
'INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)';
|
||||||
await pool.query(query, [identifier, name, number, listing.title, listing.url, listing.description]);
|
await pool.query(query, [
|
||||||
|
identifier,
|
||||||
|
name,
|
||||||
|
number,
|
||||||
|
listing.title,
|
||||||
|
listing.url,
|
||||||
|
listing.description,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
||||||
|
|||||||
@@ -68,7 +68,12 @@ async function fetchTweetsFiltered(profileId: number, searchValue: string): Prom
|
|||||||
ORDER BY npwd_twitter_tweets.createdAt DESC
|
ORDER BY npwd_twitter_tweets.createdAt DESC
|
||||||
LIMIT 100
|
LIMIT 100
|
||||||
`;
|
`;
|
||||||
const [results] = await pool.query(query, [profileId, profileId, parameterizedSearchValue, parameterizedSearchValue]);
|
const [results] = await pool.query(query, [
|
||||||
|
profileId,
|
||||||
|
profileId,
|
||||||
|
parameterizedSearchValue,
|
||||||
|
parameterizedSearchValue,
|
||||||
|
]);
|
||||||
const tweets = <Tweet[]>results;
|
const tweets = <Tweet[]>results;
|
||||||
return tweets.map((tweet) => ({
|
return tweets.map((tweet) => ({
|
||||||
...tweet,
|
...tweet,
|
||||||
|
|||||||
Reference in new issue
Block a user