diff --git a/app/mobile/src/context/useCardContext.hook.js b/app/mobile/src/context/useCardContext.hook.js
index 01e6cf7f..6c165486 100644
--- a/app/mobile/src/context/useCardContext.hook.js
+++ b/app/mobile/src/context/useCardContext.hook.js
@@ -473,6 +473,14 @@ export function useCardContext() {
const { guid } = session.current;
await store.actions.setCardChannelTopicBlocked(guid, cardId, channelId, topicId, true);
},
+ clearChannelTopicBlocked: async (cardId, channelId, topicId) => {
+ const { guid } = session.current;
+ await store.actions.setCardChannelTopicBlocked(guid, cardId, channelId, topicId, false);
+ },
+ getChannelTopicBlocked: async () => {
+ const { guid } = session.current;
+ return await store.actions.getCardChannelTopicBlocked(guid);
+ },
getChannelTopicItems: async (cardId, channelId) => {
const { guid } = session.current;
return await store.actions.getCardChannelTopicItems(guid, cardId, channelId);
diff --git a/app/mobile/src/context/useChannelContext.hook.js b/app/mobile/src/context/useChannelContext.hook.js
index cc23d844..09cd56c3 100644
--- a/app/mobile/src/context/useChannelContext.hook.js
+++ b/app/mobile/src/context/useChannelContext.hook.js
@@ -204,6 +204,14 @@ export function useChannelContext() {
const { guid } = session.current;
await store.actions.setChannelTopicBlocked(guid, channelId, topicId, true);
},
+ clearTopicBlocked: async (channelId, topicId) => {
+ const { guid } = session.current;
+ await store.actions.setChannelTopicBlocked(guid, channelId, topicId, false);
+ },
+ getTopicBlocked: async () => {
+ const { guid } = session.current;
+ return await store.actions.getChannelTopicBlocked(guid);
+ },
getTopicItems: async (channelId) => {
const { guid } = session.current;
return await store.actions.getChannelTopicItems(guid, channelId);
diff --git a/app/mobile/src/context/useConversationContext.hook.js b/app/mobile/src/context/useConversationContext.hook.js
index f93a5c44..0e19556e 100644
--- a/app/mobile/src/context/useConversationContext.hook.js
+++ b/app/mobile/src/context/useConversationContext.hook.js
@@ -422,11 +422,25 @@ export function useConversationContext() {
await channel.actions.setTopicBlocked(channelId, topicId);
}
const topic = topics.current.get(topicId);
- topic.blocked = 1;
- force.current = true;
- sync();
+ if (topic) {
+ topic.blocked = 1;
+ force.current = true;
+ sync();
+ }
}
},
+ unblockTopic: async (cardId, channelId, topicId) => {
+ if (conversationId.current) {
+ if (conversationId.current.cardId == cardId && conversationId.current.channelId == channelId) {
+ const topic = topics.current.get(topicId);
+ if (topic) {
+ topic.blocked = 0;
+ force.current = true;
+ sync();
+ }
+ }
+ }
+ }
}
return { state, actions }
diff --git a/app/mobile/src/context/useStoreContext.hook.js b/app/mobile/src/context/useStoreContext.hook.js
index 58b05e02..34efaa82 100644
--- a/app/mobile/src/context/useStoreContext.hook.js
+++ b/app/mobile/src/context/useStoreContext.hook.js
@@ -257,7 +257,15 @@ export function useStoreContext() {
await db.current.executeSql(`DELETE FROM channel_topic_${guid} WHERE channel_id=?`, [channelId]);
},
setChannelTopicBlocked: async (guid, channelId, topicId, blocked) => {
- let ret = await db.current.executeSql(`UPDATE channel_topic_${guid} set blocked=? WHERE channel_id=? and topic_id=?`, [blocked, channelId, topicId]);
+ await db.current.executeSql(`UPDATE channel_topic_${guid} set blocked=? WHERE channel_id=? and topic_id=?`, [blocked, channelId, topicId]);
+ },
+ getChannelTopicBlocked: async (guid) => {
+ const values = await getAppValues(db.current, `SELECT channel_id, topic_id, detail FROM channel_topic_${guid} WHERE blocked=?`, [1]);
+ return values.map(topic => ({
+ channelId: topic.channel_id,
+ topicId: topic.topic_id,
+ detail: decodeObject(topic.detail),
+ }));
},
setCardChannelItem: async (guid, cardId, channel) => {
@@ -321,7 +329,7 @@ export function useStoreContext() {
detailRevision: topic.detail_revision,
detail: decodeObject(topic.detail),
}));
- },
+ },
setCardChannelTopicItem: async (guid, cardId, channelId, topic) => {
const { id, revision, data } = topic;
await db.current.executeSql(`INSERT OR REPLACE INTO card_channel_topic_${guid} (card_id, channel_id, topic_id, revision, detail_revision, detail) values (?, ?, ?, ?, ?, ?);`, [cardId, channelId, id, revision, data.detailRevision, encodeObject(data.topicDetail)]);
@@ -335,6 +343,15 @@ export function useStoreContext() {
setCardChannelTopicBlocked: async (guid, cardId, channelId, topicId, blocked) => {
await db.current.executeSql(`UPDATE card_channel_topic_${guid} set blocked=? WHERE card_id=? and channel_id=? and topic_id=?`, [blocked ? 1 : 0, cardId, channelId, topicId]);
},
+ getCardChannelTopicBlocked: async (guid) => {
+ const values = await getAppValues(db.current, `SELECT card_id, channel_id, topic_id, detail FROM card_channel_topic_${guid} WHERE blocked=?`, [1]);
+ return values.map(topic => ({
+ cardId: topic.card_id,
+ channelId: topic.channel_id,
+ topicId: topic.topic_id,
+ detail: decodeObject(topic.detail),
+ }));
+ },
}
return { state, actions }
}
diff --git a/app/mobile/src/session/profile/Profile.jsx b/app/mobile/src/session/profile/Profile.jsx
index 0f0927ff..3f8a7c9e 100644
--- a/app/mobile/src/session/profile/Profile.jsx
+++ b/app/mobile/src/session/profile/Profile.jsx
@@ -9,6 +9,7 @@ import ImagePicker from 'react-native-image-crop-picker'
import { SafeAreaView } from 'react-native-safe-area-context';
import { BlockedTopics } from './blockedTopics/BlockedTopics';
import { BlockedContacts } from './blockedContacts/BlockedContacts';
+import { BlockedMessages } from './blockedMessages/BlockedMessages';
export function ProfileTitle(props) {
const { state, actions } = useProfile();
@@ -149,6 +150,9 @@ export function Profile() {
Manage Blocked Topics
+
+ Manage Blocked Messages
+
Logout
@@ -214,6 +218,27 @@ export function Profile() {
+
+
+
+ Blocked Messages:
+
+
+
+
+
+ Close
+
+
+
+
+
{
updateState({ blockedCards: false });
},
+ showBlockedMessages: () => {
+ updateState({ blockedMessages: true });
+ },
+ hideBlockedMessages: () => {
+ updateState({ blockedMessages: false });
+ },
showLoginEdit: () => {
updateState({ showLoginEdit: true });
},