Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadarshininadar committed May 26, 2020
1 parent 7f7096f commit 7de35fd
Show file tree
Hide file tree
Showing 129 changed files with 3,791 additions and 3,014 deletions.
46 changes: 16 additions & 30 deletions CometChat/components/Avatar/index.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
import React from "react";
import "./style.scss";

class Avatar extends React.Component {
constructor(props) {
super(props)
this.state = {
src: ""
}

}
static getDerivedStateFromProps(props, state) {
return props;

}

render() {
return (

<span className="cp-avatar-wrapper">
{this.state.src.uid ? ((this.state.src.avatar) ? <img className="cp-avatar" src={this.state.src.avatar} alt="User" /> : <div className="cp-avatar-alternate">{this.state.src.name.charAt(0)}</div>) : ((this.state.src.icon) ? <img className="cp-avatar" src={this.state.src.icon} alt="Group" /> : <div className="cp-avatar-alternate">{this.state.src.name.charAt(0)}</div>)}

</span>

);
}
const avatar = (props) => {

const borderWidth = props.borderWidth || '1px';
const borderColor = props.borderColor || '#AAA';
const cornerRadius = props.cornerRadius || '50%';
const image = props.image;

const getStyle = () => ({borderWidth:borderWidth, borderStyle:'solid',borderColor:borderColor ,'borderRadius': cornerRadius})

return (
<div className="avatar" style={getStyle()}>
<img src={image} alt="Avatar" />
</div>
);

}



export default Avatar;
export const avatar=Avatar;
Avatar.defaultProps = {
src: ""
};
export default avatar;
81 changes: 49 additions & 32 deletions CometChat/components/Avatar/style.scss
Original file line number Diff line number Diff line change
@@ -1,36 +1,53 @@
@import '../../resources/mixins';
@import '../../resources/colors.scss';
@import "../../resources/mixins";
@import "../../resources/colors.scss";

.cp-avatar-wrapper{
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
text-align: center;
background: #ccc;
color: #fff;
white-space: nowrap;
position: relative;
// .cp-avatar-wrapper {
// -webkit-box-sizing: border-box;
// box-sizing: border-box;
// margin: 0;
// padding: 0;
// list-style: none;
// display: inline-block;
// text-align: center;
// background: #ccc;
// color: #fff;
// white-space: nowrap;
// position: relative;
// overflow: hidden;
// vertical-align: middle;
// width: 32px;
// height: 32px;
// line-height: 32px;
// border-radius: 50%;
// margin-top: 4px;
// }
// .cp-avatar {
// width: 100%;
// height: 100%;
// display: block;

// background: $gray-lighten;
// }
// .cp-avatar-alternate {
// font-size: 18px;
// font-weight: 600;
// text-transform: capitalize;
// background-color: $blue-background-primary;
// }

.avatar {
height: 28px;
max-height: 28px;
max-width: 28px;
overflow: hidden;
vertical-align: middle;
width: 32px;
height: 32px;
line-height: 32px;
border-radius: 50%;
margin-top: 4px;
min-width: 28px;
min-height: 28px;
}
.cp-avatar {
width: 100%;
height: 100%;
display: block;

background:$gray-lighten;

.avatar {
img {
max-width: 100%;
max-height: 100%;
min-width: 100%;
}
}
.cp-avatar-alternate{
font-size: 18px;
font-weight: 600;
text-transform: capitalize;
background-color:$blue-background-primary;
}
36 changes: 9 additions & 27 deletions CometChat/components/BadgeCount/index.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
import React from "react";
import "./style.scss";

const badgecount = (props) => {

class BadgeCount extends React.Component {
constructor(props){
super(props)
this.state={
count:""
}
let count = "";

}
static getDerivedStateFromProps(props,state){
return props;

}

render() {
return (
<>
{(this.state.count>0)? <div className="cp-badge-wrapper">
<span className="cp-badge" >{((this.state.count)? this.state.count:"")}</span>
</div>:""}

</>
if(props.count) {
count = (
<div className="cp-badge-wrapper">
<span className="cp-badge">{props.count}</span>
</div>
);
}
return count;
}



export default BadgeCount;
export const badgeCount=BadgeCount;
BadgeCount.defaultProps = {
src:""
};
export default badgecount;
8 changes: 4 additions & 4 deletions CometChat/components/BadgeCount/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '../../resources/mixins';
@import '../../resources/colors.scss';
@import "../../resources/mixins";
@import "../../resources/colors.scss";

.cp-badge-wrapper{
.cp-badge-wrapper {
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
Expand All @@ -19,7 +19,7 @@
border-radius: 50%;
float: right;
}
.cp-badge {
.cp-badge {
width: 100%;
height: 100%;
display: block;
Expand Down
61 changes: 0 additions & 61 deletions CometChat/components/CallMessage/index.js

This file was deleted.

65 changes: 31 additions & 34 deletions CometChat/components/CallScreen/controller.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
import { CometChat } from "@cometchat-pro/chat"
import { CometChat } from "@cometchat-pro/chat";

export class CometChatManager {
import * as enums from '../../util/enums.js';

constructor() {
export class CallScreenManager {

}
isUserLogedIn;
logedInUser;
isCometChatUserLogedIn() {
let timerCounter = 10000;
let timer = 0;
return new Promise((resolve, reject) => {
if (timerCounter === timer) reject();
if (this.logedInUser) { resolve(this.logedInUser); return; }

this.isUserLogedIn = setInterval(() => {
if (CometChat.isInitialized()) {
CometChat.getLoggedinUser().then(user => {
this.logedInUser = user;
clearInterval(this.isUserLogedIn);
resolve(user);
timer = 0;
}, error => {
console.log(error);
})
} else {
}
timer = + 100;
}, 100);
});
}
attachCallListener(callback) {
var listenerID = "UNIQUE_LISTENER_ID";
callListenerId = new Date().getTime();

attachListeners(callback) {

CometChat.addCallListener(
this.callListenerId,
new CometChat.CallListener({
onIncomingCallReceived: call => {
callback(enums.INCOMING_CALL_RECEIVED, call);
},
onOutgoingCallAccepted: call => {
callback(enums.OUTGOING_CALL_ACCEPTED, call);
},
onOutgoingCallRejected: call => {
console.log("[onOutgoingCallRejected]", call)
callback(enums.OUTGOING_CALL_REJECTED, call);
},
onIncomingCallCancelled: call => {
callback(enums.INCOMING_CALL_CANCELLED, call);
}
})
);

}
checkAndSendToCallback(callback, message, isReceipt = false) {
callback(message, isReceipt);
}

removeListeners() {

CometChat.removeCallListener(this.callListenerId);

}
}
Loading

0 comments on commit 7de35fd

Please sign in to comment.