diff --git a/app/mobile/src/context/useConversationContext.hook.js b/app/mobile/src/context/useConversationContext.hook.js index 047dbf16..786824b8 100644 --- a/app/mobile/src/context/useConversationContext.hook.js +++ b/app/mobile/src/context/useConversationContext.hook.js @@ -8,6 +8,7 @@ export function useConversationContext() { const [state, setState] = useState({ subject: null, logo: null, + revision: null, contacts: [], topics: new Map(), }); @@ -152,7 +153,12 @@ export function useConversationContext() { // update revision revision.current = channelItem.revision; if (curView == setView.current) { -console.log("update:", topics.current.size); + if (cardId) { + card.actions.setChannelReadRevision(cardId, channelId, revision.current); + } + else { + channel.actions.setReadRevision(channelId, revision.current); + } updateState({ topics: topics.current }); } diff --git a/app/mobile/src/session/Session.jsx b/app/mobile/src/session/Session.jsx index cbe9d217..13219781 100644 --- a/app/mobile/src/session/Session.jsx +++ b/app/mobile/src/session/Session.jsx @@ -70,7 +70,9 @@ export function Session() { }, [selected]); return ( - ({ headerShown: true, headerTintColor: Colors.primary })}> + ({ headerShown: true, headerTintColor: Colors.primary })} + screenListeners={{ state: (e) => { if (e?.data?.state?.index === 0 && selected) { setSelected(null); }}, }}> { state.subject } - + ); } +function show(arg) { + console.log(arg); +} + export function ConversationBody() { const { state, actions } = useConversation(); + const ref = useRef(); + + const latch = () => { + actions.latch(); + ref.current.scrollToIndex({ animated: true, index: 0 }); + } + return ( ITEM { item?.detail?.data }} keyExtractor={item => item.topicId} /> - + + + + { !state.latched && ( + + + + )} + + ); } @@ -57,7 +79,7 @@ export function Conversation({ closeConversation, openDetails }) { { state.subject } - + diff --git a/app/mobile/src/session/conversation/Conversation.styled.js b/app/mobile/src/session/conversation/Conversation.styled.js index 2789c007..01b456a4 100644 --- a/app/mobile/src/session/conversation/Conversation.styled.js +++ b/app/mobile/src/session/conversation/Conversation.styled.js @@ -73,5 +73,22 @@ export const styles = StyleSheet.create({ backgroundColor: Colors.white, maxHeight: 64, }, + addtopic: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + }, + latchbar: { + position: 'absolute', + top: -16, + display: 'flex', + flexDirection: 'row', + justifyContent: 'center', + width: '100%', + }, + latch: { + backgroundColor: Colors.formBackground, + borderRadius: 8, + }, }) diff --git a/app/mobile/src/session/conversation/useConversation.hook.js b/app/mobile/src/session/conversation/useConversation.hook.js index 824b7539..72c64bed 100644 --- a/app/mobile/src/session/conversation/useConversation.hook.js +++ b/app/mobile/src/session/conversation/useConversation.hook.js @@ -7,6 +7,7 @@ export function useConversation() { topics: [], subject: null, logo: null, + latched: true, }); const conversation = useContext(ConversationContext); @@ -33,6 +34,12 @@ export function useConversation() { }, [conversation]); const actions = { + latch: () => { + updateState({ latched: true }); + }, + unlatch: () => { + updateState({ latched: false }); + }, }; return { state, actions };