Skip to content

Commit

Permalink
Merge pull request #28 from cometchat-pro/v2.4.0-3
Browse files Browse the repository at this point in the history
V2.4.0 3
  • Loading branch information
TirathBhuva authored Nov 19, 2021
2 parents 0b7746b + d695e61 commit 2631c4d
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 19 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"name": "cometchat-pro-react-native-ui-kit",
"version": "2.4.0-2",
"version": "2.4.0-3",
"description": "Chat UI Kit for React Native App",
"main": "./src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint 'src/**/*.{js,jsx}' --quiet --fix"
},
"repository": {
"type": "git",
"url": "[email protected]:cometchat/react-native.git"
"type": "git"
},
"peerDependencies": {
"react-native-keep-awake": "^4.0.0",
Expand Down
31 changes: 22 additions & 9 deletions src/components/Messages/CometChatMessageActions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 5 additions & 3 deletions src/components/Messages/CometChatMessageThread/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
};

Expand Down Expand Up @@ -646,6 +647,7 @@ class CometChatMessageThread extends React.PureComponent {
return (
<SafeAreaView style={{ flex: 1 }}>
<CometChatMessageActions
type={this.props.type}
open={!!this.state.messageToReact}
message={this.state.messageToReact}
actionGenerated={this.actionHandler}
Expand Down Expand Up @@ -715,8 +717,8 @@ class CometChatMessageThread extends React.PureComponent {
style={[
styles.separatorContainer,
{
borderColor: this.props.theme.backgroundColor
.primary,
borderColor:
this.props.theme.backgroundColor.primary,
},
]}>
{separator}
Expand Down
1 change: 1 addition & 0 deletions src/components/Messages/CometChatMessages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/components/Shared/CometChatSharedMedia/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/components/Users/CometChatUserDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/UIKitSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2631c4d

Please sign in to comment.