This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useRef, useContext } from "react"; | |
import Context from "../context"; | |
import validator from "validator"; | |
import { auth, realTimeDb } from "../firebase"; | |
import { v4 as uuidv4 } from "uuid"; | |
const SignUp = (props) => { | |
const { toggleModal } = props; | |
const emailRef = useRef(null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
const authKey = `${process.env.REACT_APP_COMETCHAT_AUTH_KEY}`; | |
const user = new cometChat.User(userUuid); | |
user.setName(fullname); | |
user.setAvatar(userAvatar); | |
cometChat.createUser(user, authKey).then( | |
user => { | |
setIsLoading(false); | |
},error => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
const withModal = ModalComponent => WrapperComponent => { | |
return function () { | |
const [isModalShown, setIsModalShown] = useState(false); | |
return ( | |
<> | |
<WrapperComponent toggleModal={setIsModalShown}/> | |
{isModalShown && <ModalComponent toggleModal={setIsModalShown} />} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext } from 'react'; | |
import { CometChatUI } from '../cometchat-pro-react-ui-kit/CometChatWorkspace/src'; | |
import Header from './Header'; | |
import Context from '../context'; | |
const Home = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
buildTextMessage = (receiverId, messageInput, receiverType) => { | |
const textMessage = new CometChat.TextMessage(receiverId, messageInput, receiverType); | |
if (this.props.parentMessageId) { | |
textMessage.setParentMessageId(this.props.parentMessageId); | |
} | |
textMessage.setSender(this.loggedInUser); | |
textMessage.setReceiver(this.context.type); | |
textMessage.setText(messageInput); | |
textMessage._composedAt = getUnixTimestamp(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
const registerEThree = async (eThree, user) => { | |
if (eThree) { | |
try { | |
await eThree.register(); | |
// generate the backup key. | |
if (user && user.keyPassword) { | |
await eThree.backupPrivateKey(user.keyPassword); | |
} | |
} catch (err) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("dotenv").config(); | |
const bodyParser = require("body-parser"); | |
const cors = require("cors"); | |
const express = require("express"); | |
const path = require("path"); | |
const { JwtGenerator } = require('virgil-sdk'); | |
const { initCrypto, VirgilCrypto, VirgilAccessTokenSigner } = require('virgil-crypto'); | |
const PORT = process.env.PORT || 8080; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
async componentDidMount() { | |
... | |
if (this.context.item && this.context.item.guid) { | |
await this.startVirgilGroupChat(); | |
} | |
... | |
} | |
async componentDidUpdate(prevProps, prevState) { | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
getVirgilGroupInstance = async guid => { | |
try { | |
if (guid) { | |
const eThree = this.context.eThree; | |
let group = await eThree.getGroup(guid); | |
if (group) { | |
return group; | |
} | |
const ownerCard = await eThree.findUsers(this.context.item.owner); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
async componentDidMount() { | |
const message = await this.getLastMessage(); | |
... | |
} | |
async componentDidUpdate(prevProps) { | |
... | |
if (previousItem !== currentItem) { | |
const message = await this.getLastMessage(); |