aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-23 16:26:12 -0400
committerGitHub <noreply@github.com>2021-06-23 16:26:12 -0400
commit8c2b915678b852f597c38ab00d18c22bf62d2051 (patch)
tree7a268ef4d84b7870ded9020af637785c452a7923 /src/services
parentcd5863264d0fe954e63d8cc93fc4ee6ab509f49b (diff)
parent16f6341daff56f827fbb6c6ade9cf1238e8e5f3e (diff)
Merge pull request #473 from IvanIFChen/tma938-video-from-camera-video-streaming
[TMA-938] Video From Camera & Video Streaming
Diffstat (limited to 'src/services')
-rw-r--r--src/services/MomentService.ts16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/services/MomentService.ts b/src/services/MomentService.ts
index d0ed56ab..da1bfb97 100644
--- a/src/services/MomentService.ts
+++ b/src/services/MomentService.ts
@@ -1,5 +1,4 @@
import AsyncStorage from '@react-native-community/async-storage';
-import {Image, Video} from 'react-native-image-crop-picker';
import RNFetchBlob from 'rn-fetch-blob';
import {
MOMENTS_ENDPOINT,
@@ -262,20 +261,17 @@ export const handlePresignedURL = async (
/**
* This util function takes in the file object and the PresignedURLResponse object, creates form data from the latter,
* and makes a post request to the presigned URL, sending the file object inside of the form data.
- * @param file: Video, Image, Undefined
+ * @param filename: the filename
+ * @param filePath: the path to the file, including filename
* @param urlObj PresignedURLResponse | undefined
* @returns responseURL or boolean
*/
export const handleVideoUpload = async (
- file: Video | Image | undefined,
+ filename: string,
+ filePath: string,
urlObj: PresignedURLResponse | undefined,
) => {
try {
- let fileName = file?.filename;
- if (fileName === null || '') {
- console.log('Invalid filename');
- return false;
- }
if (urlObj === null || urlObj === undefined) {
console.log('Invalid urlObj');
return false;
@@ -299,10 +295,10 @@ export const handleVideoUpload = async (
urlObj.response_url.fields['x-amz-signature'],
);
form.append('file', {
- uri: file?.sourceURL,
+ uri: filePath,
// other types such as 'quicktime' 'image' etc exist, and we can programmatically type this, but for now sticking with simple 'video'
type: 'video',
- name: fileName,
+ name: filename,
});
const response = await fetch(urlObj.response_url.url, {
method: 'POST',