diff --git a/package.json b/package.json index 292afbb..7107f56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,8 @@ { "name": "cometchat-pro-react-native-ui-kit", - "version": "3.0.2-1", + + "version": "3.0.2-2", + "description": "Chat UI Kit for React Native App", "main": "./src/index.js", "scripts": { @@ -8,8 +10,9 @@ "lint": "eslint 'src/**/*.{js,jsx}' --quiet --fix" }, "repository": { - "type": "git", - "url": "git@github.com:cometchat-pro/react-native-chat-sdk.git" + + "type": "git" + }, "peerDependencies": { "react-native-keep-awake": "^4.0.0", diff --git a/src/components/Messages/CometChatMessageActions/actions.js b/src/components/Messages/CometChatMessageActions/actions.js index 0f59a56..bc27059 100644 --- a/src/components/Messages/CometChatMessageActions/actions.js +++ b/src/components/Messages/CometChatMessageActions/actions.js @@ -24,11 +24,16 @@ export default (props) => { }, []); const checkRestrictions = async () => { - let enableEditMessage = await context.FeatureRestriction.isEditMessageEnabled(); - let enableThreadedChats = await context.FeatureRestriction.isThreadedMessagesEnabled(); - let enableDeleteMessage = await context.FeatureRestriction.isDeleteMessageEnabled(); - let enableDeleteMessageForModerator = await context.FeatureRestriction.isDeleteMemberMessageEnabled(); - let enableMessageInPrivate = await context.FeatureRestriction.isMessageInPrivateEnabled(); + let enableEditMessage = + await context.FeatureRestriction.isEditMessageEnabled(); + let enableThreadedChats = + await context.FeatureRestriction.isThreadedMessagesEnabled(); + let enableDeleteMessage = + await context.FeatureRestriction.isDeleteMessageEnabled(); + let enableDeleteMessageForModerator = + await context.FeatureRestriction.isDeleteMemberMessageEnabled(); + let enableMessageInPrivate = + await context.FeatureRestriction.isMessageInPrivateEnabled(); if ( !enableEditMessage && @@ -100,10 +105,18 @@ export default (props) => { if ( props.message.messageFrom === enums.MESSAGE_FROM_RECEIVER && - (props.item.scope == CometChat.GROUP_MEMBER_SCOPE.MODERATOR || - props.item.scope == CometChat.GROUP_MEMBER_SCOPE.ADMIN - ? !restrictions?.enableDeleteMessageForModerator - : !restrictions?.enableDeleteMessage) + (props.type == CometChat.RECEIVER_TYPE.GROUP + ? props.item.scope == CometChat.GROUP_MEMBER_SCOPE.MODERATOR || + props.item.scope == CometChat.GROUP_MEMBER_SCOPE.ADMIN + ? !restrictions?.enableDeleteMessageForModerator + : true + : true) + ) { + deleteMessage = null; + } + if ( + props.type == CometChat.RECEIVER_TYPE.USER && + !restrictions?.enableDeleteMessage ) { deleteMessage = null; } diff --git a/src/components/Messages/CometChatMessageComposer/composerActions.js b/src/components/Messages/CometChatMessageComposer/composerActions.js index 373c7d7..e111801 100644 --- a/src/components/Messages/CometChatMessageComposer/composerActions.js +++ b/src/components/Messages/CometChatMessageComposer/composerActions.js @@ -129,7 +129,6 @@ export default class ComposerActions extends Component { ? response.uri : response.uri.replace('file://', ''), }; - console.log('file', file); this.props.sendMediaMessage( file, mediaType === 'photo' diff --git a/src/components/Messages/CometChatMessageThread/index.js b/src/components/Messages/CometChatMessageThread/index.js index d53cc8c..571eb39 100644 --- a/src/components/Messages/CometChatMessageThread/index.js +++ b/src/components/Messages/CometChatMessageThread/index.js @@ -71,7 +71,8 @@ class CometChatMessageThread extends React.PureComponent { } checkIsHideDeletedEnabled = async () => { - let hideDeletedEnabled = this.context.FeatureRestriction.isHideDeletedMessagesEnabled(); + let hideDeletedEnabled = + this.context.FeatureRestriction.isHideDeletedMessagesEnabled(); this.setState({ hideDeletedEnabled }); }; @@ -646,6 +647,7 @@ class CometChatMessageThread extends React.PureComponent { return ( {separator} diff --git a/src/components/Messages/CometChatMessages/index.js b/src/components/Messages/CometChatMessages/index.js index a04ce1f..37ec71e 100644 --- a/src/components/Messages/CometChatMessages/index.js +++ b/src/components/Messages/CometChatMessages/index.js @@ -1057,6 +1057,7 @@ class CometChatMessages extends React.PureComponent { ? this.state.user : this.state.item } + type={params.type} loggedInUser={this.loggedInUser} open={!!this.state.messageToReact} message={this.state.messageToReact} diff --git a/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js b/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js index b5e3e3c..d3553d1 100644 --- a/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js +++ b/src/components/Messages/Extensions/CometChatSenderStickerMessageBubble/index.js @@ -13,7 +13,7 @@ import * as actions from '../../../../utils/actions'; const CometChatSenderStickerMessageBubble = (props) => { const message = { ...props.message, - messageFrom: enums.MESSAGE_FROM_RECEIVER, + messageFrom: enums.MESSAGE_FROM_SENDER, }; let stickerData = null; let stickerImg = null; diff --git a/src/components/Shared/CometChatSharedMedia/index.js b/src/components/Shared/CometChatSharedMedia/index.js index 16b3cf9..4279c22 100644 --- a/src/components/Shared/CometChatSharedMedia/index.js +++ b/src/components/Shared/CometChatSharedMedia/index.js @@ -49,6 +49,7 @@ export default class CometChatSharedMedia extends React.Component { this.props.item, this.props.type, this.state.messageType, + this.context, ); this.getMessages(); this.SharedMediaManager.attachListeners(this.messageUpdated); diff --git a/src/components/Users/CometChatUserDetails/index.js b/src/components/Users/CometChatUserDetails/index.js index 2458c5c..037add9 100644 --- a/src/components/Users/CometChatUserDetails/index.js +++ b/src/components/Users/CometChatUserDetails/index.js @@ -39,7 +39,6 @@ export default class CometChatUserDetails extends React.Component { } updateUser = (key, user) => { - console.log('updateUser', key, user); switch (key) { case enums.USER_ONLINE: case enums.USER_OFFLINE: { diff --git a/src/utils/UIKitSettings.js b/src/utils/UIKitSettings.js index c0d7e00..b361e4c 100644 --- a/src/utils/UIKitSettings.js +++ b/src/utils/UIKitSettings.js @@ -98,7 +98,7 @@ export class UIKitSettings { this.polls = true; this.messageTranslation = true; - this.allowModeratorToDeleteMemberMessages = false; + this.allowModeratorToDeleteMemberMessages = true; this.setGroupInQnaModeByModerators = false; this.highlightMessageFromModerators = false; this.emailReplies = true;