diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-09 18:29:42 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-04-09 18:29:42 -0400 |
commit | 875812fd5674cf183d094f569de4e2a0d1de6693 (patch) | |
tree | 29cfc6a258561e884f8a823d0226a81cd6120e2c /src/utils/common.ts | |
parent | 6527289eb6249cfd057c47d0f797133ab8052339 (diff) | |
parent | a6580f418e87775a5e683e56735952df4f7fa5a9 (diff) |
Merge branch 'master' into tma767-message-button
# Conflicts:
# src/screens/chat/ChatListScreen.tsx
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; + } +}; |