@tomerpacific I am getting imagePath from const saveFileToStorageOmOrder in "app.tsx" . I move temporary files to a permanent location then enter the await addTimestampWithLocation function.
const saveFileToStorageOmOrder = async (sTempFilePath, iP_ID, iOO_ID, columnName) => {
try {
const sFolderPath = `${RNFS.ExternalDirectoryPath}/OmOrder/${iP_ID}/${iOO_ID}`;
if (!await RNFS.exists(sFolderPath)) await RNFS.mkdir(sFolderPath);
const ext = sTempFilePath.split('.').pop() || 'jpg';
const now = new Date();
const fileName = `${now.getFullYear()}${(now.getMonth()+1).toString().padStart(2,'0')}${now.getDate().toString().padStart(2,'0')}_${
now.getHours().toString().padStart(2,'0')}${now.getMinutes().toString().padStart(2,'0')}${now.getSeconds().toString().padStart(2,'0')}.${ext}`;
const sPermanentPath = `${sFolderPath}/${fileName}`;
// 1. move temporary files to a permanent location
await RNFS.moveFile(sTempFilePath, sPermanentPath);
// 🟨 timestamp + location
await addTimestampWithLocation(sPermanentPath);
// 3. Save to JSON
insertUpdateFileJsonOmOrder(sPermanentPath, iP_ID, iOO_ID, columnName);
} catch (error) {
_WriteLog(`❌ Error in saveFileToStorageOmOrder: ${error.message}`);
}
};