Skip to content

Commit

Permalink
Merge pull request #9 from cometchat-pro-samples/hotfix-callscreen
Browse files Browse the repository at this point in the history
fixing avatar issue for incoming calls
  • Loading branch information
priyadarshininadar authored Jun 12, 2020
2 parents 4e878fe + df76ead commit 15e24dc
Showing 1 changed file with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,33 +220,19 @@ class CallScreen extends React.PureComponent {
let callScreen = null, iframeScreen, incomingCallScreen, outgoingCallScreen;
if(this.state.showIncomingScreen) {

if(this.props.type === "user" && !this.state.callIProgress.sender.getAvatar()) {
if(!this.state.callIProgress.sender.getAvatar()) {

const uid = this.state.callIProgress.sender.getUid();
const char = this.state.callIProgress.sender.getName().charAt(0).toUpperCase();

this.state.callIProgress.sender.setAvatar(SvgAvatar.getAvatar(uid, char));

} else if(this.props.type === "group" && !this.state.callIProgress.sender.getIcon()) {

const guid = this.state.callIProgress.sender.getGuid();
const char = this.state.callIProgress.sender.getName().charAt(0).toUpperCase();

this.state.callIProgress.sender.setIcon(SvgAvatar.getAvatar(guid, char));
}

let avatar;
if(this.props.type === "user") {
avatar = (<Avatar image={this.state.callIProgress.sender.avatar} />);
} else if(this.props.type === "group") {
avatar = (<Avatar image={this.state.callIProgress.sender.icon} />);
}

incomingCallScreen = (
<div className="cp-incoming-call-screen">
<div className="m-a">Calling...</div>
<div className="m-a cp-call-title">{this.state.callIProgress.sender.name}</div>
<div className="m-a">{avatar}</div>
<div className="m-a"><Avatar image={this.state.callIProgress.sender.avatar} /></div>
<div className="m-a" style={{ display: "flex", width: '25%' }}>
<div className="m-a p-xl cp-accept-button" onClick={this.acceptCall}>ACCEPT</div>
<div className="m-a p-xl cp-reject-button" onClick={() => this.rejectCall(CometChat.CALL_STATUS.REJECTED)}>REJECT</div>
Expand Down

0 comments on commit 15e24dc

Please sign in to comment.