diff --git a/app/mobile/src/context/useCardContext.hook.js b/app/mobile/src/context/useCardContext.hook.js index 1e1201b6..f0552319 100644 --- a/app/mobile/src/context/useCardContext.hook.js +++ b/app/mobile/src/context/useCardContext.hook.js @@ -494,7 +494,7 @@ export function useCardContext() { }, removeChannel: async (cardId, channelId) => { const { detail, profile } = getCard(cardId); - return await removeChannel(profile.node, `${profile.guid}.${detail.token}`, channelId); + return await removeContactChannel(profile.node, `${profile.guid}.${detail.token}`, channelId); }, removeChannelTopic: async (cardId, channelId, topicId) => { const { detail, profile } = getCard(cardId); diff --git a/app/mobile/src/context/useChannelContext.hook.js b/app/mobile/src/context/useChannelContext.hook.js index cc304b22..9a5a5be4 100644 --- a/app/mobile/src/context/useChannelContext.hook.js +++ b/app/mobile/src/context/useChannelContext.hook.js @@ -94,7 +94,6 @@ export function useChannelContext() { const { server, appToken, guid } = session.current; const delta = await getChannels(server, appToken, setRevision.current); -console.log("DELTA", delta); for (let channel of delta) { if (channel.data) { if (channel.data.channelDetail && channel.data.channelSummary) { diff --git a/app/mobile/src/context/useConversationContext.hook.js b/app/mobile/src/context/useConversationContext.hook.js index fa6c60a9..2589c7b7 100644 --- a/app/mobile/src/context/useConversationContext.hook.js +++ b/app/mobile/src/context/useConversationContext.hook.js @@ -351,6 +351,12 @@ export function useConversationContext() { await channel.actions.setSubject(channelId, subject); } }, + remove: async () => { + if (conversationId.current) { + const { cardId, channelId } = conversationId.current; + await remove(cardId, channelId); + } + }, } return { state, actions } diff --git a/app/mobile/src/session/details/Details.jsx b/app/mobile/src/session/details/Details.jsx index 3ed22575..24df4073 100644 --- a/app/mobile/src/session/details/Details.jsx +++ b/app/mobile/src/session/details/Details.jsx @@ -28,13 +28,27 @@ export function DetailsBody({ channel, clearConversation }) { } } + const remove = async () => { + try { + await actions.remove(); + clearConversation(); + } + catch (err) { + console.log(err); + Alert.alert( + 'Failed to Delete Topic', + 'Please try again.' + ) + } + } + return ( - { state.subject } + { state.subject } { !state.hostId && ( )} @@ -46,7 +60,7 @@ export function DetailsBody({ channel, clearConversation }) { { !state.hostId && ( - + Delete Topic )} @@ -56,7 +70,7 @@ export function DetailsBody({ channel, clearConversation }) { )} { state.hostId && ( - + Leave Topic )} @@ -108,7 +122,6 @@ export function DetailsBody({ channel, clearConversation }) { export function Details({ channel, clearConversation }) { return ( - DETAILS ) diff --git a/app/mobile/src/session/details/Details.styled.js b/app/mobile/src/session/details/Details.styled.js index e1c8ebff..7e054a7e 100644 --- a/app/mobile/src/session/details/Details.styled.js +++ b/app/mobile/src/session/details/Details.styled.js @@ -2,16 +2,25 @@ import { StyleSheet } from 'react-native'; import { Colors } from 'constants/Colors'; export const styles = StyleSheet.create({ + body: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + }, details: { display: 'flex', flexDirection: 'row', justifyContent: 'center', paddingTop: 16, + flexShrink: 1, + minWidth: 0, }, info: { paddingLeft: 8, display: 'flex', flexDirection: 'column', + minWidth: 0, + flexShrink: 1, }, subject: { fontSize: 18, @@ -20,6 +29,13 @@ export const styles = StyleSheet.create({ paddingRight: 8, color: Colors.text, alignItems: 'center', + minWidth: 0, + flexShrink: 1, + }, + subjectText: { + fontSize: 18, + flexShrink: 1, + minWidth: 0, }, created: { fontSize: 16, @@ -32,11 +48,6 @@ export const styles = StyleSheet.create({ title: { fontSize: 20, }, - body: { - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - }, controls: { paddingTop: 16, }, diff --git a/app/mobile/src/session/details/useDetails.hook.js b/app/mobile/src/session/details/useDetails.hook.js index b1625cf7..000e7851 100644 --- a/app/mobile/src/session/details/useDetails.hook.js +++ b/app/mobile/src/session/details/useDetails.hook.js @@ -40,6 +40,9 @@ export function useDetails() { saveSubject: async () => { await conversation.actions.setSubject(state.subjectUpdate); }, + remove: async () => { + await conversation.actions.remove(); + }, }; return { state, actions };