TP-51868 | Customer Photo Screenshot Allowed (#676)

This commit is contained in:
Mantri Ramkishor
2023-12-20 19:54:36 +05:30
committed by GitHub
parent 5a3d9231bb
commit 1a69df0ac8
3 changed files with 17 additions and 4 deletions

View File

@@ -172,7 +172,8 @@ const CustomerProfile: React.FC<ICustomerProfile> = (props) => {
};
const handleExpandImage = () => {
getCachedImageBase64(caseDetail.id);
// Passing false since this is not a customer doc
getCachedImageBase64(caseDetail.id, false);
};
return (

View File

@@ -1,14 +1,17 @@
import React from 'react';
import React, { useEffect } from 'react';
import { View } from 'react-native';
import { GenericStyles } from '../../../RN-UI-LIB/src/styles';
import { goBack } from '../../components/utlis/navigationUtlis';
import ExpandableImage from '../../components/expandableImage/ExpandableImage';
import ScreenshotBlocker from '@components/utlis/ScreenshotBlocker';
import { useIsFocused } from '@react-navigation/native';
interface ImageViewer {
route: {
params: {
imageUrl: string;
headerTitle: string;
isCustomerDoc: boolean;
};
};
}
@@ -16,10 +19,18 @@ interface ImageViewer {
const ImageViewer: React.FC<ImageViewer> = (props) => {
const {
route: {
params: { imageUrl, headerTitle },
params: { imageUrl, headerTitle, isCustomerDoc },
},
} = props;
const isFocused = useIsFocused();
useEffect(() => {
if (isFocused && !isCustomerDoc) {
ScreenshotBlocker.unblockScreenshots();
}
}, [isFocused]);
return (
<View style={GenericStyles.fill}>
<ExpandableImage

View File

@@ -91,7 +91,7 @@ export const getDocumentDetails = async (document: IDocument) => {
return null;
};
export const getCachedImageBase64 = (cacheKey: string) => {
export const getCachedImageBase64 = (cacheKey: string, isCustomerDoc = true) => {
const cacheDirectory = RNFS.CachesDirectoryPath;
const cacheFilePath = `${cacheDirectory}/${cacheKey}.jpg`;
@@ -99,6 +99,7 @@ export const getCachedImageBase64 = (cacheKey: string) => {
navigateToScreen('imageFull', {
imageUrl: `data:image/png;base64,${data}`,
headerTitle: 'Image Viewer',
isCustomerDoc,
});
});
};