mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
cleanup(photos): A general cleanup of photos
Removes legacy code no longer in use or cleans up code to use new type safe native wrappers
This commit is contained in:
1 parent
83ec915926
commit
16626db5bd
9 files changed
+34
-141
No files matched your search
@@ -15,7 +15,6 @@ import { useMatchService } from './apps/match/hooks/useMatchService';
|
||||
import { useMarketplaceService } from './apps/marketplace/hooks/useMarketplaceService';
|
||||
import { useBankService } from './apps/bank/hooks/useBankService';
|
||||
import { useMessagesService } from './apps/messages/hooks/useMessageService';
|
||||
import { usePhotoService } from './apps/camera/hooks/usePhotoService';
|
||||
import { isSettingsSchemaValid, useSettings } from './apps/settings/hooks/useSettings';
|
||||
import { useCallService } from './os/call/hooks/useCallService';
|
||||
import { useDialService } from './apps/dialer/hooks/useDialService';
|
||||
|
||||
@@ -3,41 +3,20 @@ import { AppWrapper } from '../../../ui/components';
|
||||
import { AppContent } from '../../../ui/components/AppContent';
|
||||
import { GalleryGrid } from './grid/GalleryGrid';
|
||||
import { GalleryModal } from './modal/GalleryModal';
|
||||
import InjectDebugData from '../../../os/debug/InjectDebugData';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
import { PhotoEvents } from '../../../../../typings/photo';
|
||||
import { LoadingSpinner } from '../../../ui/components/LoadingSpinner';
|
||||
|
||||
InjectDebugData([
|
||||
{
|
||||
app: 'CAMERA',
|
||||
method: PhotoEvents.SEND_PHOTOS,
|
||||
data: [
|
||||
{
|
||||
id: 1,
|
||||
image: 'https://i.file.glass/noDcb.jpeg',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
image: 'https://i.file.glass/teUcY.jpeg',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const CameraApp = () => {
|
||||
return (
|
||||
<AppWrapper id="camera-app">
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<React.Suspense fallback={<LoadingSpinner />}>
|
||||
<Route path="/camera" exact component={GalleryGrid} />
|
||||
<Route path="/camera/image" exact component={GalleryModal} />
|
||||
</React.Suspense>
|
||||
</Switch>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
const CameraApp: React.FC = () => (
|
||||
<AppWrapper id="camera-app">
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<React.Suspense fallback={<LoadingSpinner />}>
|
||||
<Route path="/camera" exact component={GalleryGrid} />
|
||||
<Route path="/camera/image" exact component={GalleryModal} />
|
||||
</React.Suspense>
|
||||
</Switch>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
);
|
||||
|
||||
export default CameraApp;
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { Box, Button, CircularProgress } from '@material-ui/core';
|
||||
import { Box, Button } from '@material-ui/core';
|
||||
import useStyles from './grid.styles';
|
||||
import { useCamera } from '../../hooks/useCamera';
|
||||
import AddIcon from '@material-ui/icons/Add';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { useQueryParams } from '../../../../common/hooks/useQueryParams';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { usePhotos } from './state';
|
||||
import { useSetPhotos } from './state';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export const usePhotoActions = () => {
|
||||
const [photos, setPhotos] = usePhotos();
|
||||
const setPhotos = useSetPhotos();
|
||||
|
||||
const takePhoto = useCallback(
|
||||
(photo) => {
|
||||
@@ -18,49 +18,5 @@ export const usePhotoActions = () => {
|
||||
[setPhotos],
|
||||
);
|
||||
|
||||
return {
|
||||
takePhoto,
|
||||
deletePhoto,
|
||||
};
|
||||
|
||||
/*const { t } = useTranslation();
|
||||
const { addAlert } = useSnackbar();
|
||||
|
||||
const [photos, setPhotos] = usePhotoService();
|
||||
const [isUploading, setUploading] = useState(false);*/
|
||||
/*
|
||||
const onPhotoSuccess = useCallback(
|
||||
(photo) => {
|
||||
setUploading(false);
|
||||
if (!photo?.image) return;
|
||||
setPhotos((curr) => [photo, ...curr]);
|
||||
},
|
||||
[setPhotos],
|
||||
);
|
||||
|
||||
const onPhotoError = useCallback(
|
||||
(i18nKey) => {
|
||||
setUploading(false);
|
||||
addAlert({ type: 'error', message: t(i18nKey) });
|
||||
},
|
||||
[addAlert, t],
|
||||
);
|
||||
|
||||
const [_takePhoto] = useNuiCallback<void, GalleryPhoto>(
|
||||
'CAMERA',
|
||||
PhotoEvents.TAKE_PHOTO,
|
||||
onPhotoSuccess,
|
||||
onPhotoError,
|
||||
);
|
||||
|
||||
const takePhoto = () => {
|
||||
_takePhoto(undefined, { timeout: 60000 });
|
||||
};
|
||||
|
||||
return {
|
||||
photos,
|
||||
setPhotos,
|
||||
takePhoto,
|
||||
isLoading: isUploading,
|
||||
};*/
|
||||
return { takePhoto, deletePhoto };
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from 'fivem-nui-react-lib';
|
||||
import { photoState } from './state';
|
||||
import { PhotoEvents } from '../../../../../typings/photo';
|
||||
|
||||
export const usePhotoService = () => {
|
||||
const setPhotos = useSetRecoilState(photoState.photos);
|
||||
useNuiEvent('CAMERA', PhotoEvents.SEND_PHOTOS, setPhotos);
|
||||
};
|
||||
Reference in new issue
Block a user