@@ -13,15 +13,23 @@ import {
1313 handleConversationClear ,
1414 handleMessageDelete ,
1515 handleMessageDeleteForEveryOne ,
16+ handleUpdateBlockUser ,
1617 isAnyMessageWithinLast30Seconds ,
1718 isLocalUser ,
1819} from '../helpers/chatHelpers' ;
19- import { resetMessageSelections } from '../redux/chatMessageDataSlice' ;
20- import { setReplyMessage } from '../redux/draftSlice' ;
21- import { getSelectedChatMessages , useBlockedStatus , useSelectedChatMessages } from '../redux/reduxHook' ;
20+ import { resetMessageSelections , toggleEditMessage } from '../redux/chatMessageDataSlice' ;
21+ import { setReplyMessage , setTextMessage } from '../redux/draftSlice' ;
22+ import {
23+ getSelectedChatMessages ,
24+ getUserNameFromStore ,
25+ useBlockedStatus ,
26+ useSelectedChatMessages ,
27+ } from '../redux/reduxHook' ;
2228import { FORWARD_MESSSAGE_SCREEN , MESSAGE_INFO_SCREEN } from '../screens/constants' ;
2329import commonStyles from '../styles/commonStyles' ;
2430import { chatInputRef } from './ChatInput' ;
31+ import { MIX_BARE_JID } from '../helpers/constants' ;
32+ import { getStringSet } from '../localization/stringSet' ;
2533
2634export const RenderMessageSelectionCount = ( { userId } ) => {
2735 const filtered = useSelectedChatMessages ( userId ) || [ ] ;
@@ -58,6 +66,7 @@ export function RenderReplyIcon({ userId }) {
5866
5967export const RenderDeleteIcon = ( { userId, chatUser } ) => {
6068 const [ modalContent , setModalContent ] = React . useState ( null ) ;
69+ const stringSet = getStringSet ( ) ;
6170
6271 const toggleModalContent = ( ) => {
6372 setModalContent ( null ) ;
@@ -70,12 +79,15 @@ export const RenderDeleteIcon = ({ userId, chatUser }) => {
7079 setModalContent ( {
7180 visible : true ,
7281 onRequestClose : toggleModalContent ,
73- title : 'Are you sure you want to delete selected Message?' ,
74- noButton : 'CANCEL' ,
75- yesButton : 'DELETE FOR ME' ,
82+ title :
83+ selectedMessages ?. length > 1
84+ ? stringSet . CHAT_SCREEN . DELETE_MULTIPLE_MESSAGE
85+ : stringSet . CHAT_SCREEN . DELETE_SINGLE_MESSAGE ,
86+ noButton : stringSet . BUTTON_LABEL . CANCEL_BUTTON ,
87+ yesButton : stringSet . CHAT_SCREEN . DELETE_FOR_ME ,
7688 yesAction : handleMessageDelete ( chatUser ) ,
7789 ...( deleteForEveryOne && {
78- optionalButton : 'DELETE FOR EVERYONE' ,
90+ optionalButton : stringSet . CHAT_SCREEN . DELETE_FOR_EVERYONE ,
7991 optionalAction : handleMessageDeleteForEveryOne ( chatUser ) ,
8092 } ) ,
8193 } ) ;
@@ -124,6 +136,7 @@ export const RenderMenuItems = ({ userId, chatUser }) => {
124136 const filtered = useSelectedChatMessages ( userId ) || [ ] ;
125137 const blockedStaus = useBlockedStatus ( userId ) ;
126138 const [ modalContent , setModalContent ] = React . useState ( null ) ;
139+ const stringSet = getStringSet ( ) ;
127140
128141 const toggleModalContent = ( ) => {
129142 setModalContent ( null ) ;
@@ -138,9 +151,9 @@ export const RenderMenuItems = ({ userId, chatUser }) => {
138151 setModalContent ( {
139152 visible : true ,
140153 onRequestClose : toggleModalContent ,
141- title : 'Are you sure you want to clear the chat?' ,
142- noButton : 'No' ,
143- yesButton : 'Yes' ,
154+ title : stringSet . POPUP_TEXT . ARE_YOU_SURE_YOU_WANT_TO_CLEAR_THE_CHAT ,
155+ noButton : stringSet . BUTTON_LABEL . NO_BUTTON ,
156+ yesButton : stringSet . BUTTON_LABEL . YES_BUTTON ,
144157 yesAction : handleClearAction ,
145158 } ) ;
146159 } ;
@@ -149,7 +162,7 @@ export const RenderMenuItems = ({ userId, chatUser }) => {
149162 RootNavigation . navigate ( MESSAGE_INFO_SCREEN , { chatUser, msgId : filtered [ 0 ] . msgId } ) ;
150163 handelResetMessageSelection ( userId ) ( ) ;
151164 } ;
152- /**
165+
153166 const handleEditMessage = ( ) => {
154167 handelResetMessageSelection ( userId ) ( ) ;
155168 dispatch ( toggleEditMessage ( filtered [ 0 ] . msgId ) ) ;
@@ -164,13 +177,16 @@ export const RenderMenuItems = ({ userId, chatUser }) => {
164177 setModalContent ( {
165178 visible : true ,
166179 onRequestClose : toggleModalContent ,
167- title: `${blockedStaus ? 'Unblock' : 'Block'} ${getUserNameFromStore(userId)}`,
168- noButton: 'CANCEL',
169- yesButton: blockedStaus ? 'UNBLOCK' : 'BLOCK',
180+ title : `${
181+ blockedStaus ? stringSet . CHAT_SCREEN . UNBLOCK_LABEL : stringSet . CHAT_SCREEN . BLOCK_LABEL
182+ } ${ getUserNameFromStore ( userId ) } `,
183+ noButton : stringSet . BUTTON_LABEL . CANCEL_BUTTON ,
184+ yesButton : blockedStaus
185+ ? stringSet . CHAT_SCREEN . UNBLOCK_LABEL . toUpperCase ( )
186+ : stringSet . CHAT_SCREEN . BLOCK_LABEL . toUpperCase ( ) ,
170187 yesAction : handleUpdateBlockUser ( userId , blockedStaus ? 0 : 1 , chatUser ) ,
171188 } ) ;
172189 } ;
173- */
174190
175191 /**
176192 const toggleSearch = () => {
@@ -184,7 +200,7 @@ export const RenderMenuItems = ({ userId, chatUser }) => {
184200 filtered [ 0 ] ?. recallStatus === 0
185201 ) {
186202 menuItems . push ( {
187- label : 'Copy' ,
203+ label : stringSet . CHAT_SCREEN . COPY_TEXT_MENU_LABEL ,
188204 formatter : copyToClipboard ( filtered , userId ) ,
189205 } ) ;
190206 }
@@ -197,26 +213,24 @@ export const RenderMenuItems = ({ userId, chatUser }) => {
197213 filtered [ 0 ] ?. recallStatus === 0
198214 ) {
199215 menuItems . push ( {
200- label : 'Message Info' ,
216+ label : stringSet . CHAT_SCREEN . MESSAGE_INFO ,
201217 formatter : handleGoMessageInfoScreen ,
202218 } ) ;
203219 const now = Date . now ( ) ;
204220 if (
205221 now - filtered [ 0 ] ?. timestamp <= config . editMessageTime &&
206222 ( filtered [ 0 ] ?. msgBody . message_type === 'text' || filtered [ 0 ] ?. msgBody ?. media ?. caption )
207223 ) {
208- /**
209224 menuItems . push ( {
210- label: 'Edit Message' ,
225+ label : stringSet . CHAT_SCREEN . EDIT_MESSAGE ,
211226 formatter : handleEditMessage ,
212227 } ) ;
213- */
214228 }
215229 }
216230
217231 if ( ! filtered . length ) {
218232 menuItems . push ( {
219- label : 'Clear Chat' ,
233+ label : stringSet . CHAT_SCREEN . CLEAR_CHAT ,
220234 formatter : handleClear ,
221235 } ) ;
222236 /**
@@ -227,14 +241,12 @@ export const RenderMenuItems = ({ userId, chatUser }) => {
227241 */
228242 }
229243
230- /**
231244 if ( ! filtered . length && ! MIX_BARE_JID . test ( chatUser ) ) {
232245 menuItems . push ( {
233- label: blockedStaus ? 'Unblock' : 'Block' ,
246+ label : blockedStaus ? stringSet . CHAT_SCREEN . UNBLOCK_LABEL : stringSet . CHAT_SCREEN . BLOCK_LABEL ,
234247 formatter : hadleBlockUser ,
235248 } ) ;
236249 }
237- */
238250
239251 if ( menuItems . length === 0 ) {
240252 return null ;
0 commit comments