diff --git a/app/mobile/src/session/cardsIcon/CardsIcon.styled.js b/app/mobile/src/session/cardsIcon/CardsIcon.styled.js index 30b4febf..19658160 100644 --- a/app/mobile/src/session/cardsIcon/CardsIcon.styled.js +++ b/app/mobile/src/session/cardsIcon/CardsIcon.styled.js @@ -6,7 +6,7 @@ export const styles = StyleSheet.create({ width: 8, height: 8, borderRadius: 4, - backgroundColor: Colors.pending, + backgroundColor: Colors.background, position: 'absolute', left: 0, bottom: 0, diff --git a/app/mobile/src/session/conversation/topicItem/TopicItem.jsx b/app/mobile/src/session/conversation/topicItem/TopicItem.jsx index 416a79e3..5dc74915 100644 --- a/app/mobile/src/session/conversation/topicItem/TopicItem.jsx +++ b/app/mobile/src/session/conversation/topicItem/TopicItem.jsx @@ -14,8 +14,9 @@ import { AudioAsset } from './audioAsset/AudioAsset'; import { VideoAsset } from './videoAsset/VideoAsset'; import Carousel from 'react-native-reanimated-carousel'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; -export function TopicItem({ item, focused, focus, hosting, remove, update, block, report, contentKey }) { +import { SafeAreaView, SafeAreaProvider } from 'react-native-safe-area-context'; +export function TopicItem({ item, focused, focus, hosting, remove, update, block, report, contentKey }) { const { state, actions } = useTopicItem(item, hosting, remove, contentKey); const erase = () => { @@ -211,31 +212,33 @@ export function TopicItem({ item, focused, focus, hosting, remove, update, block supportedOrientations={['portrait', 'landscape']} onRequestClose={actions.hideCarousel} > - - - console.log('current index:', index)} - renderItem={({ index }) => ( - - { state.assets[index].type === 'image' && ( - - )} - { state.assets[index].type === 'video' && ( - - )} - { state.assets[index].type === 'audio' && ( - - )} - - )} /> - - + + + + console.log('current index:', index)} + renderItem={({ index }) => ( + + { state.assets[index].type === 'image' && ( + + )} + { state.assets[index].type === 'video' && ( + + )} + { state.assets[index].type === 'audio' && ( + + )} + + )} /> + + + ); diff --git a/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js b/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js index 840f4634..88c6626d 100644 --- a/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js +++ b/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js @@ -303,6 +303,9 @@ export function useTopicItem(item, hosting, remove, contentKey) { } await RNFS.appendFile(path, decrypted, 'base64'); + if (cancel.current) { + throw new Error("unseal assets cancelled"); + } assets[cur] = { ...asset, block: j+1, total: asset.parts.length }; updateState({ assets: [ ...assets ]}); }; @@ -320,7 +323,8 @@ export function useTopicItem(item, hosting, remove, contentKey) { } }, hideCarousel: () => { - updateState({ carousel: false }); + const assets = state.assets.map((asset) => ({ ...asset, error: false, decrypted: null })); + updateState({ carousel: false, assets }); cancel.current = true; }, setActive: (activeId) => { diff --git a/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx b/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx index c8d9a802..5e5d4467 100644 --- a/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx +++ b/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx @@ -6,6 +6,7 @@ import { styles } from './VideoAsset.styled'; import Icons from 'react-native-vector-icons/MaterialCommunityIcons'; import { useKeepAwake } from '@sayem314/react-native-keep-awake'; import FastImage from 'react-native-fast-image' +import { SafeAreaView } from 'react-native-safe-area-context'; import { useEffect } from 'react'; @@ -16,36 +17,34 @@ export function VideoAsset({ asset, dismiss }) { useKeepAwake(); return ( - + - + { state.url && ( - - { !state.loaded && ( + { !state.videoLoaded && ( { asset.total > 0 && ( diff --git a/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.styled.js b/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.styled.js index c77cb0d7..2068d35a 100644 --- a/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.styled.js +++ b/app/mobile/src/session/conversation/topicItem/videoAsset/VideoAsset.styled.js @@ -2,13 +2,26 @@ import { StyleSheet } from 'react-native'; import { Colors } from 'constants/Colors'; export const styles = StyleSheet.create({ - container: { + base: { + position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center', + width: '100%', + height: '100%', + }, + container: { + position: 'relative', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + width: '100%', + height: '100%', }, overlay: { position: 'absolute', + height: '100%', + width: '100%', backgroundColor: 'rgba(0, 0, 0, 0.4)', }, control: { @@ -19,18 +32,20 @@ export const styles = StyleSheet.create({ thumb: { borderRadius: 4, opacity: 0.6, + width: '100%', + height: '100%', }, main: { position: 'absolute', + width: '100%', + height: '100%', }, close: { position: 'absolute', top: 0, right: 0, - paddingTop: 4, - paddingBottom: 4, - paddingLeft: 8, - paddingRight: 8, + paddingRight: 16, + paddingTop: 16, }, loading: { position: 'absolute', diff --git a/app/mobile/src/session/conversation/topicItem/videoAsset/useVideoAsset.hook.js b/app/mobile/src/session/conversation/topicItem/videoAsset/useVideoAsset.hook.js index 62041d0a..aaa24afd 100644 --- a/app/mobile/src/session/conversation/topicItem/videoAsset/useVideoAsset.hook.js +++ b/app/mobile/src/session/conversation/topicItem/videoAsset/useVideoAsset.hook.js @@ -16,9 +16,9 @@ export function useVideoAsset(asset) { thumbHeight: 64, url: null, playing: false, - loaded: false, + thumbLoaded: false, + videoLoaded: false, controls: false, - display: { display: 'none' }, }); const controls = useRef(null); @@ -71,15 +71,13 @@ export function useVideoAsset(asset) { }, [asset]); const actions = { - setRatio: (e) => { - const { width, height } = e.nativeEvent; - updateState({ thumbRatio: width / height }); + setThumbSize: (e) => { + const { width, height } = e.nativeEvent || {}; + updateState({ thumbLoaded: true, thumbRatio: width / height }); }, - setResolution: (width, height) => { - updateState({ display: {}, videoRatio: width / height }); - }, - loaded: () => { - updateState({ loaded: true }); + setVideoSize: (e) => { + const { width, height } = e.naturalSize || {}; + updateState({ videoLoaded: true, videoRatio: width / height }); }, play: () => { actions.showControls();