diff --git a/app/mobile/src/session/conversation/Conversation.jsx b/app/mobile/src/session/conversation/Conversation.jsx
index da907fc1..fbb630d8 100644
--- a/app/mobile/src/session/conversation/Conversation.jsx
+++ b/app/mobile/src/session/conversation/Conversation.jsx
@@ -13,8 +13,6 @@ import { TopicItem } from './topicItem/TopicItem';
export function ConversationHeader({ closeConversation, openDetails }) {
const navigation = useNavigation();
const { state, actions } = useConversation();
-console.log(state.editing);
-
const setDetails = () => {
openDetails(navigation);
@@ -47,6 +45,20 @@ export function ConversationBody() {
}
}
+ const updateTopic = async () => {
+ try {
+ await actions.updateTopic();
+ actions.hideEdit();
+ }
+ catch (err) {
+ console.log(err);
+ Alert.alert(
+ 'Failed to Update Message',
+ 'Please try again.',
+ )
+ }
+ }
+
const noop = () => {};
return (
@@ -93,7 +105,7 @@ export function ConversationBody() {
Cancel
-
+
Save
diff --git a/app/mobile/src/session/conversation/topicItem/TopicItem.jsx b/app/mobile/src/session/conversation/topicItem/TopicItem.jsx
index 4b7bd980..6ef00e5b 100644
--- a/app/mobile/src/session/conversation/topicItem/TopicItem.jsx
+++ b/app/mobile/src/session/conversation/topicItem/TopicItem.jsx
@@ -46,20 +46,6 @@ export function TopicItem({ item, focused, focus, hosting, remove, update, block
);
}
- const editMessage = async () => {
- try {
- await update(item.topicId, { ...state.editData, text: state.editMessage });
- actions.hideEdit();
- }
- catch (err) {
- console.log(err);
- Alert.alert(
- 'Failed to Update Message',
- 'Please try again.',
- )
- }
- }
-
const hideMessage = () => {
Alert.alert(
"Blocking Message",
@@ -197,31 +183,6 @@ export function TopicItem({ item, focused, focus, hosting, remove, update, block
/>
-
-
-
- Edit Message Text:
-
-
-
-
-
- Cancel
-
-
- Save
-
-
-
-
-
);
}
diff --git a/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js b/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js
index 1e4ae054..a1194b30 100644
--- a/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js
+++ b/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js
@@ -22,9 +22,6 @@ export function useTopicItem(item, hosting, remove) {
fontColor: Colors.text,
editable: false,
deletable: false,
- editing: false,
- editMessage: null,
- editData: null,
});
const profile = useContext(ProfileContext);
@@ -142,17 +139,6 @@ export function useTopicItem(item, hosting, remove) {
setActive: (activeId) => {
updateState({ activeId });
},
- block: async () => {
- },
- showEdit: () => {
- updateState({ editing: true });
- },
- hideEdit: () => {
- updateState({ editing: false });
- },
- setEditMessage: (editMessage) => {
- updateState({ editMessage });
- },
};
return { state, actions };
diff --git a/app/mobile/src/session/conversation/useConversation.hook.js b/app/mobile/src/session/conversation/useConversation.hook.js
index 89278a85..e23e2649 100644
--- a/app/mobile/src/session/conversation/useConversation.hook.js
+++ b/app/mobile/src/session/conversation/useConversation.hook.js
@@ -61,15 +61,13 @@ export function useConversation() {
await conversation.actions.removeTopic(topicId);
},
editTopic: async (topicId, data) => {
-console.log("EDITING!");
- updateState({ editing: true, editTopicId: topicId, editData: data });
- //await conversation.actions.setTopicSubject(topicId, data);
+ updateState({ editing: true, editTopicId: topicId, editMessage: data.text, editData: data });
},
hideEdit: () => {
updateState({ editing: false });
},
- updateTopic: () => {
- updateState({ editing: false });
+ updateTopic: async () => {
+ await conversation.actions.setTopicSubject(state.editTopicId, { ...state.editData, text: state.editMessage });
},
setEditMessage: (editMessage) => {
updateState({ editMessage });