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 loginCometChat = async (id) => { | |
| if (!id) { | |
| return; | |
| } | |
| try { | |
| const user = await cometChat.login(id, `${cometChatConfig.cometChatAuthKey}`); | |
| if (user) { | |
| const authenticatedUser = await getUser(id); | |
| if (authenticatedUser) { | |
| AsyncStorage.setItem('auth', JSON.stringify(authenticatedUser)); |
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 React, { useState, useContext, useEffect } from 'react'; | |
| import { StyleSheet, View, TextInput, TouchableOpacity, Text, ActivityIndicator, Alert, Image } from 'react-native'; | |
| import validator from "validator"; | |
| import AsyncStorage from '@react-native-async-storage/async-storage'; | |
| import Context from "../context"; | |
| import { cometChatConfig } from '../env'; | |
| import { auth, signInWithEmailAndPassword, database, databaseRef, databaseGet, databaseChild } from "../firebase"; |
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
| useEffect(() => { | |
| initCometChat(); | |
| }, []); | |
| const initCometChat = async () => { | |
| const { CometChat } = await import('@cometchat-pro/react-native-chat'); | |
| const appID = `${cometChatConfig.cometChatAppId}`; | |
| const region = `${cometChatConfig.cometChatRegion}`; | |
| const appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build(); | |
| CometChat.init(appID, appSetting).then( |
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 joinCometChatGroup = async ({ guid }) => { | |
| var password = ""; | |
| var groupType = cometChat.GROUP_TYPE.PUBLIC; | |
| await cometChat.joinGroup(guid, groupType, password); | |
| }; |
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 createCometChatGroup = async ({ uid, name }) => { | |
| const groupType = cometChat.GROUP_TYPE.PUBLIC; | |
| const password = ""; | |
| const group = new cometChat.Group(uid, name, groupType, password); | |
| await cometChat.createGroup(group); | |
| }; |
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 logout = async () => { | |
| const isLogout = window.confirm('Do you want to log out ?'); | |
| if (isLogout) { | |
| await cometChat.logout(); | |
| setUser(null); | |
| localStorage.removeItem('auth'); | |
| history.push('/login'); | |
| } | |
| } |
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 startDirectCall = () => { | |
| if (cometChat && meeting) { | |
| const sessionID = meeting.meeting_uid; | |
| const audioOnly = false; | |
| const defaultLayout = true; | |
| const callSettings = new cometChat.CallSettingsBuilder() | |
| .enableDefaultLayout(defaultLayout) | |
| .setSessionID(sessionID) | |
| .setIsAudioOnlyCall(audioOnly) | |
| .build(); |
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 { useEffect, useContext } from 'react'; | |
| import { useHistory } from 'react-router'; | |
| import MeetingHeader from './MeetingHeader'; | |
| import { CometChatMessages } from '../../cometchat-pro-react-ui-kit/CometChatWorkspace/src'; | |
| import Context from '../../context'; | |
| const Meeting = () => { | |
| const { meeting, cometChat } = useContext(Context); |
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 { useHistory } from 'react-router-dom'; | |
| import Context from '../../context'; | |
| function MeetingHeader() { | |
| const { meeting } = useContext(Context); | |
| const history = useHistory(); | |
| const stopMeeting = () => { |
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 axios from 'axios'; | |
| import { useHistory } from 'react-router-dom'; | |
| import Context from '../../context'; | |
| const Join = (props) => { | |
| const { toggleJoin } = props; | |
| const { setIsLoading, setMeeting, cometChat } = useContext(Context); |