Skip to content

Commit

Permalink
renaming tmp file for shared asset
Browse files Browse the repository at this point in the history
  • Loading branch information
balzack committed Jun 11, 2024
1 parent f9538c0 commit 141106f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -109,7 +110,6 @@ export function useImageAsset(asset) {
await RNFS.unlink(fullPath);
}
await RNFS.moveFile(path, fullPath)

Share.open({ url: fullPath });
},
download: async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 141106f

Please sign in to comment.