diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-09 16:28:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 16:28:26 -0400 |
commit | 3ec56863bfdd47b2ee8d0f0fe5a45be779508660 (patch) | |
tree | 9c247b84bf6ffee90de6ebf5bac6075640b16263 /src/utils/common.ts | |
parent | fb5cca5bd8aff7232c2ab5e01df0e79dddbef504 (diff) | |
parent | db51757cb968564dbc1554e0f10880eb009db7bc (diff) |
Merge pull request #357 from ankit-thanekar007/tma-771-new-chat-modal
[TMA-771] : Modal for Suggested People
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r-- | src/utils/common.ts | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts index 4f31af8e..0900a084 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -1,14 +1,14 @@ +import AsyncStorage from '@react-native-community/async-storage'; +import moment from 'moment'; +import {Linking} from 'react-native'; +import {getAll} from 'react-native-contacts'; +import {BROWSABLE_SOCIAL_URLS, TOGGLE_BUTTON_TYPE} from '../constants'; import { ContactType, NotificationType, - UniversityType, UniversityBadgeType, + UniversityType, } from './../types/types'; -import moment from 'moment'; -import {Linking} from 'react-native'; -import {BROWSABLE_SOCIAL_URLS, TOGGLE_BUTTON_TYPE} from '../constants'; -import AsyncStorage from '@react-native-community/async-storage'; -import {getAll} from 'react-native-contacts'; export const getToggleButtonText: ( buttonType: string, @@ -173,3 +173,21 @@ const _crestIcon = (university: UniversityType) => { return require('../assets/images/bwbadges.png'); } }; + +export const createChannel = async ( + loggedInUser: string, + id: string, + chatClient: any, +) => { + console.log(loggedInUser, id, chatClient); + try { + const channel = chatClient.channel('messaging', { + members: [loggedInUser, id], + }); + await channel.watch(); + return channel; + } catch (error) { + console.log(error); + throw error; + } +}; |