aboutsummaryrefslogtreecommitdiff
path: root/src/utils/common.ts
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-04-09 17:15:29 -0400
committerIvan Chen <ivan@tagg.id>2021-04-09 17:15:29 -0400
commit347e9e450268e4897b8dd241721b84945d9e2ec9 (patch)
tree58334be3724398c886365e99901e4442f5657172 /src/utils/common.ts
parent097b515066f1a0c38cb7fb69cf78b16b945594e5 (diff)
parent3ec56863bfdd47b2ee8d0f0fe5a45be779508660 (diff)
Merge branch 'master' into tma756-bugfix-onpress-tagg-on-sp
# Conflicts: # src/components/taggs/TaggsBar.tsx
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r--src/utils/common.ts30
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;
+ }
+};