diff options
author | Ivan Chen <ivan@tagg.id> | 2021-07-01 15:53:25 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-07-01 15:53:25 -0400 |
commit | 29f64921943fb7016ab0db79e4c06377d617a3bf (patch) | |
tree | 6c74e88589bd82a1dfd4d2fbd49e8f8b9f474c61 /src/screens/profile/CaptionScreen.tsx | |
parent | b77a716e52fcc1e0c669ce59df1f063fb008a5ca (diff) |
Add logic for handling new video upload handshake
Diffstat (limited to 'src/screens/profile/CaptionScreen.tsx')
-rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx index da3efb06..05db8ed7 100644 --- a/src/screens/profile/CaptionScreen.tsx +++ b/src/screens/profile/CaptionScreen.tsx @@ -145,14 +145,18 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => { let momentId; // separate upload logic for image/video if (isMediaAVideo) { - const presignedURL = await handlePresignedURL(title); - if (!presignedURL) { + const presignedURLResponse = await handlePresignedURL(title); + if (!presignedURLResponse) { handleFailed(); return; } - momentId = presignedURL.moment_id; - // TODO: assume success for now - await handleVideoUpload(mediaUri, presignedURL); + momentId = presignedURLResponse.moment_id; + const fileHash = presignedURLResponse.response_url.fields.key; + if (fileHash !== null && fileHash !== '' && fileHash !== undefined) { + await handleVideoUpload(mediaUri, presignedURLResponse); + } else { + handleFailed(); + } } else { const momentResponse = await postMoment(mediaUri, caption, title, userId); if (!momentResponse) { |