agora-appbuilder-core 1.0.5 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/template/agora-rn-uikit/.git/config +2 -0
  3. package/template/agora-rn-uikit/.git/hooks/pre-push.sample +9 -9
  4. package/template/agora-rn-uikit/.git/hooks/push-to-checkout.sample +78 -0
  5. package/template/agora-rn-uikit/.git/hooks/update.sample +1 -1
  6. package/template/agora-rn-uikit/.git/index +0 -0
  7. package/template/agora-rn-uikit/.git/logs/HEAD +2 -3
  8. package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -2
  9. package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -1
  10. package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -1
  11. package/template/agora-rn-uikit/.git/objects/pack/{pack-6b07a277da2fea755f96cc77e24b346f9759f650.idx → pack-eb3b4c374d6e79553b5bbcc78b4399cc766e97cf.idx} +0 -0
  12. package/template/agora-rn-uikit/.git/objects/pack/{pack-6b07a277da2fea755f96cc77e24b346f9759f650.pack → pack-eb3b4c374d6e79553b5bbcc78b4399cc766e97cf.pack} +0 -0
  13. package/template/agora-rn-uikit/.git/packed-refs +1 -2
  14. package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -1
  15. package/template/agora-rn-uikit/.git/refs/heads/master +1 -1
  16. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +20 -30
  17. package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +0 -1
  18. package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +0 -1
  19. package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +0 -1
  20. package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +0 -1
  21. package/template/agora-rn-uikit/src/RTCConfigure.tsx +49 -4
  22. package/template/bridge/rtc/webNg/RtcEngine.ts +29 -18
  23. package/template/electron/main/index.js +34 -16
  24. package/template/package.json +7 -5
  25. package/template/src/components/Precall.native.tsx +22 -14
  26. package/template/src/components/Precall.tsx +19 -18
  27. package/template/src/components/Share.tsx +2 -2
  28. package/template/src/components/StorageContext.tsx +2 -0
  29. package/template/src/pages/Create.tsx +17 -14
  30. package/template/src/pages/Join.tsx +11 -29
  31. package/template/src/pages/VideoCall.tsx +68 -49
  32. package/template/src/subComponents/ChatBubble.tsx +13 -13
  33. package/template/src/subComponents/LogoutButton.tsx +1 -1
  34. package/template/src/subComponents/OpenInNativeButton.tsx +1 -1
  35. package/template/webpack.commons.js +1 -0
  36. package/template/agora-rn-uikit/.git/FETCH_HEAD +0 -12
  37. package/template/agora-rn-uikit/.git/ORIG_HEAD +0 -1
  38. package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/ab-dev-auto +0 -1
  39. package/template/agora-rn-uikit/.git/objects/e9/9443e73ee4fde6a17b76813f32a1d1fe5afeef +0 -0
  40. package/template/agora-rn-uikit/.git/refs/remotes/origin/ab-dev-auto +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "1.0.5",
3
+ "version": "1.0.9",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -3,6 +3,8 @@
3
3
  filemode = true
4
4
  bare = false
5
5
  logallrefupdates = true
6
+ ignorecase = true
7
+ precomposeunicode = true
6
8
  [remote "origin"]
7
9
  url = https://github.com/AgoraIO-Community/ReactNative-UIKit
