From fb711a1dbfc3bb55fcba7d6e4d9d3afdc00c1129 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Mon, 6 Mar 2023 14:32:21 -0800 Subject: [PATCH] hide delete button if not applicable --- app/mobile/src/session/conversation/Conversation.jsx | 2 +- app/mobile/src/session/conversation/useConversation.hook.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/mobile/src/session/conversation/Conversation.jsx b/app/mobile/src/session/conversation/Conversation.jsx index 04fd0f79..38cb26bf 100644 --- a/app/mobile/src/session/conversation/Conversation.jsx +++ b/app/mobile/src/session/conversation/Conversation.jsx @@ -101,7 +101,7 @@ export function Conversation({ navigation, cardId, channelId, closeConversation, onEndReached={loadMore} onEndReachedThreshold={0.1} renderItem={({item}) => actions.setFocus(item.topicId)} hosting={state.host == null} + focus={() => actions.setFocus(item.topicId)} hosting={state.hosted} remove={actions.removeTopic} update={actions.editTopic} block={actions.blockTopic} report={actions.reportTopic} contentKey={state.contentKey} /> } keyExtractor={item => item.topicId} diff --git a/app/mobile/src/session/conversation/useConversation.hook.js b/app/mobile/src/session/conversation/useConversation.hook.js index 4fd7fa85..66854fb2 100644 --- a/app/mobile/src/session/conversation/useConversation.hook.js +++ b/app/mobile/src/session/conversation/useConversation.hook.js @@ -8,6 +8,7 @@ import { getChannelSeals, isUnsealed, getContentKey, encryptTopicSubject, decryp export function useConversation() { const [state, setState] = useState({ + hosted: null, subject: null, logo: null, topic: [], @@ -73,6 +74,7 @@ export function useConversation() { const cardId = conversation.state.card?.card?.cardId; const profileGuid = profile.state.identity?.guid; const channel = conversation.state.channel; + const hosted = conversation.state.card == null; const cards = card.state.cards; cardImageUrl = card.actions.getCardImageUrl; const { logo, subject } = getChannelSubjectLogo(cardId, profileGuid, channel, cards, cardImageUrl); @@ -91,7 +93,7 @@ export function useConversation() { }); const filtered = sorted.filter(item => !(item.blocked === 1)); - updateState({ loaded, logo, subject, topics: filtered, delayed: false }); + updateState({ hosted, loaded, logo, subject, topics: filtered, delayed: false }); setTimeout(() => { updateState({ delayed: true }); @@ -105,7 +107,6 @@ export function useConversation() { updateState({ focus }); }, editTopic: async (topicId, type, data) => { - console.log("EDIT:", topicId, type, data); updateState({ editing: true, editTopicId: topicId, editType: type, editMessage: data?.text, editData: data }); }, hideEdit: () => {