mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +00:00
renaming tmp file for shared asset
This commit is contained in:
parent
f9538c0927
commit
141106f844
@ -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);
|
||||
}
|
||||
|
@ -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 () => {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user