From d9d12adfc355f2225eb266a4b513a79c70b426be Mon Sep 17 00:00:00 2001 From: Billy Jacoby Date: Fri, 13 Oct 2023 19:54:07 -0400 Subject: [PATCH] feat: add recordings screen (#12) * chore: rename navigation * feat: add recording screens * chore: cleanup * fix: timezones * cleanup: remove extra screen from events --- README.md | 2 +- ios/Podfile.lock | 14 +- package.json | 2 + src/assets/icons/index.ts | 21 ++ src/assets/icons/play-rect.svg | 4 + src/assets/icons/recording.svg | 11 + src/components/VideoPlayer.tsx | 12 +- src/components/index.ts | 1 + src/components/loadingView.tsx | 11 + src/components/snapshotCard.tsx | 56 +++-- src/lib/api/hooks/index.ts | 4 + src/lib/api/hooks/useRecordingSummary.ts | 33 +++ src/lib/api/hooks/useRecordings.ts | 34 +++ src/lib/api/index.ts | 3 +- src/lib/api/types/recordings.ts | 13 ++ src/navigation/CameraTabNavigator.tsx | 45 ++++ src/navigation/RootNavigation.tsx | 108 ++++++++++ .../components/LeftHeaderButton.tsx | 31 +++ .../components/RightHeaderButton.tsx | 16 ++ src/navigation/components/TabBarIcon.tsx | 44 ++++ src/navigation/components/index.ts | 2 + src/navigation/index.ts | 2 +- src/navigation/navigationContainer.tsx | 200 ------------------ .../EventsScreen/EventsScreen.tsx | 21 +- .../EventsScreen/components/CameraEvent.tsx | 58 ++--- .../EventsScreen/components/EventDetails.tsx | 0 .../components/EventListFooter.tsx | 0 .../EventsScreen/components/index.ts | 0 .../{ => CameraScreens}/EventsScreen/index.ts | 0 .../{ => CameraScreens}/LiveViewScreen.tsx | 0 .../RecordingsScreen/RecordingsScreen.tsx | 59 ++++++ .../RecordingsScreen/components/HourChip.tsx | 46 ++++ .../RecordingsScreen/components/index.ts | 1 + .../CameraScreens/RecordingsScreen/index.ts | 1 + .../components/SectionDateHeader.tsx | 41 ++++ src/screens/CameraScreens/components/index.ts | 1 + src/screens/CameraScreens/index.ts | 3 + .../components/SectionDateHeader.tsx | 40 ---- src/screens/FullscreenVideo.tsx | 43 ++++ src/screens/HomeScreen.tsx | 2 +- src/screens/index.ts | 4 +- src/utils/urls.ts | 14 ++ yarn.lock | 62 +++++- 43 files changed, 743 insertions(+), 322 deletions(-) create mode 100644 src/assets/icons/index.ts create mode 100644 src/assets/icons/play-rect.svg create mode 100644 src/assets/icons/recording.svg create mode 100644 src/components/loadingView.tsx create mode 100644 src/lib/api/hooks/index.ts create mode 100644 src/lib/api/hooks/useRecordingSummary.ts create mode 100644 src/lib/api/hooks/useRecordings.ts create mode 100644 src/lib/api/types/recordings.ts create mode 100644 src/navigation/CameraTabNavigator.tsx create mode 100644 src/navigation/RootNavigation.tsx create mode 100644 src/navigation/components/LeftHeaderButton.tsx create mode 100644 src/navigation/components/RightHeaderButton.tsx create mode 100644 src/navigation/components/TabBarIcon.tsx create mode 100644 src/navigation/components/index.ts delete mode 100644 src/navigation/navigationContainer.tsx rename src/screens/{ => CameraScreens}/EventsScreen/EventsScreen.tsx (89%) rename src/screens/{ => CameraScreens}/EventsScreen/components/CameraEvent.tsx (54%) rename src/screens/{ => CameraScreens}/EventsScreen/components/EventDetails.tsx (100%) rename src/screens/{ => CameraScreens}/EventsScreen/components/EventListFooter.tsx (100%) rename src/screens/{ => CameraScreens}/EventsScreen/components/index.ts (100%) rename src/screens/{ => CameraScreens}/EventsScreen/index.ts (100%) rename src/screens/{ => CameraScreens}/LiveViewScreen.tsx (100%) create mode 100644 src/screens/CameraScreens/RecordingsScreen/RecordingsScreen.tsx create mode 100644 src/screens/CameraScreens/RecordingsScreen/components/HourChip.tsx create mode 100644 src/screens/CameraScreens/RecordingsScreen/components/index.ts create mode 100644 src/screens/CameraScreens/RecordingsScreen/index.ts create mode 100644 src/screens/CameraScreens/components/SectionDateHeader.tsx create mode 100644 src/screens/CameraScreens/components/index.ts create mode 100644 src/screens/CameraScreens/index.ts delete mode 100644 src/screens/EventsScreen/components/SectionDateHeader.tsx create mode 100644 src/screens/FullscreenVideo.tsx diff --git a/README.md b/README.md index 0a54bca..34561ea 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Though this is built in React Native, the immediate focus is to build an iOS nat Though this project is still in the very early stages, it is maturing quickly. The items below are what is next on the roadmap for feature implementation: - [x] Event viewing -- [ ] Recording viewing +- [x] Recording viewing - [ ] View & update config - [ ] Local user settings - [ ] User onboarding diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 04efaf5..f6da4af 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -502,8 +502,12 @@ PODS: - React-jsi (= 0.72.4) - React-logger (= 0.72.4) - React-perflogger (= 0.72.4) + - RNFlashList (1.6.1): + - React-Core - RNGestureHandler (2.12.1): - React-Core + - RNLocalize (3.0.2): + - React-Core - RNReanimated (3.5.0): - DoubleConversion - FBLazyVector @@ -610,7 +614,9 @@ DEPENDENCIES: - React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) - React-utils (from `../node_modules/react-native/ReactCommon/react/utils`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) + - "RNFlashList (from `../node_modules/@shopify/flash-list`)" - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) + - RNLocalize (from `../node_modules/react-native-localize`) - RNReanimated (from `../node_modules/react-native-reanimated`) - RNScreens (from `../node_modules/react-native-screens`) - RNSVG (from `../node_modules/react-native-svg`) @@ -722,8 +728,12 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/react/utils" ReactCommon: :path: "../node_modules/react-native/ReactCommon" + RNFlashList: + :path: "../node_modules/@shopify/flash-list" RNGestureHandler: :path: "../node_modules/react-native-gesture-handler" + RNLocalize: + :path: "../node_modules/react-native-localize" RNReanimated: :path: "../node_modules/react-native-reanimated" RNScreens: @@ -791,7 +801,9 @@ SPEC CHECKSUMS: React-runtimescheduler: 4941cc1b3cf08b792fbf666342c9fc95f1969035 React-utils: b79f2411931f9d3ea5781404dcbb2fa8a837e13a ReactCommon: 4b2bdcb50a3543e1c2b2849ad44533686610826d + RNFlashList: 236646d48f224a034f35baa0242e1b77db063b1e RNGestureHandler: c0d04458598fcb26052494ae23dda8f8f5162b13 + RNLocalize: dbea38dcb344bf80ff18a1757b1becf11f70cae4 RNReanimated: fd0dc9a5889bfac6c45a922b26c902dc6185b4dc RNScreens: b21dc57dfa2b710c30ec600786a3fc223b1b92e7 RNSVG: ed492aaf3af9ca01bc945f7a149d76d62e73ec82 @@ -801,4 +813,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: b0e3f0f7f573d264ac8c53b7b631360254dc3679 -COCOAPODS: 1.12.1 +COCOAPODS: 1.13.0 diff --git a/package.json b/package.json index ff2e077..ea220d1 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,14 @@ "@react-navigation/bottom-tabs": "^6.5.8", "@react-navigation/native": "^6.1.7", "@react-navigation/native-stack": "^6.9.13", + "@shopify/flash-list": "^1.6.1", "@types/react-native-video": "^5.0.15", "clsx": "^2.0.0", "nativewind": "^2.0.11", "react": "18.2.0", "react-native": "0.72.4", "react-native-gesture-handler": "^2.12.1", + "react-native-localize": "^3.0.2", "react-native-mmkv": "^2.10.2", "react-native-reanimated": "^3.5.0", "react-native-safe-area-context": "^4.7.1", diff --git a/src/assets/icons/index.ts b/src/assets/icons/index.ts new file mode 100644 index 0000000..7f45dae --- /dev/null +++ b/src/assets/icons/index.ts @@ -0,0 +1,21 @@ +import Birdseye from './birdseye.svg'; +import Camera from './camera.svg'; +import DownSquare from './downSquare.svg'; +import Event from './event.svg'; +import Home from './home.svg'; +import PlayRect from './play-rect.svg'; +import Recording from './recording.svg'; +import Settings from './settings.svg'; +import Live from './video-waveform.svg'; + +export { + PlayRect, + Camera, + Birdseye, + DownSquare, + Event, + Home, + Recording, + Settings, + Live, +}; diff --git a/src/assets/icons/play-rect.svg b/src/assets/icons/play-rect.svg new file mode 100644 index 0000000..cd5ebc8 --- /dev/null +++ b/src/assets/icons/play-rect.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/icons/recording.svg b/src/assets/icons/recording.svg new file mode 100644 index 0000000..6529574 --- /dev/null +++ b/src/assets/icons/recording.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index d64d7f9..41378cd 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -6,23 +6,29 @@ export const VideoPlayer = ({ videoURI, isPaused = true, snapshotURL, + isForcedFullscreen, + onError, }: { videoURI: string; isPaused?: boolean; snapshotURL?: string; + isForcedFullscreen?: boolean; + onError?: Video['props']['onError']; }) => { React.useEffect(() => {}, []); return (