8
10
  fetch = +refs/heads/*:refs/remotes/origin/*
@@ -14,7 +14,7 @@
14
14
  # Information about the commits which are being pushed is supplied as lines to
15
15
  # the standard input in the form:
16
16
  #
17
- # <local ref> <local sha1> <remote ref> <remote sha1>
17
+ # <local ref> <local oid> <remote ref> <remote oid>
18
18
  #
19
19
  # This sample shows how to prevent push of commits where the log message starts
20
20
  # with "WIP" (work in progress).
@@ -22,27 +22,27 @@
22
22
  remote="$1"
23
23
  url="$2"
24
24
 
25
- z40=0000000000000000000000000000000000000000
25
+ zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
26
26
 
27
- while read local_ref local_sha remote_ref remote_sha
27
+ while read local_ref local_oid remote_ref remote_oid
28
28
  do
29
- if [ "$local_sha" = $z40 ]
29
+ if test "$local_oid" = "$zero"
30
30
  then
31
31
  # Handle delete
32
32
  :
33
33
  else
34
- if [ "$remote_sha" = $z40 ]
34
+ if test "$remote_oid" = "$zero"
35
35
  then
36
36
  # New branch, examine all commits
37
- range="$local_sha"
37
+ range="$local_oid"
38
38
  else
39
39
  # Update to existing branch, examine new commits
40
- range="$remote_sha..$local_sha"
40
+ range="$remote_oid..$local_oid"
41
41
  fi
42
42
 
43
43
  # Check for WIP commit
44
- commit=`git rev-list -n 1 --grep '^WIP' "$range"`
45
- if [ -n "$commit" ]
44
+ commit=$(git rev-list -n 1 --grep '^WIP' "$range")
45
+ if test -n "$commit"
46
46
  then
47
47
  echo >&2 "Found WIP commit in $local_ref, not pushing"
48
48
  exit 1
@@ -0,0 +1,78 @@
1
+ #!/bin/sh
2
+
3
+ # An example hook script to update a checked-out tree on a git push.
4
+ #
5
+ # This hook is invoked by git-receive-pack(1) when it reacts to git
6
+ # push and updates reference(s) in its repository, and when the push
7
+ # tries to update the branch that is currently checked out and the
8
+ # receive.denyCurrentBranch configuration variable is set to
9
+ # updateInstead.
10
+ #
11
+ # By default, such a push is refused if the working tree and the index
12
+ # of the remote repository has any difference from the currently
13
+ # checked out commit; when both the working tree and the index match
14
+ # the current commit, they are updated to match the newly pushed tip
15
+ # of the branch. This hook is to be used to override the default
16
+ # behaviour; however the code below reimplements the default behaviour
17
+ # as a starting point for convenient modification.
18
+ #
19
+ # The hook receives the commit with which the tip of the current
20
+ # branch is going to be updated:
21
+ commit=$1
22
+
23
+ # It can exit with a non-zero status to refuse the push (when it does
24
+ # so, it must not modify the index or the working tree).
25
+ die () {
26
+ echo >&2 "$*"
27
+ exit 1
28
+ }
29
+
30
+ # Or it can make any necessary changes to the working tree and to the
31
+ # index to bring them to the desired state when the tip of the current
32
+ # branch is updated to the new commit, and exit with a zero status.
33
+ #
34
+ # For example, the hook can simply run git read-tree -u -m HEAD "$1"
35
+ # in order to emulate git fetch that is run in the reverse direction
36
+ # with git push, as the two-tree form of git read-tree -u -m is
37
+ # essentially the same as git switch or git checkout that switches
38
+ # branches while keeping the local changes in the working tree that do
39
+ # not interfere with the difference between the branches.
40
+
41
+ # The below is a more-or-less exact translation to shell of the C code
42
+ # for the default behaviour for git's push-to-checkout hook defined in
43
+ # the push_to_deploy() function in builtin/receive-pack.c.
44
+ #
45
+ # Note that the hook will be executed from the repository directory,
46
+ # not from the working tree, so if you want to perform operations on
47
+ # the working tree, you will have to adapt your code accordingly, e.g.
48
+ # by adding "cd .." or using relative paths.
49
+
50
+ if ! git update-index -q --ignore-submodules --refresh
51
+ then
52
+ die "Up-to-date check failed"
53
+ fi
54
+
55
+ if ! git diff-files --quiet --ignore-submodules --
56
+ then
57
+ die "Working directory has unstaged changes"
58
+ fi
59
+
60
+ # This is a rough translation of:
61
+ #
62
+ # head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
63
+ if git cat-file -e HEAD 2>/dev/null
64
+ then
65
+ head=HEAD
66
+ else
67
+ head=$(git hash-object -t tree --stdin </dev/null)
68
+ fi
69
+
70
+ if ! git diff-index --quiet --cached --ignore-submodules $head --
71
+ then
72
+ die "Working directory has staged changes"
73
+ fi
74
+
75
+ if ! git read-tree -u -m "$commit"
76
+ then
77
+ die "Could not update working tree to new HEAD"
78
+ fi
@@ -60,7 +60,7 @@ esac
60
60
 
61
61
  # --- Check types
62
62
  # if $newrev is 0000...0000, it's a commit to delete a ref.
63
- zero="0000000000000000000000000000000000000000"
63
+ zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
64
64
  if [ "$newrev" = "$zero" ]; then
65
65
  newrev_type=delete
66
66
  else
Binary file
@@ -1,3 +1,2 @@
1
- 0000000000000000000000000000000000000000 30bbdd42f695d3add04a63a23ef86056d1a09536 technophilic <svineth.face@gmail.com> 1625683680 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
2
- 30bbdd42f695d3add04a63a23ef86056d1a09536 b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c technophilic <svineth.face@gmail.com> 1625683680 +0530 checkout: moving from master to ab-dev-auto
3
- b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c e99443e73ee4fde6a17b76813f32a1d1fe5afeef technophilic <svineth.face@gmail.com> 1625683950 +0530 pull: Fast-forward
1
+ 0000000000000000000000000000000000000000 e1b2bbb0f7d64b69fa51f508c170554f6286cd47 Nitesh Tiwari <niteshtiwari@Niteshs-MacBook-Pro.local> 1624265347 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
2
+ e1b2bbb0f7d64b69fa51f508c170554f6286cd47 b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c Nitesh Tiwari <niteshtiwari@Niteshs-MacBook-Pro.local> 1624265347 +0530 checkout: moving from master to ab-dev-auto
@@ -1,2 +1 @@
1
- 0000000000000000000000000000000000000000 b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c technophilic <svineth.face@gmail.com> 1625683680 +0530 branch: Created from refs/remotes/origin/ab-dev-auto
2
- b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c e99443e73ee4fde6a17b76813f32a1d1fe5afeef technophilic <svineth.face@gmail.com> 1625683950 +0530 pull: Fast-forward
1
+ 0000000000000000000000000000000000000000 b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c Nitesh Tiwari <niteshtiwari@Niteshs-MacBook-Pro.local> 1624265347 +0530 branch: Created from refs/remotes/origin/ab-dev-auto
@@ -1 +1 @@
1
- 0000000000000000000000000000000000000000 30bbdd42f695d3add04a63a23ef86056d1a09536 technophilic <svineth.face@gmail.com> 1625683680 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
1
+ 0000000000000000000000000000000000000000 e1b2bbb0f7d64b69fa51f508c170554f6286cd47 Nitesh Tiwari <niteshtiwari@Niteshs-MacBook-Pro.local> 1624265347 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
@@ -1 +1 @@
1
- 0000000000000000000000000000000000000000 30bbdd42f695d3add04a63a23ef86056d1a09536 technophilic <svineth.face@gmail.com> 1625683680 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
1
+ 0000000000000000000000000000000000000000 e1b2bbb0f7d64b69fa51f508c170554f6286cd47 Nitesh Tiwari <niteshtiwari@Niteshs-MacBook-Pro.local> 1624265347 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
@@ -5,9 +5,8 @@ c60cde905c722aeaf8f25aeed2910a7b4d532cfa refs/remotes/origin/app-builder-dev
5
5
  c3084102c3b83267b76df578782ce5d76acd569c refs/remotes/origin/button-label
6
6
  5d4f38ae0a89b20275e2497a4e8f43b0ca2830e4 refs/remotes/origin/dev
7
7
  4ec093e51924049e37d247d867a5482a9376a8cf refs/remotes/origin/docs
8
- 30bbdd42f695d3add04a63a23ef86056d1a09536 refs/remotes/origin/master
8
+ e1b2bbb0f7d64b69fa51f508c170554f6286cd47 refs/remotes/origin/master
9
9
  3cb1e8211cd3ba448c79b49e4bb0c9d94b1552b3 refs/remotes/origin/precall-prop
10
10
  76f6cbd3b6769bd271867bd026f02d98ba2cf99a refs/remotes/origin/react-native-0.64.2
11
- c3e27c600ae55f4aeb05ee4666cdf084fd28e9f3 refs/remotes/origin/redo-deps
12
11
  ac8929fda04db3663a7c1eb9c71ca6a97728f0eb refs/remotes/origin/v2-legacy
13
12
  200e7d04395d72405cea8162ffe8f7e665d2ee9c refs/remotes/origin/v3-ts
@@ -1 +1 @@
1
- e99443e73ee4fde6a17b76813f32a1d1fe5afeef
1
+ b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c
@@ -1 +1 @@
1
- 30bbdd42f695d3add04a63a23ef86056d1a09536
1
+ e1b2bbb0f7d64b69fa51f508c170554f6286cd47
@@ -5,8 +5,6 @@ import {
5
5
  StyleProp,
6
6
  TouchableOpacityProps,
7
7
  ViewStyle,
8
- Text,
9
- View,
10
8
  } from 'react-native';
11
9
  import PropsContext from './../PropsContext';
12
10
  import styles from '../Style';
@@ -17,7 +15,6 @@ interface BtnTemplateInterface {
17
15
  color?: string;
18
16
  onPress?: TouchableOpacityProps['onPress'];
19
17
  style?: StyleProp<ViewStyle>;
20
- btnText?: string;
21
18
  }
22
19
 
23
20
  const BtnTemplate: React.FC<BtnTemplateInterface> = (props) => {
@@ -25,37 +22,30 @@ const BtnTemplate: React.FC<BtnTemplateInterface> = (props) => {
25
22
  const {BtnTemplateStyles, theme} = styleProps || {};
26
23
 
27
24
  return (
28
- <TouchableOpacity onPress={props.onPress}>
29
- <View
25
+ <TouchableOpacity
26
+ style={{
27
+ ...styles.controlBtn,
28
+ ...(BtnTemplateStyles as object),
29
+ ...(props.style as object),
30
+ }}
31
+ // onPress={props.onPress}
32
+ onPress={() => {
33
+ console.log('pressed mute')
34
+ props.onPress()
35
+ }}
36
+ >
37
+ <Image
30
38
  style={{
31
- ...styles.controlBtn,
32
- ...(BtnTemplateStyles as object),
33
- ...(props.style as object),
34
- }}>
35
- <Image
36
- style={{
37
- width: '100%',
38
- height: '100%',
39
- tintColor:
40
- props.name !== 'callEnd'
41
- ? theme || props.color || '#fff'
42
- : '#FD0845',
43
- }}
44
- resizeMode={'contain'}
45
- source={{uri: icons[props.name]}}
46
- />
47
- </View>
48
- <Text
49
- style={{
50
- textAlign: 'center',
51
- marginTop: 5,
52
- color:
39
+ width: '100%',
40
+ height: '100%',
41
+ tintColor:
53
42
  props.name !== 'callEnd'
54
43
  ? theme || props.color || '#fff'
55
44
  : '#FD0845',
56
- }}>
57
- {props.btnText}
58
- </Text>
45
+ }}
46
+ resizeMode={'contain'}
47
+ source={{uri: icons[props.name]}}
48
+ />
59
49
  </TouchableOpacity>
60
50
  );
61
51
  };
@@ -13,7 +13,6 @@ function EndCall() {
13
13
  return (
14
14
  <BtnTemplate
15
15
  name={'callEnd'}
16
- btnText={'Hang Up'}
17
16
  style={{...styles.endCall, ...(endCall as object)}}
18
17
  onPress={() =>
19
18
  (dispatch as DispatchType<'EndCall'>)({
@@ -15,7 +15,6 @@ function LocalAudioMute() {
15
15
  return (
16
16
  <BtnTemplate
17
17
  name={local.audio ? 'mic' : 'micOff'}
18
- btnText={'Audio'}
19
18
  style={{...styles.localBtn, ...(muteLocalAudio as object)}}
20
19
  onPress={() => {
21
20
  (dispatch as DispatchType<'LocalMuteAudio'>)({
@@ -15,7 +15,6 @@ function LocalVideoMute() {
15
15
  return (
16
16
  <BtnTemplate
17
17
  name={local.video ? 'videocam' : 'videocamOff'}
18
- btnText={'Video'}
19
18
  style={{...styles.localBtn, ...(muteLocalVideo as object)}}
20
19
  onPress={() => {
21
20
  (dispatch as DispatchType<'LocalMuteVideo'>)({
@@ -13,7 +13,6 @@ function SwitchCamera() {
13
13
  <BtnTemplate
14
14
  name={'switchCamera'}
15
15
  style={{...styles.localBtn, ...(switchCamera as object)}}
16
- btnText={'Switch'}
17
16
  onPress={() => {
18
17
  // RtcEngine.switchCamera();
19
18
  (dispatch as DispatchType<'SwitchCamera'>)({
@@ -201,6 +201,7 @@ const RtcConfigure: React.FC<Partial<RtcPropsInterface>> = (props) => {
201
201
  };
202
202
  break;
203
203
  case 'LocalMuteVideo':
204
+ console.log('Switch: Local mute video', {value: action.value}, {state});
204
205
  (engine.current as RtcEngine).muteLocalVideoStream(
205
206
  (action as ActionType<'LocalMuteAudio'>).value[0],
206
207
  );
@@ -307,6 +308,49 @@ const RtcConfigure: React.FC<Partial<RtcPropsInterface>> = (props) => {
307
308
  },
308
309
  [dualStreamMode],
309
310
  );
311
+
312
+ const getRemoteVolume = () => {
313
+ console.log('getting remote user track');
314
+ // console.log(engine.current.client.remoteUsers);
315
+ const client = engine?.current?.client;
316
+ if (client) {
317
+ const {remoteUsers} = client;
318
+
319
+ const userVolume = remoteUsers.map(
320
+ (remoteUser: {uid: any; audioTrack: any; hasAudio: boolean}) => {
321
+ const {uid, audioTrack, hasAudio} = remoteUser;
322
+ console.log({remoteUser}, {hasAudio});
323
+ return {
324
+ uid,
325
+ volumeLevel: hasAudio ? audioTrack.getVolumeLevel() : 0,
326
+ };
327
+ },
328
+ );
329
+ console.log({userVolume});
330
+ const highestvolumeObj = volumes.reduce(
331
+ (highestVolume, volume, index) => {
332
+ if (highestVolume === null) {
333
+ return volume;
334
+ } else {
335
+ if (volume.level > highestVolume.level) {
336
+ return volume;
337
+ }
338
+ return highestVolume;
339
+ }
340
+ // console.log(`${index} UID ${volume.uid} Level ${volume.level}`);
341
+ },
342
+ null,
343
+ );
344
+ const activeSpeaker = highestvolumeObj ? highestvolumeObj.uid : undefined;
345
+ }
346
+ };
347
+ // useEffect(() => {
348
+ // const timer = setInterval(getRemoteVolume, 1000);
349
+ // return () => {
350
+ // clearInterval(timer);
351
+ // };
352
+ // }, []);
353
+
310
354
  const [uidState, dispatch] = useReducer(reducer, initialState);
311
355
 
312
356
  // When mode is updated, reducer is triggered to update the individual states
@@ -460,20 +504,21 @@ const RtcConfigure: React.FC<Partial<RtcPropsInterface>> = (props) => {
460
504
  });
461
505
  }
462
506
  if (engine.current) {
463
- if(uidState.max[0].video){
507
+ if (uidState.max[0].video) {
508
+ console.log('another place 1');
464
509
  await engine.current.muteLocalVideoStream(true);
465
510
  }
466
-
511
+
467
512
  await engine.current.joinChannel(
468
513
  rtcProps.token || null,
469
514
  rtcProps.channel,
470
515
  null,
471
516
  rtcProps.uid || 0,
472
517
  );
473
- if(uidState.max[0].video){
518
+ if (uidState.max[0].video) {
519
+ console.log('another place 2');
474
520
  await engine.current.muteLocalVideoStream(false);
475
521
  }
476
-
477
522
  } else {
478
523
  console.error('trying to join before RTC Engine was initialized');
479
524
  }
@@ -1,12 +1,12 @@
1
1
  /*
2
2
  ********************************************
3
3
  Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
4
+ AppBuilder and all associated components, source code, APIs, services, and documentation
5
+ (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
+ accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
+ Use without a license or in violation of any license terms and conditions (including use for
8
+ any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
+ information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
12
  import AgoraRTC, {
@@ -168,6 +168,7 @@ export default class RtcEngine {
168
168
  private isVideoPublished = false;
169
169
  private isJoined = false;
170
170
  private deviceId = '';
171
+ private muteLocalVideoMutex = false;
171
172
 
172
173
  constructor(appId: string) {
173
174
  this.appId = appId;
@@ -451,13 +452,27 @@ export default class RtcEngine {
451
452
  }
452
453
 
453
454
  async muteLocalVideoStream(muted: boolean): Promise<void> {
455
+ let didProcureMutexLock = false;
454
456
  try {
455
- await this.localStream.video?.setEnabled(!muted);
456
- this.isVideoEnabled = !muted;
457
- if (!muted && !this.isVideoPublished) {
458
- await this.publish();
457
+ if (!this.muteLocalVideoMutex) {
458
+ // If there no mutex lock, procure a lock
459
+ this.muteLocalVideoMutex = true;
460
+ didProcureMutexLock = true;
461
+ await this.localStream.video?.setEnabled(!muted);
462
+ // Release the lock once done
463
+ this.muteLocalVideoMutex = false;
464
+
465
+ this.isVideoEnabled = !muted;
466
+ if (!muted && !this.isVideoPublished) {
467
+ await this.publish();
468
+ }
459
469
  }
460
470
  } catch (e) {
471
+ // If the function procures the mutex,
472
+ // but if mute throws an error, the lock won't be released
473
+ if (didProcureMutexLock) {
474
+ this.muteLocalVideoMutex = false;
475
+ }
461
476
  console.error(
462
477
  e,
463
478
  '\n Be sure to invoke the enableVideo method before using this method.',
@@ -498,24 +513,20 @@ export default class RtcEngine {
498
513
  error(e);
499
514
  }
500
515
  }
501
-
516
+
502
517
  async switchCamera(): Promise<void> {
503
518
  try {
504
519
  const devices = await AgoraRTC.getDevices(true);
505
- // console.log(devices);
506
- for(let i=0; i< devices.length;i++){
520
+ for (let i = 0; i < devices.length; i++) {
507
521
  let d = devices[i];
508
- // console.log('!',d.label);
509
- if(d.kind === 'videoinput' && d.deviceId !== this.deviceId){
510
- console.log('!this',this.deviceId, '!new', d.deviceId);
522
+ if (d.kind === 'videoinput' && d.deviceId !== this.deviceId) {
511
523
  await this.localStream.video?.setDevice(d.deviceId);
512
524
  this.deviceId = d.deviceId;
513
- // await this.changeCamera(d.deviceId, ()=>{}, ()=>{});
514
525
  break;
515
526
  }
516
527
  }
517
528
  } catch (e) {
518
- throw (e);
529
+ throw e;
519
530
  }
520
531
  }
521
532
 
@@ -62,24 +62,42 @@ autoUpdater.on('update-downloaded', (info) => {
62
62
  });
63
63
 
64
64
  const createWindow = () => {
65
- let template = [];
66
65
  const name = app.getName();
67
- template.unshift({
68
- label: name,
69
- submenu: [
70
- {
71
- label: 'About ' + name,
72
- role: 'about',
73
- },
74
- {
75
- label: 'Quit',
76
- accelerator: 'Command+Q',
77
- click() {
78
- app.quit();
66
+ const template = [
67
+ {
68
+ label: name,
69
+ submenu: [
70
+ {
71
+ label: 'About ' + name,
72
+ role: 'about',
79
73
  },
80
- },
81
- ],
82
- });
74
+ {type: 'separator'},
75
+ {
76
+ label: 'Quit',
77
+ accelerator: 'Command+Q',
78
+ click() {
79
+ app.quit();
80
+ },
81
+ },
82
+ ],
83
+ },
84
+ {
85
+ label: 'Edit',
86
+ submenu: [
87
+ {label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:'},
88
+ {label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:'},
89
+ {type: 'separator'},
90
+ {label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:'},
91
+ {label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:'},
92
+ {label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:'},
93
+ {
94
+ label: 'Select All',
95
+ accelerator: 'CmdOrCtrl+A',
96
+ selector: 'selectAll:',
97
+ },
98
+ ],
99
+ },
100
+ ];
83
101
  autoUpdater.checkForUpdatesAndNotify();
84
102
  const menu = Menu.buildFromTemplate(template);
85
103
  Menu.setApplicationMenu(menu);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "HelloWorld",
3
- "version": "0.1.3",
3
+ "version": "1.0.1",
4
4
  "private": true,
5
5
  "main": ".electron/index.js",
6
6
  "scripts": {
@@ -49,7 +49,7 @@
49
49
  "@sentry/react-native": "2.4.3",
50
50
  "@sentry/tracing": "6.2.1",
51
51
  "agora-react-native-rtm": "1.2.2-alpha.3",
52
- "agora-rtc-sdk-ng": "4.5.0",
52
+ "agora-rtc-sdk-ng": "4.6.3",
53
53
  "agora-rtm-sdk": "1.4.3",
54
54
  "electron-log": "^4.3.5",
55
55
  "electron-squirrel-startup": "1.0.0",
@@ -59,7 +59,7 @@
59
59
  "react": "16.13.1",
60
60
  "react-dom": "16.13.1",
61
61
  "react-native": "0.63.3",
62
- "react-native-agora": "3.1.7-appbuilder.0",
62
+ "react-native-agora": "3.4.2",
63
63
  "react-native-hyperlink": "0.0.19",
64
64
  "react-native-inappbrowser-reborn": "3.5.1",
65
65
  "react-native-keep-awake": "4.0.0",
@@ -70,11 +70,13 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@babel/core": "7.14.3",
73
+ "@babel/plugin-proposal-class-properties": "7.14.5",
74
+ "@babel/plugin-proposal-optional-chaining": "^7.16.0",
73
75
  "@babel/preset-env": "7.14.4",
74
76
  "@babel/preset-react": "7.13.13",
75
77
  "@babel/preset-typescript": "7.13.0",
76
78
  "@babel/runtime": "7.14.0",
77
- "@bam.tech/react-native-make": "3.0.0",
79
+ "@bam.tech/react-native-make": "3.0.3",
78
80
  "@pmmmwh/react-refresh-webpack-plugin": "0.3.3",
79
81
  "@react-native-community/eslint-config": "1.1.0",
80
82
  "@types/jest": "25.2.3",
@@ -91,7 +93,7 @@
91
93
  "babel-plugin-transform-define": "2.0.0",
92
94
  "cross-env": "7.0.3",
93
95
  "del": "5.1.0",
94
- "electron": "5.0.8",
96
+ "electron": "16.0.1",
95
97
  "electron-builder": "22.10.5",
96
98
  "electron-notarize": "1.0.0",
97
99
  "eslint": "6.8.0",
@@ -46,24 +46,29 @@ const Precall = (props: any) => {
46
46
  <View style={style.heading}>
47
47
  <Text style={style.headingText}>Precall </Text>
48
48
  </View>
49
- <View style={{zIndex: 50, position: 'absolute', width: '100%', left: '18%', top: 10, alignSelf: 'center'}}>
49
+ <View
50
+ style={{
51
+ zIndex: 50,
52
+ position: 'absolute',
53
+ width: '100%',
54
+ left: '18%',
55
+ top: 10,
56
+ alignSelf: 'center',
57
+ }}>
50
58
  {error ? <Error error={error} showBack={true} /> : <></>}
51
59
  </View>
52
60
  <View style={style.full}>
53
61
  <MaxVideoView user={maxUsers[0]} key={maxUsers[0].uid} />
54
62
  </View>
55
63
  {Platform.OS === 'ios' ? (
56
- <View
57
- style={style.textInputHolder}>
64
+ <View style={style.textInputHolder}>
58
65
  <TextInput
59
66
  value={username}
60
67
  onChangeText={(text) => {
61
- if (username !== 'Getting name...') {
62
- setUsername(text);
63
- }
68
+ setUsername(text);
64
69
  }}
65
70
  onSubmitEditing={() => {}}
66
- placeholder="Display Name"
71
+ placeholder={queryComplete ? 'Display name*' : 'Getting name...'}
67
72
  />
68
73
  </View>
69
74
  ) : (
@@ -71,12 +76,11 @@ const Precall = (props: any) => {
71
76
  <TextInput
72
77
  value={username}
73
78
  onChangeText={(text) => {
74
- if (username !== 'Getting name...') {
75
- setUsername(text);
76
- }
79
+ setUsername(text);
77
80
  }}
78
81
  onSubmitEditing={() => {}}
79
- placeholder="Display Name"
82
+ placeholder={queryComplete ? 'Display name*' : 'Getting name...'}
83
+ editable={queryComplete}
80
84
  />
81
85
  </View>
82
86
  )}
@@ -95,10 +99,14 @@ const Precall = (props: any) => {
95
99
  // disabled={!queryComplete}
96
100
  style={{marginBottom: 50}}>
97
101
  {/* <Text style={style.buttonText}> */}
