aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Kim <brian@tagg.id>2021-07-14 11:28:06 -0400
committerBrian Kim <brian@tagg.id>2021-07-14 11:28:06 -0400
commit1b9059d49532eacb60bf36b25771df42541670f4 (patch)
treeb56b7ea0f94d5cba12e64c430ac8889fd495832c
parent5e1ef04923a103dccbb48be34bf99dfb625b2d87 (diff)
Clean up code round 2
-rw-r--r--ios/Frontend.xcodeproj/project.pbxproj3
-rw-r--r--src/components/comments/ZoomInCropper.tsx42
-rw-r--r--src/screens/moments/CameraScreen.tsx6
-rw-r--r--src/screens/profile/CaptionScreen.tsx1
4 files changed, 23 insertions, 29 deletions
diff --git a/ios/Frontend.xcodeproj/project.pbxproj b/ios/Frontend.xcodeproj/project.pbxproj
index af943815..0cf0957b 100644
--- a/ios/Frontend.xcodeproj/project.pbxproj
+++ b/ios/Frontend.xcodeproj/project.pbxproj
@@ -1090,7 +1090,6 @@
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_STYLE = Manual;
DEBUG_INFORMATION_FORMAT = dwarf;
- DEVELOPMENT_TEAM = "";
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Frontend-tvOS/Info.plist";
@@ -1122,7 +1121,6 @@
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DEVELOPMENT_TEAM = "";
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Frontend-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1150,7 +1148,6 @@
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
- DEVELOPMENT_TEAM = VQ6D29Y5N7;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "Frontend-tvOSTests/Info.plist";
diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx
index 43c4c6ff..6f8ff97c 100644
--- a/src/components/comments/ZoomInCropper.tsx
+++ b/src/components/comments/ZoomInCropper.tsx
@@ -35,7 +35,7 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
const [aspectRatio, setAspectRatio] = useState<number>(1);
// width and height of video, if video
const [origDimensions, setOrigDimensions] = useState<number[]>([0, 0]);
- const vidRef = useRef<Video>(null);
+ const vidRef = useRef<View>(null);
// Stores the coordinates of the cropped image
const [x0, setX0] = useState<number>();
@@ -73,20 +73,22 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
(err) => console.log(err),
);
} else if (media.uri && !checkIfUriImage(media.uri)) {
- const tempVideoCrop = {...videoCrop};
- tempVideoCrop.cropWidth = origDimensions[0];
- tempVideoCrop.cropHeight = origDimensions[1];
- setVideoCrop(tempVideoCrop);
+ setVideoCrop((prevState) => ({
+ ...prevState,
+ cropWidth: origDimensions[0],
+ cropHeight: origDimensions[1],
+ }));
}
}, []);
// Possible need to delay setting aspect ratio of video until loaded
useEffect(() => {
if (media.uri && !checkIfUriImage(media.uri)) {
- const tempVideoCrop = {...videoCrop};
- tempVideoCrop.cropWidth = origDimensions[0];
- tempVideoCrop.cropHeight = origDimensions[1];
- setVideoCrop(tempVideoCrop);
+ setVideoCrop((prevState) => ({
+ ...prevState,
+ cropWidth: origDimensions[0],
+ cropHeight: origDimensions[1],
+ }));
}
}, [origDimensions]);
@@ -128,10 +130,11 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
}
} else {
if (!videoCrop.cropHeight || !videoCrop.cropWidth) {
- const tempVideoCrop = {...videoCrop};
- tempVideoCrop.cropWidth = origDimensions[0];
- tempVideoCrop.cropHeight = origDimensions[1];
- setVideoCrop(tempVideoCrop);
+ setVideoCrop((prevState) => ({
+ ...prevState,
+ cropWidth: origDimensions[0],
+ cropHeight: origDimensions[1],
+ }));
}
cropVideo(
media.uri,
@@ -200,12 +203,13 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
} else {
cropHeight = origDimensions[1];
}
- const tempVideoCrop = {...videoCrop};
- tempVideoCrop.cropWidth = cropWidth;
- tempVideoCrop.cropHeight = cropHeight;
- tempVideoCrop.cropOffsetX = cropOffsetX;
- tempVideoCrop.cropOffsetY = cropOffsetY;
- setVideoCrop(tempVideoCrop);
+ setVideoCrop((prevState) => ({
+ ...prevState,
+ cropWidth: cropWidth,
+ cropHeight: cropHeight,
+ cropOffsetX: cropOffsetX,
+ cropOffsetY: cropOffsetY,
+ }));
},
);
}
diff --git a/src/screens/moments/CameraScreen.tsx b/src/screens/moments/CameraScreen.tsx
index 4ed984e7..ee5834cb 100644
--- a/src/screens/moments/CameraScreen.tsx
+++ b/src/screens/moments/CameraScreen.tsx
@@ -184,12 +184,6 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => {
) {
showGIFFailureAlert(() => navigateToCropper(media.path));
} else {
- // is this a video?
- // if (media.duration !== null) {
- // navigateToCaptionScreen(true, media.path);
- // } else {
- // navigateToCropper(media.path);
- // }
navigateToCropper(media.path);
}
}}
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index 99ff8819..1232eb66 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -78,7 +78,6 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const [taggedUsersText, setTaggedUsersText] = useState('');
const [momentCategory, setMomentCategory] = useState<string | undefined>();
const mediaUri = moment ? moment.moment_url : route.params.media!.uri;
- // console.log('mediaUri', mediaUri);
// TODO: change this once moment refactor is done
const isMediaAVideo = moment
? !(