mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 22:16:54 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3076a45fb | ||
|
|
62aaaea368 |
No files matched your search
+44
-46
@@ -1,15 +1,13 @@
|
|||||||
# comment this out if your server has a different table/location for phone_number
|
# comment this out if your server has a different table/location for phone_number
|
||||||
# or if it already exists in the users table
|
# or if it already exists in the users table
|
||||||
ALTER TABLE `users` ADD COLUMN `phone_number` VARCHAR(20) DEFAULT NULL;
|
ALTER TABLE `users` ADD COLUMN `phone_number` VARCHAR(20) DEFAULT NULL;
|
||||||
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('phone', 'Phone', 1, 0, 1);
|
|
||||||
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('dphone', 'Destroyed Phone', 1, 0, 1);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS npwd_phone_contacts (
|
CREATE TABLE IF NOT EXISTS `npwd_phone_contacts` (
|
||||||
id int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
identifier varchar(60) DEFAULT NULL,
|
`identifier` varchar(48) DEFAULT NULL,
|
||||||
avatar varchar(512) DEFAULT NULL,
|
`avatar` varchar(512) DEFAULT NULL,
|
||||||
number varchar(10) DEFAULT NULL,
|
`number` varchar(10) DEFAULT NULL,
|
||||||
display varchar(60) NOT NULL DEFAULT '',
|
`display` varchar(60) NOT NULL DEFAULT '',
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -19,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
|
|||||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`likes` int NOT NULL DEFAULT '0',
|
`likes` int NOT NULL DEFAULT '0',
|
||||||
`identifier` varchar(40) NOT NULL,
|
`identifier` varchar(48) NOT NULL,
|
||||||
`visible` tinyint NOT NULL DEFAULT '1',
|
`visible` tinyint NOT NULL DEFAULT '1',
|
||||||
`images` varchar(1000) DEFAULT '',
|
`images` varchar(1000) DEFAULT '',
|
||||||
`retweet` int DEFAULT NULL,
|
`retweet` int DEFAULT NULL,
|
||||||
@@ -30,7 +28,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_tweets` (
|
|||||||
CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` (
|
CREATE TABLE IF NOT EXISTS `npwd_twitter_profiles` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`profile_name` varchar(90) NOT NULL,
|
`profile_name` varchar(90) NOT NULL,
|
||||||
`identifier` varchar(40) NOT NULL,
|
`identifier` varchar(48) NOT NULL,
|
||||||
# Default Profile avatar can be set here
|
# Default Profile avatar can be set here
|
||||||
`avatar_url` varchar(255) DEFAULT 'https://beta.iodine.gg/QrEvq.png',
|
`avatar_url` varchar(255) DEFAULT 'https://beta.iodine.gg/QrEvq.png',
|
||||||
`bio` varchar(512) DEFAULT NULL,
|
`bio` varchar(512) DEFAULT NULL,
|
||||||
@@ -56,7 +54,7 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_likes` (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
|
CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`identifier` varchar(255) NOT NULL,
|
`identifier` varchar(48) NOT NULL,
|
||||||
`name` varchar(90) NOT NULL,
|
`name` varchar(90) NOT NULL,
|
||||||
`image` varchar(255) NOT NULL,
|
`image` varchar(255) NOT NULL,
|
||||||
`bio` varchar(512) DEFAULT NULL,
|
`bio` varchar(512) DEFAULT NULL,
|
||||||
@@ -72,7 +70,7 @@ CREATE TABLE IF NOT EXISTS `npwd_match_profiles` (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `npwd_match_views` (
|
CREATE TABLE IF NOT EXISTS `npwd_match_views` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`identifier` varchar(40) NOT NULL,
|
`identifier` varchar(48) NOT NULL,
|
||||||
`profile` int NOT NULL,
|
`profile` int NOT NULL,
|
||||||
`liked` tinyint DEFAULT '0',
|
`liked` tinyint DEFAULT '0',
|
||||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
@@ -82,32 +80,32 @@ CREATE TABLE IF NOT EXISTS `npwd_match_views` (
|
|||||||
CONSTRAINT `match_profile` FOREIGN KEY (`profile`) REFERENCES `npwd_match_profiles` (`id`)
|
CONSTRAINT `match_profile` FOREIGN KEY (`profile`) REFERENCES `npwd_match_profiles` (`id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS npwd_notes (
|
CREATE TABLE IF NOT EXISTS `npwd_notes` (
|
||||||
id int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
identifier varchar(255) NOT NULL,
|
`identifier` varchar(48) NOT NULL,
|
||||||
title varchar(255) NOT NULL,
|
`title` varchar(255) NOT NULL,
|
||||||
content varchar(255) NOT NULL,
|
`content` varchar(255) NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS npwd_marketplace_listings (
|
CREATE TABLE IF NOT EXISTS `npwd_marketplace_listings` (
|
||||||
id int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
identifier varchar(255) DEFAULT NULL,
|
`identifier` varchar(48) DEFAULT NULL,
|
||||||
username varchar(255) DEFAULT NULL,
|
`username` varchar(255) DEFAULT NULL,
|
||||||
name varchar(50) DEFAULT NULL,
|
`name` varchar(50) DEFAULT NULL,
|
||||||
number varchar(255) NOT NULL,
|
`number` varchar(255) NOT NULL,
|
||||||
title varchar(255) DEFAULT NULL,
|
`title` varchar(255) DEFAULT NULL,
|
||||||
url varchar(255) DEFAULT NULL,
|
`url` varchar(255) DEFAULT NULL,
|
||||||
description varchar(255) NOT NULL,
|
`description` varchar(255) NOT NULL,
|
||||||
createdAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
updatedAt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS npwd_marketplace_reports (
|
CREATE TABLE IF NOT EXISTS `npwd_marketplace_reports` (
|
||||||
id int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
listing_id int(11) DEFAULT NULL,
|
`listing_id` int(11) DEFAULT NULL,
|
||||||
profile varchar(255) DEFAULT NULL,
|
`profile` varchar(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -125,11 +123,11 @@ CREATE TABLE IF NOT EXISTS `npwd_twitter_reports` (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
|
CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`user_identifier` varchar(40) NOT NULL,
|
`user_identifier` varchar(48) NOT NULL,
|
||||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`group_id` varchar(512) NOT NULL,
|
`group_id` varchar(512) NOT NULL,
|
||||||
`participant_identifier` varchar(40) NOT NULL,
|
`participant_identifier` varchar(48) NOT NULL,
|
||||||
`label` varchar(60) DEFAULT '',
|
`label` varchar(60) DEFAULT '',
|
||||||
`unreadCount` int(11) NOT NULL DEFAULT 0,
|
`unreadCount` int(11) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
@@ -137,7 +135,7 @@ CREATE TABLE IF NOT EXISTS `npwd_messages_groups` (
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
|
CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`user_identifier` varchar(40) NOT NULL,
|
`user_identifier` varchar(48) NOT NULL,
|
||||||
`label` varchar(60) NOT NULL,
|
`label` varchar(60) NOT NULL,
|
||||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
@@ -148,7 +146,7 @@ CREATE TABLE IF NOT EXISTS `npwd_messages_labels` (
|
|||||||
CREATE TABLE IF NOT EXISTS `npwd_messages` (
|
CREATE TABLE IF NOT EXISTS `npwd_messages` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT,
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
`message` varchar(512) NOT NULL,
|
`message` varchar(512) NOT NULL,
|
||||||
`user_identifier` varchar(40) NOT NULL,
|
`user_identifier` varchar(48) NOT NULL,
|
||||||
`group_id` varchar(512) NOT NULL,
|
`group_id` varchar(512) NOT NULL,
|
||||||
`isRead` tinyint NOT NULL DEFAULT '0',
|
`isRead` tinyint NOT NULL DEFAULT '0',
|
||||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
@@ -157,20 +155,20 @@ CREATE TABLE IF NOT EXISTS `npwd_messages` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS npwd_calls (
|
CREATE TABLE IF NOT EXISTS `npwd_calls` (
|
||||||
id int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
identifier varchar(255) DEFAULT NULL,
|
`identifier` varchar(48) DEFAULT NULL,
|
||||||
transmitter varchar(255) NOT NULL,
|
`transmitter` varchar(255) NOT NULL,
|
||||||
receiver varchar(255) NOT NULL,
|
`receiver` varchar(255) NOT NULL,
|
||||||
is_accepted tinyint(4) DEFAULT 0,
|
`is_accepted` tinyint(4) DEFAULT 0,
|
||||||
start varchar(255) DEFAULT NULL,
|
`start` varchar(255) DEFAULT NULL,
|
||||||
end varchar(255) DEFAULT NULL,
|
end varchar(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS npwd_phone_gallery (
|
CREATE TABLE IF NOT EXISTS npwd_phone_gallery (
|
||||||
id int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
identifier varchar(255) DEFAULT NULL,
|
`identifier` varchar(48) DEFAULT NULL,
|
||||||
image varchar(255) DEFAULT NULL,
|
`image` varchar(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
+2
-3
@@ -33,7 +33,6 @@ import WindowSnackbar from './ui/components/WindowSnackbar';
|
|||||||
import { usePhone } from './os/phone/hooks/usePhone';
|
import { usePhone } from './os/phone/hooks/usePhone';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useSnackbar } from './ui/hooks/useSnackbar';
|
import { useSnackbar } from './ui/hooks/useSnackbar';
|
||||||
import { isDefaultWallpaper } from './apps/settings/utils/isDefaultWallpaper';
|
|
||||||
|
|
||||||
function Phone() {
|
function Phone() {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
@@ -105,8 +104,8 @@ function Phone() {
|
|||||||
id="phone"
|
id="phone"
|
||||||
className="PhoneScreen"
|
className="PhoneScreen"
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: !isDefaultWallpaper(settings.wallpaper.value)
|
backgroundImage: settings.customWallpaper
|
||||||
? `url(${settings.wallpaper.value})`
|
? `url(${settings.customWallpaper})`
|
||||||
: `url(media/backgrounds/${settings.wallpaper.value})`,
|
: `url(media/backgrounds/${settings.wallpaper.value})`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Typography,
|
Typography,
|
||||||
Switch,
|
Switch,
|
||||||
|
TextField,
|
||||||
} from '@material-ui/core';
|
} from '@material-ui/core';
|
||||||
|
import CreateIcon from '@material-ui/icons/Create';
|
||||||
|
import { PictureThumbnail } from '../../../ui/components/PictureThumbnail';
|
||||||
|
|
||||||
interface ISettingItem {
|
interface ISettingItem {
|
||||||
options?: any;
|
options?: any;
|
||||||
@@ -106,3 +109,15 @@ export const SettingItemIconAction = ({
|
|||||||
</ListItem>
|
</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 { AppWrapper } from '../../../ui/components';
|
||||||
import { AppTitle } from '../../../ui/components/AppTitle';
|
import { AppTitle } from '../../../ui/components/AppTitle';
|
||||||
import { AppContent } from '../../../ui/components/AppContent';
|
import { AppContent } from '../../../ui/components/AppContent';
|
||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
SettingItemIconAction,
|
SettingItemIconAction,
|
||||||
SettingItemSlider,
|
SettingItemSlider,
|
||||||
SettingSwitch,
|
SettingSwitch,
|
||||||
|
SettingItemModal,
|
||||||
} from './SettingItem';
|
} from './SettingItem';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import VisibilityOffIcon from '@material-ui/icons/VisibilityOff';
|
import VisibilityOffIcon from '@material-ui/icons/VisibilityOff';
|
||||||
@@ -72,9 +73,9 @@ export const SettingsApp = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const wallpapers = config.wallpapers.map(
|
const wallpapers = config.wallpapers.map(
|
||||||
MapSettingItem(settings.wallpaper, (val: SettingOption) => {
|
MapSettingItem(settings.wallpaper, (val: SettingOption) =>
|
||||||
handleSettingChange('wallpaper', val);
|
handleSettingChange('wallpaper', val),
|
||||||
}),
|
),
|
||||||
);
|
);
|
||||||
const frames = config.frames.map(
|
const frames = config.frames.map(
|
||||||
MapSettingItem(settings.frame, (val: SettingOption) => handleSettingChange('frame', val)),
|
MapSettingItem(settings.frame, (val: SettingOption) => handleSettingChange('frame', val)),
|
||||||
@@ -127,13 +128,6 @@ export const SettingsApp = () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const customWallpaper: IContextMenuOption = {
|
|
||||||
selected: false,
|
|
||||||
onClick: () => setCustomWallpaperModal(true),
|
|
||||||
key: 'CUSTOM_WALLPAPER',
|
|
||||||
label: t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER'),
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCopyPhoneNumber = () => {
|
const handleCopyPhoneNumber = () => {
|
||||||
setClipboard(simcard.number);
|
setClipboard(simcard.number);
|
||||||
addAlert({
|
addAlert({
|
||||||
@@ -215,10 +209,17 @@ export const SettingsApp = () => {
|
|||||||
<SettingItem
|
<SettingItem
|
||||||
label={t('APPS_SETTINGS_OPTION_WALLPAPER')}
|
label={t('APPS_SETTINGS_OPTION_WALLPAPER')}
|
||||||
value={settings.wallpaper.label}
|
value={settings.wallpaper.label}
|
||||||
options={[...wallpapers, customWallpaper]}
|
options={wallpapers}
|
||||||
onClick={openMenu}
|
onClick={openMenu}
|
||||||
icon={<Wallpaper />}
|
icon={<Wallpaper />}
|
||||||
/>
|
/>
|
||||||
|
{/* CUSTOM BACKGROUND */}
|
||||||
|
<SettingItemModal
|
||||||
|
icon={<Wallpaper />}
|
||||||
|
label={t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER')}
|
||||||
|
secondary={settings.customWallpaper}
|
||||||
|
onClick={() => setCustomWallpaperModal(true)}
|
||||||
|
/>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
label={t('APPS_SETTINGS_OPTION_FRAME')}
|
label={t('APPS_SETTINGS_OPTION_FRAME')}
|
||||||
value={settings.frame.label}
|
value={settings.frame.label}
|
||||||
|
|||||||
@@ -1,52 +1,86 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import Modal from '../../../ui/components/Modal';
|
||||||
import { useCustomWallpaperModal, useSettings } from '../hooks/useSettings';
|
import { useCustomWallpaperModal, useSettings } from '../hooks/useSettings';
|
||||||
import { TextField } from '@material-ui/core';
|
import { Box, Button, TextField } from '@material-ui/core';
|
||||||
|
import { PictureThumbnail } from '../../../ui/components/PictureThumbnail';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import DialogForm from '../../../ui/components/DialogForm';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
import { StatusButton } from '../../../ui/components/StatusButton';
|
||||||
|
|
||||||
|
const useStyles = makeStyles({
|
||||||
|
input: {
|
||||||
|
marginTop: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
inputProps: {
|
||||||
|
fontSize: 18,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export default function WallpaperModal() {
|
export default function WallpaperModal() {
|
||||||
const { customWallpaperModal, setCustomWallpaperModal } = useCustomWallpaperModal();
|
const { customWallpaperModal, setCustomWallpaperModal } = useCustomWallpaperModal();
|
||||||
const [settings, setSettings] = useSettings();
|
const [settings, setSettings] = useSettings();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState(settings.customWallpaper ? settings.customWallpaper : '');
|
||||||
const { addAlert } = useSnackbar();
|
const classes = useStyles();
|
||||||
|
|
||||||
const isImageAndUrl = (url) => {
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCloseModal = () => {
|
||||||
|
setCustomWallpaperModal(false);
|
||||||
|
};
|
||||||
|
|
||||||
const handleSettingChange = (key: string | number, value: unknown) => {
|
const handleSettingChange = (key: string | number, value: unknown) => {
|
||||||
setSettings({ ...settings, [key]: value });
|
setSettings({ ...settings, [key]: value });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleNewWallpaper = () => {
|
const handleNewWallpaper = () => {
|
||||||
if (isImageAndUrl(value)) {
|
handleSettingChange('customWallpaper', value);
|
||||||
handleSettingChange('wallpaper', {
|
};
|
||||||
label: t('APPS_SETTINGS_OPTIONS_CUSTOM_WALLPAPER'),
|
|
||||||
value,
|
const handleRemoveWallpaper = () => {
|
||||||
});
|
handleSettingChange('customWallpaper', '');
|
||||||
setCustomWallpaperModal(false);
|
|
||||||
} else {
|
|
||||||
addAlert({ message: t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_ERROR'), type: 'error' });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogForm
|
<Modal visible={customWallpaperModal} handleClose={handleCloseModal}>
|
||||||
open={customWallpaperModal}
|
<Box
|
||||||
handleClose={() => setCustomWallpaperModal(false)}
|
display="flex"
|
||||||
onSubmit={handleNewWallpaper}
|
justifyContent="center"
|
||||||
title={t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_TITLE')}
|
alignItems="center"
|
||||||
content={t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_CONTENT')}
|
textAlign="center"
|
||||||
|
flexDirection="column"
|
||||||
>
|
>
|
||||||
|
{settings.customWallpaper && (
|
||||||
|
<PictureThumbnail src={settings.customWallpaper} alt="chipisbest" />
|
||||||
|
)}
|
||||||
<TextField
|
<TextField
|
||||||
value={value}
|
value={value}
|
||||||
error={!isImageAndUrl(value) && true}
|
variant="outlined"
|
||||||
|
className={classes.input}
|
||||||
onChange={(e) => setValue(e.currentTarget.value)}
|
onChange={(e) => setValue(e.currentTarget.value)}
|
||||||
placeholder={t('SETTINGS.OPTIONS.CUSTOM_WALLPAPER.DIALOG_PLACEHOLDER')}
|
inputProps={{
|
||||||
fullWidth
|
className: classes.inputProps,
|
||||||
|
}}
|
||||||
|
placeholder="Image URL"
|
||||||
/>
|
/>
|
||||||
</DialogForm>
|
<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: {
|
properties: {
|
||||||
language: { $ref: '/SettingOption' },
|
language: { $ref: '/SettingOption' },
|
||||||
wallpaper: { $ref: '/SettingOption' },
|
wallpaper: { $ref: '/SettingOption' },
|
||||||
|
customWallpaper: { type: 'string' },
|
||||||
frame: { $ref: '/SettingOption' },
|
frame: { $ref: '/SettingOption' },
|
||||||
theme: { $ref: '/SettingOption' },
|
theme: { $ref: '/SettingOption' },
|
||||||
zoom: { $ref: '/SettingOption' },
|
zoom: { $ref: '/SettingOption' },
|
||||||
@@ -63,6 +64,7 @@ export function isSettingsSchemaValid(): boolean {
|
|||||||
export interface IPhoneSettings {
|
export interface IPhoneSettings {
|
||||||
language: SettingOption;
|
language: SettingOption;
|
||||||
wallpaper: SettingOption;
|
wallpaper: SettingOption;
|
||||||
|
customWallpaper: string;
|
||||||
frame: SettingOption;
|
frame: SettingOption;
|
||||||
theme: SettingOption;
|
theme: SettingOption;
|
||||||
zoom: SettingOption;
|
zoom: SettingOption;
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import config from '../../../config/default.json';
|
|
||||||
|
|
||||||
export const isDefaultWallpaper = (value: string) => {
|
|
||||||
const wallpapers = config.wallpapers;
|
|
||||||
for (const wallpaper of wallpapers) {
|
|
||||||
if (wallpaper.value === value) return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -11,13 +11,7 @@
|
|||||||
"OPTIONS": {
|
"OPTIONS": {
|
||||||
"LANGUAGE": "Language",
|
"LANGUAGE": "Language",
|
||||||
"RESET_SETTINGS": "Reset Settings",
|
"RESET_SETTINGS": "Reset Settings",
|
||||||
"RESET_SETTINGS_DESC": "This will clear your locally stored data",
|
"RESET_SETTINGS_DESC": "This will clear your locally stored data"
|
||||||
"CUSTOM_WALLPAPER": {
|
|
||||||
"DIALOG_TITLE": "Custom Wallpaper",
|
|
||||||
"DIALOG_CONTENT": "Set a custom wallpaper by entering the URL of the image below!",
|
|
||||||
"DIALOG_PLACEHOLDER": "Image URL",
|
|
||||||
"DIALOG_ERROR": "Invalid image or link"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"MESSAGES": {
|
"MESSAGES": {
|
||||||
"INVALID_SETTINGS": "Invalid stored settings! Please reset in the Settings App.",
|
"INVALID_SETTINGS": "Invalid stored settings! Please reset in the Settings App.",
|
||||||
@@ -201,6 +195,7 @@
|
|||||||
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
|
"APPS_SETTINGS_OPTION_NOTIFICATION": "Notification",
|
||||||
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
|
"APPS_SETTINGS_OPTION_NOTIFICATIONVOL": "Notification Volume",
|
||||||
"APPS_SETTING_STREAMER_MODE_DESC": "Hide images before they are shown",
|
"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_SUCCESS": "Successfully created a new listing",
|
||||||
"APPS_MARKETPLACE_CREATE_LISTING_FAILED": "Failed to create a new listing",
|
"APPS_MARKETPLACE_CREATE_LISTING_FAILED": "Failed to create a new listing",
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
|
||||||
import { Button, DialogContent, DialogContentText, DialogTitle, Paper } from '@material-ui/core';
|
|
||||||
import DialogActions from '@material-ui/core/DialogActions';
|
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
|
||||||
root: {
|
|
||||||
paddingLeft: '10px',
|
|
||||||
zIndex: 10,
|
|
||||||
width: '90%',
|
|
||||||
display: 'flex',
|
|
||||||
flexFlow: 'column nowrap',
|
|
||||||
position: 'absolute',
|
|
||||||
top: '80px',
|
|
||||||
},
|
|
||||||
displayBlock: {
|
|
||||||
/*Sets modal to center*/
|
|
||||||
display: 'flex',
|
|
||||||
flexFlow: 'column nowrap',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
position: 'relative',
|
|
||||||
},
|
|
||||||
displayNone: {
|
|
||||||
display: 'none',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
interface DialogFormProps {
|
|
||||||
children: React.ReactNode;
|
|
||||||
open: boolean;
|
|
||||||
handleClose: any; // No idea what those types are
|
|
||||||
onSubmit: any;
|
|
||||||
title: string;
|
|
||||||
content: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function DialogForm({
|
|
||||||
children,
|
|
||||||
open,
|
|
||||||
handleClose,
|
|
||||||
onSubmit,
|
|
||||||
title,
|
|
||||||
content,
|
|
||||||
}: DialogFormProps) {
|
|
||||||
const classes = useStyles();
|
|
||||||
|
|
||||||
const showHideClassName = open ? classes.displayBlock : classes.displayNone;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={showHideClassName}>
|
|
||||||
<Paper className={classes.root}>
|
|
||||||
<DialogTitle id="form-dialog-title">{title}</DialogTitle>
|
|
||||||
<DialogContent>
|
|
||||||
<DialogContentText>{content}</DialogContentText>
|
|
||||||
{children}
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions>
|
|
||||||
<Button color="primary" onClick={handleClose}>
|
|
||||||
Cancel
|
|
||||||
</Button>
|
|
||||||
<Button color="primary" onClick={onSubmit}>
|
|
||||||
Confirm
|
|
||||||
</Button>
|
|
||||||
</DialogActions>
|
|
||||||
</Paper>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user