renaming tmp file for shared asset

This commit is contained in:
Roland Osborne 2024-06-11 12:48:50 -07:00
parent f9538c0927
commit 141106f844
3 changed files with 6 additions and 4 deletions

View File

@ -52,7 +52,8 @@ export function useAudioAsset(asset) {
const actions = {
share: async () => {
const path = RNFS.TemporaryDirectoryPath + "/databag.mp3";
const epoch = Math.ceil(Date.now() / 1000);
const path = RNFS.TemporaryDirectoryPath + epoch + '.mp3';
if (await RNFS.exists(path)) {
await RNFS.unlink(path);
}

View File

@ -93,7 +93,8 @@ export function useImageAsset(asset) {
updateState({ imageRatio: width / height });
},
share: async () => {
const path = RNFS.TemporaryDirectoryPath + "/databag";
const epoch = Math.ceil(Date.now() / 1000);
const path = RNFS.TemporaryDirectoryPath + epoch;
if (await RNFS.exists(path)) {
await RNFS.unlink(path);
}
@ -109,7 +110,6 @@ export function useImageAsset(asset) {
await RNFS.unlink(fullPath);
}
await RNFS.moveFile(path, fullPath)
Share.open({ url: fullPath });
},
download: async () => {

View File

@ -75,7 +75,8 @@ export function useVideoAsset(asset) {
const actions = {
share: async () => {
const path = RNFS.TemporaryDirectoryPath + "/databag.mp4";
const epoch = Math.ceil(Date.now() / 1000);
const path = RNFS.TemporaryDirectoryPath + epoch + '.mp4';
if (await RNFS.exists(path)) {
await RNFS.unlink(path);
}