Resolve video upload issues.
This commit is contained in:
BIN
build-1652399223268.aab
Normal file
BIN
build-1652399223268.aab
Normal file
Binary file not shown.
@@ -156,21 +156,17 @@ export function UploadProgress({
|
|||||||
|
|
||||||
if (deleteAfterUpload) {
|
if (deleteAfterUpload) {
|
||||||
try {
|
try {
|
||||||
|
const a = await MediaLibrary.getAssetsAsync();
|
||||||
|
console.log("assets", a);
|
||||||
|
console.log("filestodelete", filesToDelete);
|
||||||
const res = await Promise.all(
|
const res = await Promise.all(
|
||||||
filesToDelete.map(async (f) =>
|
filesToDelete.map((f) => {
|
||||||
MediaLibrary.removeAssetsFromAlbumAsync(f, f.albumId)
|
return MediaLibrary.removeAssetsFromAlbumAsync(f, f.albumId);
|
||||||
)
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const deleteResult = await MediaLibrary.deleteAssetsAsync(
|
const deleteResult = await MediaLibrary.deleteAssetsAsync(
|
||||||
filesToDelete
|
filesToDelete.map((f) => f.id)
|
||||||
);
|
|
||||||
|
|
||||||
console.log("res", res);
|
|
||||||
console.log(
|
|
||||||
"🚀 ~ file: upload-progress.component.jsx ~ line 177 ~ deleteResult",
|
|
||||||
filesToDelete,
|
|
||||||
deleteResult
|
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Unable to delete picture.", error);
|
console.log("Unable to delete picture.", error);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"@expo/vector-icons": "^13.0.0",
|
"@expo/vector-icons": "^13.0.0",
|
||||||
"@react-native-async-storage/async-storage": "~1.17.3",
|
"@react-native-async-storage/async-storage": "~1.17.3",
|
||||||
"@react-native-community/art": "^1.2.0",
|
"@react-native-community/art": "^1.2.0",
|
||||||
|
"@react-native-community/cli-debugger-ui": "^7.0.3",
|
||||||
"@react-native-community/masked-view": "^0.1.11",
|
"@react-native-community/masked-view": "^0.1.11",
|
||||||
"@react-navigation/bottom-tabs": "^6.2.0",
|
"@react-navigation/bottom-tabs": "^6.2.0",
|
||||||
"@react-navigation/drawer": "^6.3.1",
|
"@react-navigation/drawer": "^6.3.1",
|
||||||
|
|||||||
@@ -109,7 +109,12 @@ export function* signInSuccessSaga({ payload }) {
|
|||||||
|
|
||||||
const shop = yield client.query({ query: QUERY_BODYSHOP });
|
const shop = yield client.query({ query: QUERY_BODYSHOP });
|
||||||
logImEXEvent("imexmobile_sign_in_success", payload);
|
logImEXEvent("imexmobile_sign_in_success", payload);
|
||||||
yield put(setBodyshop(shop.data.bodyshops[0]));
|
yield put(
|
||||||
|
setBodyshop({
|
||||||
|
...shop.data.bodyshops[0],
|
||||||
|
localmediaserverhttp: `http://192.168.1.235:8000`,
|
||||||
|
})
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("UH-OH. Couldn't get shop details.", error);
|
console.log("UH-OH. Couldn't get shop details.", error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
|||||||
const { onError, onSuccess, onProgress, filename, mediaId } = ev;
|
const { onError, onSuccess, onProgress, filename, mediaId } = ev;
|
||||||
const { jobid, invoice_number, vendorid, callbackAfterUpload } = context;
|
const { jobid, invoice_number, vendorid, callbackAfterUpload } = context;
|
||||||
const bodyshop = store.getState().user.bodyshop;
|
const bodyshop = store.getState().user.bodyshop;
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
@@ -28,7 +27,13 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
|||||||
}
|
}
|
||||||
const imageData = await MediaLibrary.getAssetInfoAsync(mediaId);
|
const imageData = await MediaLibrary.getAssetInfoAsync(mediaId);
|
||||||
|
|
||||||
const newFile = await (await fetch(imageData.localUri)).blob();
|
let newFile;
|
||||||
|
try {
|
||||||
|
newFile = await (await fetch(imageData.localUri || imageData.uri)).blob();
|
||||||
|
} catch (error) {
|
||||||
|
console.log("blobbing error", error, imageData.localUri || imageData.uri);
|
||||||
|
}
|
||||||
|
|
||||||
let thumb;
|
let thumb;
|
||||||
let fileData = {
|
let fileData = {
|
||||||
uri: null,
|
uri: null,
|
||||||
@@ -51,10 +56,11 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
|||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
onError && onError(error.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileData = {
|
fileData = {
|
||||||
uri: imageData.localUri,
|
uri: imageData.localUri || imageData.uri,
|
||||||
type: newFile.type,
|
type: newFile.type,
|
||||||
name: filename,
|
name: filename,
|
||||||
};
|
};
|
||||||
@@ -76,7 +82,9 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
|||||||
if (imexMediaServerResponse.status !== 200) {
|
if (imexMediaServerResponse.status !== 200) {
|
||||||
if (onError) {
|
if (onError) {
|
||||||
console.log(imexMediaServerResponse);
|
console.log(imexMediaServerResponse);
|
||||||
onError(imexMediaServerResponse.statusText);
|
onError(
|
||||||
|
imexMediaServerResponse.data || imexMediaServerResponse.statusText
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
onSuccess && onSuccess();
|
onSuccess && onSuccess();
|
||||||
@@ -87,6 +95,6 @@ export const handleLocalUpload = async ({ ev, context }) => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error uploading documents:", onError, error);
|
console.log("Error uploading documents:", onError, error);
|
||||||
onError && onError(error);
|
onError && onError(error.message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user