98
- {/* {queryComplete ? 'Join Room' : 'Loading...'} */}
102
+ {/* {queryComplete ? 'Join Room' : 'Loading...'} */}
99
103
  {/* </Text> */}
100
- {/* </TouchableOpacity> */}
101
- <PrimaryButton text={"Join Room"} disabled={!queryComplete} onPress={() => setCallActive(true)} />
104
+ {/* </TouchableOpacity> */}
105
+ <PrimaryButton
106
+ text={'Join Room'}
107
+ disabled={!queryComplete || username.trim() === ''}
108
+ onPress={() => setCallActive(true)}
109
+ />
102
110
  </View>
103
111
  {/* </ImageBackground> */}
104
112
  </View>
@@ -10,13 +10,7 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {useState, useContext} from 'react';
13
- import {
14
- View,
15
- Text,
16
- StyleSheet,
17
- Dimensions,
18
- Platform,
19
- } from 'react-native';
13
+ import {View, Text, StyleSheet, Dimensions, Platform} from 'react-native';
20
14
  import TextInput from '../atoms/TextInput';
21
15
  import PrimaryButton from '../atoms/PrimaryButton';
22
16
  import {MaxUidConsumer} from '../../agora-rn-uikit/src/MaxUidContext';
@@ -39,6 +33,7 @@ const Precall = (props: any) => {
39
33
  Dimensions.get('window').height,
40
34
  Dimensions.get('window').width > Dimensions.get('window').height,
41
35
  ]);
