aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/moments/MomentPost.tsx18
-rw-r--r--src/screens/moments/CameraScreen.tsx21
-rw-r--r--src/screens/profile/CaptionScreen.tsx1
-rw-r--r--src/services/MomentService.ts6
-rw-r--r--src/store/actions/user.ts6
5 files changed, 42 insertions, 10 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index d95d6f3a..939c0cf6 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -1,4 +1,4 @@
-import {useNavigation} from '@react-navigation/native';
+import {useIsFocused, useNavigation} from '@react-navigation/native';
import React, {useContext, useEffect, useMemo, useRef, useState} from 'react';
import {
Image,
@@ -91,7 +91,14 @@ const MomentPost: React.FC<MomentPostProps> = ({
);
const mediaHeight = SCREEN_WIDTH / aspectRatio;
const [isVideoPaused, setIsVideoPaused] = useState<boolean>(false);
+ const screenIsFocused = useIsFocused();
const videoProgress = useSharedValue(0);
+
+ // update play/pause icon based on video pause state
+ useEffect(() => {
+ setFadeValue(new Animated.Value(isVideoPaused ? 1 : 0));
+ }, [isVideoPaused]);
+
/*
* Load tags on initial render to pass tags data to moment header and content
*/
@@ -228,7 +235,11 @@ const MomentPost: React.FC<MomentPostProps> = ({
const {width, height} = response.naturalSize;
setAspectRatio(width / height);
}}
- paused={moment.moment_id !== currentVisibleMomentId || isVideoPaused}
+ paused={
+ moment.moment_id !== currentVisibleMomentId ||
+ isVideoPaused ||
+ !screenIsFocused
+ }
onProgress={({currentTime, seekableDuration}) => {
const localProgress = currentTime / seekableDuration;
if (!isNaN(localProgress)) {
@@ -294,9 +305,6 @@ const MomentPost: React.FC<MomentPostProps> = ({
onPress={() => {
if (isVideo) {
setIsVideoPaused(!isVideoPaused);
- isVideoPaused
- ? setFadeValue(new Animated.Value(0))
- : setFadeValue(new Animated.Value(1));
} else {
setTagsVisible(!tagsVisible);
setFadeValue(new Animated.Value(0));
diff --git a/src/screens/moments/CameraScreen.tsx b/src/screens/moments/CameraScreen.tsx
index 27412486..40db1191 100644
--- a/src/screens/moments/CameraScreen.tsx
+++ b/src/screens/moments/CameraScreen.tsx
@@ -4,14 +4,14 @@ import {RouteProp} from '@react-navigation/core';
import {useFocusEffect} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import React, {createRef, useCallback, useEffect, useState} from 'react';
-import {StyleSheet, TouchableOpacity, View} from 'react-native';
+import {Modal, StyleSheet, TouchableOpacity, View} from 'react-native';
import {CameraType, FlashMode, RNCamera} from 'react-native-camera';
import {AnimatedCircularProgress} from 'react-native-circular-progress';
import CloseIcon from '../../assets/ionicons/close-outline.svg';
import {FlashButton, FlipButton, GalleryIcon} from '../../components';
import {TAGG_PURPLE} from '../../constants';
import {MainStackParams} from '../../routes';
-import {HeaderHeight, SCREEN_WIDTH} from '../../utils';
+import {HeaderHeight, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils';
import {showGIFFailureAlert, takePicture, takeVideo} from '../../utils/camera';
type CameraScreenRouteProps = RouteProp<MainStackParams, 'CameraScreen'>;
@@ -84,6 +84,11 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => {
return (
<View style={styles.container}>
+ <Modal
+ transparent={true}
+ visible={isRecording && cameraType === 'front' && flashMode === 'on'}>
+ <View style={styles.flashView} />
+ </Modal>
<TouchableOpacity style={styles.closeButton} onPress={handleClose}>
<CloseIcon height={25} width={25} color={'white'} />
</TouchableOpacity>
@@ -92,7 +97,11 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => {
ref={cameraRef}
style={styles.camera}
type={cameraType}
- flashMode={flashMode}
+ flashMode={
+ flashMode === 'on' && isRecording && cameraType === 'back'
+ ? 'torch'
+ : flashMode
+ }
onDoubleTap={() => {
setCameraType(cameraType === 'front' ? 'back' : 'front');
}}
@@ -164,6 +173,12 @@ const styles = StyleSheet.create({
flexDirection: 'column',
backgroundColor: 'black',
},
+ flashView: {
+ width: SCREEN_WIDTH,
+ height: SCREEN_HEIGHT,
+ backgroundColor: '#fff',
+ opacity: 0.5,
+ },
captureButtonVideoContainer: {
alignSelf: 'center',
backgroundColor: 'transparent',
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 66106a6f..d329c589 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -166,6 +166,7 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
handleVideoMomentUpload(
mediaUri,
videoDuration ?? 30,
+ caption,
momentCategory,
formattedTags(),
),
diff --git a/src/services/MomentService.ts b/src/services/MomentService.ts
index 3a677ccc..0292f9ea 100644
--- a/src/services/MomentService.ts
+++ b/src/services/MomentService.ts
@@ -223,7 +223,10 @@ export const deleteMomentTag = async (moment_tag_id: string) => {
* @param value: string | undefined
* @returns a PresignedURLResponse object
*/
-export const handlePresignedURL = async (momentCategory: string) => {
+export const handlePresignedURL = async (
+ caption: string,
+ momentCategory: string,
+) => {
try {
// TODO: just a random filename for video poc, we should not need to once complete
const randHash = Math.random().toString(36).substring(7);
@@ -236,6 +239,7 @@ export const handlePresignedURL = async (momentCategory: string) => {
},
body: JSON.stringify({
filename,
+ caption: caption,
category: momentCategory,
}),
});
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts
index 14865f25..f01e2bac 100644
--- a/src/store/actions/user.ts
+++ b/src/store/actions/user.ts
@@ -380,6 +380,7 @@ export const handleVideoMomentUpload =
(
videoUri: string,
videoLength: number,
+ caption: string,
momentCategory: string,
formattedTags: {
x: number;
@@ -413,7 +414,10 @@ export const handleVideoMomentUpload =
payload: {momentUploadProgressBar},
});
// get a presigned url for the video
- const presignedURLResponse = await handlePresignedURL(momentCategory);
+ const presignedURLResponse = await handlePresignedURL(
+ caption,
+ momentCategory,
+ );
if (!presignedURLResponse) {
handleError('Presigned URL failed');
return;