From f1df322523cc5a2e9552737e0776975c50da6082 Mon Sep 17 00:00:00 2001 From: balzack Date: Thu, 2 Mar 2023 08:18:38 -0800 Subject: [PATCH] switching carousel module --- app/mobile/package.json | 1 + app/mobile/src/context/useAppContext.hook.js | 1 + .../context/useConversationContext.hook.js | 4 ++++ .../conversation/topicItem/TopicItem.jsx | 20 +++++++++++++++++++ .../topicItem/imageAsset/ImageAsset.jsx | 2 +- .../topicItem/videoAsset/VideoAsset.jsx | 8 +++++--- app/mobile/yarn.lock | 5 +++++ 7 files changed, 37 insertions(+), 4 deletions(-) diff --git a/app/mobile/package.json b/app/mobile/package.json index ce411ffa..7f382f40 100644 --- a/app/mobile/package.json +++ b/app/mobile/package.json @@ -30,6 +30,7 @@ "react-native-gesture-handler": "^2.9.0", "react-native-image-crop-picker": "^0.39.0", "react-native-reanimated": "^2.14.4", + "react-native-reanimated-carousel": "^3.3.0", "react-native-rsa-native": "^2.0.5", "react-native-safe-area-context": "^4.5.0", "react-native-screens": "^3.20.0", diff --git a/app/mobile/src/context/useAppContext.hook.js b/app/mobile/src/context/useAppContext.hook.js index f1a57bec..d2cd77c9 100644 --- a/app/mobile/src/context/useAppContext.hook.js +++ b/app/mobile/src/context/useAppContext.hook.js @@ -156,6 +156,7 @@ export function useAppContext() { const setWebsocket = (session) => { ws.current = createWebsocket(`wss://${session.server}/status`); ws.current.onmessage = (ev) => { +console.log("ON MESSAGE!"); try { delay.current = 0; const rev = JSON.parse(ev.data); diff --git a/app/mobile/src/context/useConversationContext.hook.js b/app/mobile/src/context/useConversationContext.hook.js index 71b1d327..80ad1b6e 100644 --- a/app/mobile/src/context/useConversationContext.hook.js +++ b/app/mobile/src/context/useConversationContext.hook.js @@ -34,6 +34,7 @@ export function useConversationContext() { const sync = async () => { +console.log("SYNCING!"); if (!syncing.current && (reset.current || update.current || force.current || more.current)) { const loadMore = more.current; const ignoreRevision = force.current; @@ -92,16 +93,19 @@ export function useConversationContext() { if (ignoreRevision || curRevision !== setRevision) { try { if (!marker) { +console.log("FIRST GET"); const delta = await getTopicDelta(cardId, channelId, null, COUNT, null, null); await setTopicDelta(cardId, channelId, delta.topics); await setMarkerAndSync(cardId, channelId, delta.marker, curRevision); } if (loadMore && marker) { +console.log("MORE GET"); const delta = await getTopicDelta(cardId, channelId, null, COUNT, null, marker); await setTopicDelta(cardId, channelId, delta.topics); await setTopicMarker(cardId, channelId, delta.marker); } if (ignoreRevision || curRevision !== setRevision) { +console.log("UPDATE"); const delta = await getTopicDelta(cardId, channelId, setRevision, null, marker, null); await setTopicDelta(cardId, channelId, delta.topics); await setSyncRevision(cardId, channelId, curRevision); diff --git a/app/mobile/src/session/conversation/topicItem/TopicItem.jsx b/app/mobile/src/session/conversation/topicItem/TopicItem.jsx index 99be1242..1f7872f2 100644 --- a/app/mobile/src/session/conversation/topicItem/TopicItem.jsx +++ b/app/mobile/src/session/conversation/topicItem/TopicItem.jsx @@ -12,6 +12,7 @@ import { ImageThumb } from './imageThumb/ImageThumb'; import { ImageAsset } from './imageAsset/ImageAsset'; import { AudioAsset } from './audioAsset/AudioAsset'; import { VideoAsset } from './videoAsset/VideoAsset'; +import Carousel from 'react-native-reanimated-carousel'; export function TopicItem({ item, focused, focus, hosting, sealed, sealKey, remove, update, block, report }) { @@ -207,6 +208,25 @@ export function TopicItem({ item, focused, focus, hosting, sealed, sealKey, remo onRequestClose={actions.hideCarousel} > + ( + + { state.assets[index].image && ( + + )} + { state.assets[index].video && ( + + )} + { state.assets[index].audio && ( + + )} + + )} /> diff --git a/app/mobile/src/session/conversation/topicItem/imageAsset/ImageAsset.jsx b/app/mobile/src/session/conversation/topicItem/imageAsset/ImageAsset.jsx index fb3df394..c4d5b3d1 100644 --- a/app/mobile/src/session/conversation/topicItem/imageAsset/ImageAsset.jsx +++ b/app/mobile/src/session/conversation/topicItem/imageAsset/ImageAsset.jsx @@ -7,7 +7,7 @@ export function ImageAsset({ topicId, asset, dismiss }) { const { state, actions } = useImageAsset(topicId, asset); return ( - + { state.failed && ( diff --git a/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx b/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx index c8c2fa78..ef3ed9a4 100644 --- a/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx +++ b/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx @@ -12,9 +12,11 @@ export function VideoAsset({ topicId, asset, dismiss }) { return ( -