Skip to content

Commit 4d4c622

Browse files
MRN-901
1 parent 6f3aa95 commit 4d4c622

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/SDK/sdkCallBacks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ export const callBacks = {
709709
store.dispatch(addChatMessageItem(res));
710710
}
711711

712-
if (isShowNotification) {
712+
if (isShowNotification && !res?.editMessageId) {
713713
pushNotify(res.msgId, getNotifyNickName(res), getNotifyMessage(res), res?.fromUserJid);
714714
}
715715
break;

src/SDK/utils.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import config from '../config/config';
44
import {
55
calculateWidthAndHeight,
66
getCurrentChatUser,
7-
getThumbImage,
87
getUserIdFromJid,
9-
getVideoThumbImage,
108
handleConversationScollToBottom,
119
handleUploadNextImage,
1210
isLocalUser,
@@ -110,7 +108,6 @@ export const fetchMessagesFromSDK = async ({ fromUserJId, forceGetFromSDK = fals
110108
hasNextChatPage[userId] = false;
111109
return;
112110
}
113-
const page = chatPage[userId] || 1;
114111

115112
const {
116113
statusCode,
@@ -124,11 +121,9 @@ export const fetchMessagesFromSDK = async ({ fromUserJId, forceGetFromSDK = fals
124121
});
125122
if (statusCode === 200) {
126123
let hasEqualDataFetched = data.length === config.chatMessagesSizePerPage;
127-
if (data.length && hasEqualDataFetched) {
128-
chatPage[userId] = page + 1;
129-
}
124+
130125
hasNextChatPage[userId] = hasEqualDataFetched;
131-
store.dispatch(setChatMessages({ userJid, data, forceUpdate: page === 1 }));
126+
store.dispatch(setChatMessages({ userJid, data }));
132127
}
133128
if (statusCode !== 200) {
134129
showToast(message);

src/components/ArchivedHeader.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Text from '../common/Text';
99
import { getUserIdFromJid, showToast, toggleArchive } from '../helpers/chatHelpers';
1010
import { MIX_BARE_JID } from '../helpers/constants';
1111
import { getStringSet, replacePlaceholders } from '../localization/stringSet';
12-
import { deleteRecentChats, resetChatSelections } from '../redux/recentChatDataSlice';
12+
import { clearRecentChatData, deleteRecentChats, resetChatSelections } from '../redux/recentChatDataSlice';
1313
import {
1414
getArchiveSelectedChats,
1515
getUserNameFromStore,
@@ -20,6 +20,7 @@ import { ARCHIVED_SCREEN } from '../screens/constants';
2020
import SDK from '../SDK/SDK';
2121
import commonStyles from '../styles/commonStyles';
2222
import MuteChat from './MuteChat';
23+
import { clearChatMessageData } from '../redux/chatMessageDataSlice';
2324

2425
function ArchivedHeader() {
2526
const stringSet = getStringSet();
@@ -60,13 +61,13 @@ function ArchivedHeader() {
6061
};
6162

6263
const handleRemoveClose = () => {
63-
const isUserLeft = filtered.every(res => (MIX_BARE_JID.test(res.userJid) ? res.userType === '' : true));
64-
if (!isUserLeft && filtered.length > 1) {
64+
const _isUserLeft = filtered.every(res => (MIX_BARE_JID.test(res.userJid) ? res.userType === '' : true));
65+
if (!_isUserLeft && filtered.length > 1) {
6566
toggleModalContent();
6667
return showToast(stringSet.COMMON_TEXT.YOU_ARE_A_MEMBER);
6768
}
6869

69-
if (!isUserLeft) {
70+
if (!_isUserLeft) {
7071
toggleModalContent();
7172
return showToast(stringSet.COMMON_TEXT.YOU_ARE_A_PARTICIPANT);
7273
}
@@ -75,6 +76,9 @@ function ArchivedHeader() {
7576

7677
userJids.forEach(item => {
7778
SDK.deleteChat(item);
79+
SDK.clearChat(item);
80+
dispatch(clearChatMessageData(getUserIdFromJid(item)));
81+
dispatch(clearRecentChatData(item));
7882
});
7983

8084
dispatch(deleteRecentChats(ARCHIVED_SCREEN));

src/screens/ForwardMessage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,11 @@ const ForwardMessage = () => {
582582
// navigating the user after setTimeout to finish all the running things in background to avoid unwanted issues
583583
setTimeout(() => {
584584
const jid = Object.values(selectedUsers)[0]?.userJid;
585+
const userId = getUserIdFromJid(jid);
585586
setShowLoader(false);
586587
onMessageForwaded?.();
587588
if (Object.values(selectedUsers).length === 1) {
589+
dispatch(clearChatMessageData(userId));
588590
navigation.reset({
589591
index: 0,
590592
routes: [

0 commit comments

Comments
 (0)