36
+
42
37
  let onLayout = (e: any) => {
43
38
  setDim([e.nativeEvent.layout.width, e.nativeEvent.layout.height]);
44
39
  };
@@ -94,17 +89,18 @@ const Precall = (props: any) => {
94
89
  <TextInput
95
90
  value={username}
96
91
  onChangeText={(text) => {
97
- if (username !== 'Getting name...') {
98
- setUsername(text);
99
- }
92
+ setUsername(text);
100
93
  }}
101
94
  onSubmitEditing={() => {}}
102
- placeholder="Display Name"
95
+ placeholder={
96
+ queryComplete ? 'Display name*' : 'Getting name...'
97
+ }
98
+ editable={queryComplete}
103
99
  />
104
100
  <View style={style.margin5Btm} />
105
101
  <PrimaryButton
106
102
  onPress={() => setCallActive(true)}
107
- disabled={!queryComplete}
103
+ disabled={!queryComplete || username.trim() === ''}
108
104
  text={queryComplete ? 'Join Room' : 'Loading...'}
109
105
  />
110
106
  </View>
@@ -140,7 +136,11 @@ const Precall = (props: any) => {
140
136
  </Text>
141
137
  {/* </View> */}
142
138
  <View style={{height: 20}} />
143
- <View style={{flex: 1, maxWidth: Platform.OS === 'web'? '25vw' : 'auto'}}>
139
+ <View
140
+ style={{
141
+ flex: 1,
142
+ maxWidth: Platform.OS === 'web' ? '25vw' : 'auto',
143
+ }}>
144
144
  <SelectDevice />
145
145
  </View>
146
146
  <View
@@ -154,17 +154,18 @@ const Precall = (props: any) => {
154
154
  <TextInput
155
155
  value={username}
156
156
  onChangeText={(text) => {
157
- if (username !== 'Getting name...') {
158
- setUsername(text);
159
- }
157
+ setUsername(text);
160
158
  }}
161
159
  onSubmitEditing={() => {}}
162
- placeholder="Display Name"
160
+ placeholder={
161
+ queryComplete ? 'Display name*' : 'Getting name...'
162
+ }
163
+ editable={queryComplete}
163
164
  />
164
165
  <View style={{height: 20}} />
165
166
  <PrimaryButton
166
167
  onPress={() => setCallActive(true)}
167
- disabled={!queryComplete}
168
+ disabled={!queryComplete || username.trim() === ''}
168
169
  text={queryComplete ? 'Join Room' : 'Loading...'}
169
170
  />
170
171
  </View>
@@ -143,7 +143,7 @@ PSTN Pin: ${pstn.dtmf}`)
143
143
  </View>
144
144
  <View style={{ marginLeft: 'auto', flexDirection: 'row', alignSelf: 'center' }}>
145
145
  <View style={{ backgroundColor: $config.PRIMARY_COLOR + '80', width: 1, height: 'auto', marginRight: 15 }} />
146
- <TouchableOpacity style={{ width: 40, height: 40, marginVertical: 'auto' }} onPress={()=>copyHostUrl()}>
146
+ <TouchableOpacity style={{ width: 40, height: 40, marginVertical: 'auto' }} onPress={()=>copyAttendeeURL()}>
147
147
  <Image resizeMode={'contain'}
148
148
  style={{ width: '100%', height: '100%', tintColor: $config.PRIMARY_COLOR, opacity: 0.5}}
149
149
  source={{ uri: icons.clipboard }}></Image>
@@ -173,7 +173,7 @@ PSTN Pin: ${pstn.dtmf}`)
173
173
  </View>
174
174
  <View style={{ marginLeft: 'auto', flexDirection: 'row', alignSelf: 'center' }}>
175
175
  <View style={{ backgroundColor: $config.PRIMARY_COLOR + '80', width: 1, height: 'auto', marginRight: 15 }} />
176
- <TouchableOpacity style={{ width: 40, height: 40, marginVertical: 'auto' }} onPress={()=>copyAttendeeURL()}>
176
+ <TouchableOpacity style={{ width: 40, height: 40, marginVertical: 'auto' }} onPress={()=>copyHostUrl()}>
177
177
  <Image resizeMode={'contain'}
178
178
  style={{ width: '100%', height: '100%', tintColor: $config.PRIMARY_COLOR, opacity: 0.5}}
179
179
  source={{ uri: icons.clipboard }}></Image>
@@ -15,6 +15,7 @@ import useMount from './useMount';
15
15
 
16
16
  interface StoreInterface {
17
17
  token: null | string;
18
+ displayName: null | string;
18
19
  }
19
20
 
20
21
  interface StorageContextInterface {
@@ -24,6 +25,7 @@ interface StorageContextInterface {
24
25
 
25
26
  const initStoreValue: StoreInterface = {
26
27
  token: null,
28
+ displayName: '',
27
29
  };
28
30
 
29
31
  const initStorageContextValue = {
@@ -10,12 +10,7 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {useState} from 'react';
13
- import {
14
- View,
15
- Text,
16
- StyleSheet,
17
- Dimensions,
18
- } from 'react-native';
13
+ import {View, Text, StyleSheet, Dimensions, ScrollView} from 'react-native';
19
14
  import {useHistory} from '../components/Router';
20
15
  import Checkbox from '../subComponents/Checkbox';
21
16
  import {gql, useMutation} from '@apollo/client';
@@ -38,8 +33,16 @@ type PasswordInput = {
38
33
  };
39
34
 
40
35
  const CREATE_CHANNEL = gql`
41
- mutation CreateChannel($title: String!, $backendURL: String!, $enablePSTN: Boolean) {
42
- createChannel(title: $title, backendURL: $backendURL, enablePSTN: $enablePSTN) {
36
+ mutation CreateChannel(
37
+ $title: String!
38
+ $backendURL: String!
39
+ $enablePSTN: Boolean
40
+ ) {
41
+ createChannel(
42
+ title: $title
43
+ backendURL: $backendURL
44
+ enablePSTN: $enablePSTN
45
+ ) {
43
46
  passphrase {
44
47
  host
45
48
  view
@@ -111,7 +114,7 @@ const Create = () => {
111
114
  // style={style.full}
112
115
  // resizeMode={'cover'}>
113
116
  // <KeyboardAvoidingView behavior={'height'} style={style.main}>
114
- <View style={style.main}>
117
+ <ScrollView contentContainerStyle={style.main}>
115
118
  <View style={style.nav}>
116
119
  <Logo />
117
120
  {error ? <Error error={error} /> : <></>}
@@ -179,17 +182,17 @@ const Create = () => {
179
182
  roomTitle={roomTitle}
180
183
  />
181
184
  )}
182
- </View>
185
+ </ScrollView>
183
186
  );
184
187
  };
185
188
 
186
189
  const style = StyleSheet.create({
187
- full: {flex: 1},
188
190
  main: {
189
- flex: 2,
190
- justifyContent: 'space-evenly',
191
+ paddingVertical: '8%',
191
192
  marginHorizontal: '8%',
192
- marginVertical: '2%',
193
+ display: 'flex',
194
+ justifyContent: 'space-evenly',
195
+ flexGrow: 1,
193
196
  },
194
197
  nav: {
195
198
  flex: 1,
@@ -10,11 +10,7 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {useContext, useState} from 'react';
13
- import {
14
- View,
15
- Text,
16
- StyleSheet,
17
- } from 'react-native';
13
+ import {View, Text, StyleSheet, ScrollView} from 'react-native';
18
14
  import {useHistory} from '../components/Router';
19
15
  import SessionContext from '../components/SessionContext';
20
16
  // import OpenInNativeButton from '../subComponents/OpenInNativeButton';
@@ -38,8 +34,9 @@ const Join = (props: joinProps) => {
38
34
  const history = useHistory();
39
35
  const {primaryColor} = useContext(ColorContext);
40
36
  const {joinSession} = useContext(SessionContext);
41
- const [error, setError] =
42
- useState<null | {name: string; message: string}>(null);
37
+ const [error, setError] = useState<null | {name: string; message: string}>(
38
+ null,
39
+ );
43
40
  // const [dim, setDim] = useState([
44
41
  // Dimensions.get('window').width,
45
42
  // Dimensions.get('window').height,
@@ -57,18 +54,12 @@ const Join = (props: joinProps) => {
57
54
  const startCall = async () => {
58
55
  joinSession({phrase});
59
56
  };
60
- // throw new Error("My first Sentry error!");
57
+
61
58
  return (
62
- // <ImageBackground
63
- // // onLayout={onLayout}
64
- // style={style.full}
65
- // resizeMode={'cover'}>
66
- <View style={style.main}>
67
- {/* <KeyboardAvoidingView behavior={'height'} style={style.main}> */}
59
+ <ScrollView contentContainerStyle={style.main}>
68
60
  <View style={style.nav}>
69
61
  <Logo />
70
62
  {error ? <Error error={error} /> : <></>}
71
- {/* <OpenInNativeButton /> */}
72
63
  </View>
73
64
  <View style={style.content}>
74
65
  <View style={style.leftContent}>
@@ -99,28 +90,19 @@ const Join = (props: joinProps) => {
99
90
  )}
100
91
  </View>
101
92
  </View>
102
- {/* {dim[0] > dim[1] + 150 ? (
103
- <View style={style.full}>
104
- <Illustration />
105
- </View>
106
- ) : (
107
- <></>
108
- )} */}
109
93
  </View>
110
- {/* </KeyboardAvoidingView> */}
111
- </View>
112
- // </ImageBackground>
94
+ </ScrollView>
113
95
  );
114
96
  };
115
97
 
116
98
  const style = StyleSheet.create({
117
- full: {flex: 1},
118
99
  illustration: {flex: 1, alignSelf: 'flex-end'},
119
100
  main: {
120
- flex: 2,
121
- justifyContent: 'space-evenly',
101
+ paddingVertical: '8%',
122
102
  marginHorizontal: '8%',
123
- marginVertical: '2%',
103
+ display: 'flex',
104
+ justifyContent: 'space-evenly',
105
+ flexGrow: 1,
124
106
  },
125
107
  nav: {
126
108
  flex: 1,
@@ -65,7 +65,8 @@ const useChatNotification = (
65
65
  };
66
66
 
67
67
  const NotificationControl = ({children, chatDisplayed, setSidePanel}) => {
68
- const {messageStore, privateMessageStore, userList, localUid} = useContext(ChatContext);
68
+ const {messageStore, privateMessageStore, userList, localUid} =
69
+ useContext(ChatContext);
69
70
  const [
70
71
  lastCheckedPublicState,
71
72
  setLastCheckedPublicState,
@@ -116,8 +117,13 @@ const NotificationControl = ({children, chatDisplayed, setSidePanel}) => {
116
117
  messageStore[messageStore.length - 1]?.uid !== localUid
117
118
  ) {
118
119
  Toast.show({
119
- text1: messageStore[messageStore.length - 1]?.msg.length > 50 ? messageStore[messageStore.length - 1]?.msg.slice(1, 50) + '...' : messageStore[messageStore.length - 1]?.msg.slice(1),
120
- text2: userList[messageStore[messageStore.length - 1]?.uid] ? 'From: ' + userList[messageStore[messageStore.length - 1]?.uid].name : '',
120
+ text1:
121
+ messageStore[messageStore.length - 1]?.msg.length > 50
122
+ ? messageStore[messageStore.length - 1]?.msg.slice(1, 50) + '...'
123
+ : messageStore[messageStore.length - 1]?.msg.slice(1),
124
+ text2: userList[messageStore[messageStore.length - 1]?.uid]
125
+ ? 'From: ' + userList[messageStore[messageStore.length - 1]?.uid].name
126
+ : '',
121
127
  visibilityTime: 1000,
122
128
  onPress: () => {
123
129
  setSidePanel(SidePanelType.Chat);
@@ -212,8 +218,10 @@ enum RnEncryptionEnum {
212
218
  }
213
219
 
214
220
  const VideoCall: React.FC = () => {
215
- const {store} = useContext(StorageContext);
216
- const [username, setUsername] = useState('Getting name...');
221
+ const {store, setStore} = useContext(StorageContext);
222
+ const getInitialUsername = () =>
223
+ store?.displayName ? store.displayName : '';
224
+ const [username, setUsername] = useState(getInitialUsername);
217
225
  const [participantsView, setParticipantsView] = useState(false);
218
226
  const [callActive, setCallActive] = useState($config.PRECALL ? false : true);
219
227
  const [layout, setLayout] = useState(Layout.Grid);
@@ -223,9 +231,9 @@ const VideoCall: React.FC = () => {
223
231
  const [sidePanel, setSidePanel] = useState<SidePanelType>(SidePanelType.None);
224
232
  const {phrase} = useParams();
225
233
  const [errorMessage, setErrorMessage] = useState(null);
226
- let isHost = true; //change to false by default after testing
227
- let title = null;
228
- let rtcProps = {
234
+ const [isHost, setIsHost] = React.useState(false);
235
+ const [title, setTitle] = React.useState('');
236
+ const [rtcProps, setRtcProps] = React.useState({
229
237
  appId: $config.APP_ID,
230
238
  channel: null,
231
239
  uid: null,
@@ -238,60 +246,59 @@ const VideoCall: React.FC = () => {
238
246
  encryption: $config.ENCRYPTION_ENABLED
239
247
  ? {key: null, mode: RnEncryptionEnum.AES128XTS, screenKey: null}
240
248
  : false,
241
- };
242
- let data, loading, error;
249
+ });
243
250
 
244
- ({data, loading, error} = useQuery(
251
+ const {data, loading, error} = useQuery(
245
252
  store.token === null
246
253
  ? JOIN_CHANNEL_PHRASE
247
254
  : JOIN_CHANNEL_PHRASE_AND_GET_USER,
248
255
  {
249
256
  variables: {passphrase: phrase},
250
257
  },
251
- ));
258
+ );
252
259
 
253
- if (error) {
254
- console.log('error', error);
255
- // console.log('error data', data);
256
- if (!errorMessage) {
257
- setErrorMessage(error);
260
+ React.useEffect(() => {
261
+ if (error) {
262
+ console.log('error', error);
263
+ // console.log('error data', data);
264
+ if (!errorMessage) {
265
+ setErrorMessage(error);
266
+ }
267
+ return;
258
268
  }
259
- }
260
269
 
261
- if (!loading && data) {
262
- console.log('token:', rtcProps.token);
263
- console.log('error', data.error);
264
- rtcProps = {
265
- appId: $config.APP_ID,
266
- channel: data.joinChannel.channel,
267
- uid: data.joinChannel.mainUser.uid,
268
- token: data.joinChannel.mainUser.rtc,
269
- rtm: data.joinChannel.mainUser.rtm,
270
- dual: true,
271
- profile: $config.PROFILE,
272
- encryption: $config.ENCRYPTION_ENABLED
273
- ? {
274
- key: data.joinChannel.secret,
275
- mode: RnEncryptionEnum.AES128XTS,
276
- screenKey: data.joinChannel.secret,
277
- }
278
- : false,
279
- screenShareUid: data.joinChannel.screenShare.uid,
280
- screenShareToken: data.joinChannel.screenShare.rtc,
281
- };
282
- isHost = data.joinChannel.isHost;
283
- title = data.joinChannel.title;
284
- console.log('query done: ', data, queryComplete);
285
- if (username === 'Getting name...') {
270
+ if (!loading && data) {
271
+ console.log('token:', rtcProps.token);
272
+ console.log('error', data.error);
273
+ setRtcProps({
274
+ appId: $config.APP_ID,
275
+ channel: data.joinChannel.channel,
276
+ uid: data.joinChannel.mainUser.uid,
277
+ token: data.joinChannel.mainUser.rtc,
278
+ rtm: data.joinChannel.mainUser.rtm,
279
+ dual: true,
280
+ profile: $config.PROFILE,
281
+ encryption: $config.ENCRYPTION_ENABLED
282
+ ? {
283
+ key: data.joinChannel.secret,
284
+ mode: RnEncryptionEnum.AES128XTS,
285
+ screenKey: data.joinChannel.secret,
286
+ }
287
+ : false,
288
+ screenShareUid: data.joinChannel.screenShare.uid,
289
+ screenShareToken: data.joinChannel.screenShare.rtc,
290
+ });
291
+ setIsHost(data.joinChannel.isHost);
292
+ setTitle(data.joinChannel.title);
293
+ console.log('query done: ', data, queryComplete);
294
+ // 1. Store the display name from API
286
295
  if (data.getUser) {
287
296
  setUsername(data.getUser.name);
288
- } else {
289
- setUsername('');
290
297
  }
298
+ console.log('token:', rtcProps.token);
299
+ queryComplete ? {} : setQueryComplete(true);
291
300
  }
292
- console.log('token:', rtcProps.token);
293
- queryComplete ? {} : setQueryComplete(true);
294
- }
301
+ }, [error, loading, data]);
295
302
 
296
303
  const history = useHistory();
297
304
  const callbacks = {
@@ -300,6 +307,14 @@ const VideoCall: React.FC = () => {
300
307
  history.push('/');
301
308
  }, 0),
302
309
  };
310
+
311
+ React.useEffect(() => {
312
+ // Update the username in localstorage when username changes
313
+ if (setStore) {
314
+ setStore({token: store?.token || null, displayName: username});
315
+ }
316
+ }, [username]);
317
+
303
318
  // throw new Error("My first Sentry error!");
304
319
  return (
305
320
  <>
@@ -350,7 +365,11 @@ const VideoCall: React.FC = () => {
350
365
  setLastCheckedPublicState
351
366
  }
352
367
  />
353
- <View style={[style.videoView, {backgroundColor: '#ffffff00'}]}>
368
+ <View
369
+ style={[
370
+ style.videoView,
371
+ {backgroundColor: '#ffffff00'},
372
+ ]}>
354
373
  {layout === Layout.Pinned ? (
355
374
  <PinnedVideo />
356
375
  ) : (
@@ -1,12 +1,12 @@
1
1
  /*
2
2
  ********************************************
3
3
  Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
4
+ AppBuilder and all associated components, source code, APIs, services, and documentation
5
+ (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
+ accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
+ Use without a license or in violation of any license terms and conditions (including use for
8
+ any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
+ information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
12
  import React, {useContext} from 'react';
@@ -21,12 +21,12 @@ const ChatBubble = (props: channelMessage) => {
21
21
  let {isLocal, msg, ts, uid} = props;
22
22
  let time = new Date(ts).getHours() + ':' + new Date(ts).getMinutes();
23
23
  const handleUrl = (url: string) => {
24
- if(Platform.OS == 'web'){
24
+ if (Platform.OS === 'web') {
25
25
  window.open(url, '_blank');
26
- } else {
27
- Linking.openURL(url)
28
- }
29
- }
26
+ } else {
27
+ Linking.openURL(url);
28
+ }
29
+ };
30
30
  return (
31
31
  <View>
32
32
  <View style={isLocal ? style.chatSenderViewLocal : style.chatSenderView}>
@@ -64,7 +64,7 @@ const style = StyleSheet.create({
64
64
  flex: 1,
65
65
  },
66
66
  chatSenderViewLocal: {
67
- flex: 2,
67
+ // flex: 2,
68
68
  marginVertical: 2,
69
69
  flexDirection: 'row',
70
70
  marginRight: 15,
@@ -72,7 +72,7 @@ const style = StyleSheet.create({
72
72
  justifyContent: 'flex-end',
73
73
  },
74
74
  chatSenderView: {
75
- flex: 2,
75
+ // flex: 2,
76
76
  marginVertical: 2,
77
77
  flexDirection: 'row',
78
78
  marginRight: 30,
@@ -31,7 +31,7 @@ const LogoutButton = () => {
31
31
 
32
32
  const logout = () => {
33
33
  if (setStore) {
34
- setStore({token: null});
34
+ setStore({token: null, displayName: ''});
35
35
  }
36
36
  logoutQuery({variables: {token}}).catch((e) => {
37
37
  console.log(e);
@@ -27,7 +27,7 @@ const OpenInNativeButton = () => {
27
27
  <TouchableOpacity
28
28
  style={[style.btn, {borderColor: primaryColor}]}
29
29
  onPress={() => openInNative()}>
30
- <Text style={[style.btnText, {color: $config.PRIMARY_FONT_COLOR}]}>Open in Desktop</Text>
30
+ <Text style={[style.btnText, {color: '#fff'}]}>Open in Desktop</Text>
31
31
  </TouchableOpacity>
32
32
  </View>
33
33
  ) : (
@@ -94,6 +94,7 @@ module.exports = {
94
94
  plugins: [
95
95
  // Adds support for class properties
96
96
  ['transform-define', configVars],
97
+ '@babel/plugin-proposal-optional-chaining',
97
98
  '@babel/plugin-proposal-class-properties',
98
99
  isDevelopment && require.resolve('react-refresh/babel'),
99
100
  ].filter(Boolean),
@@ -1,12 +0,0 @@
1
- e99443e73ee4fde6a17b76813f32a1d1fe5afeef branch 'ab-dev-auto' of https://github.com/AgoraIO-Community/ReactNative-UIKit
2
- fd59daf4876e4eb142856957f9450ef5175f4e0f not-for-merge branch 'app-builder' of https://github.com/AgoraIO-Community/ReactNative-UIKit
3
- c60cde905c722aeaf8f25aeed2910a7b4d532cfa not-for-merge branch 'app-builder-dev' of https://github.com/AgoraIO-Community/ReactNative-UIKit
4
- c3084102c3b83267b76df578782ce5d76acd569c not-for-merge branch 'button-label' of https://github.com/AgoraIO-Community/ReactNative-UIKit
5
- 5d4f38ae0a89b20275e2497a4e8f43b0ca2830e4 not-for-merge branch 'dev' of https://github.com/AgoraIO-Community/ReactNative-UIKit
6
- 4ec093e51924049e37d247d867a5482a9376a8cf not-for-merge branch 'docs' of https://github.com/AgoraIO-Community/ReactNative-UIKit
7
- 30bbdd42f695d3add04a63a23ef86056d1a09536 not-for-merge branch 'master' of https://github.com/AgoraIO-Community/ReactNative-UIKit
8
- 3cb1e8211cd3ba448c79b49e4bb0c9d94b1552b3 not-for-merge branch 'precall-prop' of https://github.com/AgoraIO-Community/ReactNative-UIKit
9
- 76f6cbd3b6769bd271867bd026f02d98ba2cf99a not-for-merge branch 'react-native-0.64.2' of https://github.com/AgoraIO-Community/ReactNative-UIKit
10
- c3e27c600ae55f4aeb05ee4666cdf084fd28e9f3 not-for-merge branch 'redo-deps' of https://github.com/AgoraIO-Community/ReactNative-UIKit
11
- ac8929fda04db3663a7c1eb9c71ca6a97728f0eb not-for-merge branch 'v2-legacy' of https://github.com/AgoraIO-Community/ReactNative-UIKit
12
- 200e7d04395d72405cea8162ffe8f7e665d2ee9c not-for-merge branch 'v3-ts' of https://github.com/AgoraIO-Community/ReactNative-UIKit
@@ -1 +0,0 @@
1
- b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c
@@ -1 +0,0 @@
1
- b1495d7ae3f04e1a43be3ccf2f8c83ba583b0b9c e99443e73ee4fde6a17b76813f32a1d1fe5afeef technophilic <svineth.face@gmail.com> 1625683950 +0530 pull: fast-forward
@@ -1 +0,0 @@
1
- e99443e73ee4fde6a17b76813f32a1d1fe5afeef