aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-23 17:08:20 -0400
committerIvan Chen <ivan@tagg.id>2021-06-23 17:08:20 -0400
commit345a20590da5fd1cabc85c4e7b0b72c05e1f0665 (patch)
treefec050399a051c3d3cc5b3bed44d450ea20f258f /src/services
parent66dcf88ab09fbd73e234e209e270e2b31c867247 (diff)
Squashed commit of the following:
commit 8c2b915678b852f597c38ab00d18c22bf62d2051 Merge: cd586326 16f6341d Author: Ivan Chen <ivan@tagg.id> Date: Wed Jun 23 16:26:12 2021 -0400 Merge pull request #473 from IvanIFChen/tma938-video-from-camera-video-streaming [TMA-938] Video From Camera & Video Streaming commit 16f6341daff56f827fbb6c6ade9cf1238e8e5f3e Author: Ivan Chen <ivan@tagg.id> Date: Wed Jun 23 14:22:29 2021 -0400 Lint commit 7e7a3ea6b6462d295717db052c37d87e1f58a091 Author: Ivan Chen <ivan@tagg.id> Date: Wed Jun 23 14:20:00 2021 -0400 Change to use image crop pickers instead commit 25d1a6514c9df784df27d22da648340ae018c1f8 Author: Ivan Chen <ivan@tagg.id> Date: Wed Jun 23 13:37:39 2021 -0400 Minor logic cleanup commit 4ecc4525738dc8a56c9f37a05d0870e54cfa5be9 Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 19:21:26 2021 -0400 Lint commit c3066187b9d253767e32880cc35ddd1abc6db6b3 Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 19:16:04 2021 -0400 Remove test code commit ab13c937f1de947e68df03b443cf9fccb0cd54c9 Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 19:14:06 2021 -0400 Add alert for gallery and camera commit 0561794c67d827c918029f2e06572fd03b4531fd Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 18:51:57 2021 -0400 Finish poc for for video streaming commit 457b5cf34c032e7b73f972d5ba801ff420915190 Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 18:37:20 2021 -0400 Squashed commit of the following: commit b6e4676b6ea262580453963ed6cfd85932d32341 Author: Ivan Chen <ivan@tagg.id> Date: Mon Jun 21 19:04:08 2021 -0400 Add library, Add sample code commit 49dfe6a52e09bdb218e2b1ceb5a8df9ed46873f1 Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 18:37:12 2021 -0400 Squashed commit of the following: commit b1c2002caa349dc96f81d3cc3e00ea545f4e654e Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 15:28:18 2021 -0400 Add video for camerea commit ee890e517dd3688a4fd63c64592fdb6ce683d7b4 Author: Ivan Chen <ivan@tagg.id> Date: Tue Jun 22 18:36:47 2021 -0400 Improve poc UX
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',