dont check for exif in non image files

This commit is contained in:
Abhinav 2022-12-16 16:57:02 +05:30
parent e491234f48
commit 5cbba12850
2 changed files with 14 additions and 1 deletions

View file

@ -88,6 +88,9 @@ export function FileInfo({
const closeExif = () => setShowExif(false); const closeExif = () => setShowExif(false);
useEffect(() => { useEffect(() => {
console.log('file.metadata', file?.metadata);
console.log('location', location);
if (!location && file && file.metadata) { if (!location && file && file.metadata) {
if (file.metadata.longitude || file.metadata.longitude === 0) { if (file.metadata.longitude || file.metadata.longitude === 0) {
setLocation({ setLocation({
@ -99,6 +102,8 @@ export function FileInfo({
}, [file]); }, [file]);
useEffect(() => { useEffect(() => {
console.log('exif', exif);
console.log('location', location);
if (!location && exif) { if (!location && exif) {
const exifLocation = getEXIFLocation(exif); const exifLocation = getEXIFLocation(exif);
if (exifLocation.latitude || exifLocation.latitude === 0) { if (exifLocation.latitude || exifLocation.latitude === 0) {

View file

@ -307,6 +307,11 @@ function PhotoViewer(props: Iprops) {
}); });
photoSwipe.listen('beforeChange', () => { photoSwipe.listen('beforeChange', () => {
const currItem = photoSwipe?.currItem as EnteFile; const currItem = photoSwipe?.currItem as EnteFile;
updateFavButton(currItem);
if (currItem.metadata.fileType !== FILE_TYPE.IMAGE) {
setExif({ key: currItem.src, value: null });
return;
}
if ( if (
!currItem || !currItem ||
!exifCopy?.current?.value === null || !exifCopy?.current?.value === null ||
@ -316,10 +321,13 @@ function PhotoViewer(props: Iprops) {
} }
setExif({ key: currItem.src, value: undefined }); setExif({ key: currItem.src, value: undefined });
checkExifAvailable(currItem); checkExifAvailable(currItem);
updateFavButton(currItem);
}); });
photoSwipe.listen('resize', () => { photoSwipe.listen('resize', () => {
const currItem = photoSwipe?.currItem as EnteFile; const currItem = photoSwipe?.currItem as EnteFile;
if (currItem.metadata.fileType !== FILE_TYPE.IMAGE) {
setExif({ key: currItem.src, value: null });
return;
}
if ( if (
!currItem || !currItem ||
!exifCopy?.current?.value === null || !exifCopy?.current?.value === null ||