agora-appbuilder-core 4.0.0-api.6 → 4.0.0-api.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-api.6",
3
+ "version": "4.0.0-api.7",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -24,6 +24,7 @@ import {ShowInputURL} from '../src/components/Share';
24
24
  import useRemoteMute, {MUTE_REMOTE_TYPE} from '../src/utils/useRemoteMute';
25
25
  import getCustomRoute from '../src/utils/getCustomRoute';
26
26
  import endCallEveryOne from '../src/utils/endCallEveryOne';
27
+ import TertiaryButton from '../src/atoms/TertiaryButton';
27
28
  export {
28
29
  VideoRenderer,
29
30
  DispatchContext,
@@ -47,4 +48,5 @@ export {
47
48
  MUTE_REMOTE_TYPE,
48
49
  getCustomRoute,
49
50
  endCallEveryOne,
51
+ TertiaryButton,
50
52
  };
@@ -62,11 +62,33 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
62
62
  const {dispatch} = useContext(DispatchContext);
63
63
  const {RtcEngineUnsafe} = useContext(RtcContext);
64
64
 
65
+ const {isToolbarMenuItem} = useToolbarMenu();
66
+ const {rtcProps} = useContext(PropsContext);
67
+ const {
68
+ data: {isHost},
69
+ } = useRoomInfo();
70
+
71
+ const isHostRef = useRef(isHost);
72
+ useEffect(() => {
73
+ isHostRef.current = isHost;
74
+ }, [isHost]);
75
+
76
+ const {position} = useToolbar();
77
+ const local = useLocalUserInfo();
78
+ const isHandRaised = useIsHandRaised();
79
+ const localMute = useMuteToggleLocal();
80
+ const {isOnActionSheet, isOnFirstRow, showLabel} = useActionSheet();
81
+ const {showToolTip = false, disabled = false, showWarningIcon = true} = props;
82
+
65
83
  useEffect(() => {
66
84
  events.on(controlMessageEnum.disableButton, async ({payload}) => {
67
85
  try {
68
86
  const data = JSON.parse(payload);
69
- if (data && data?.button === MUTE_REMOTE_TYPE.audio) {
87
+ if (
88
+ data &&
89
+ data?.button === MUTE_REMOTE_TYPE.audio &&
90
+ !isHostRef.current
91
+ ) {
70
92
  if (data?.action === true) {
71
93
  RtcEngineUnsafe.muteLocalAudioStream(true);
72
94
  dispatch({
@@ -86,18 +108,6 @@ function LocalAudioMute(props: LocalAudioMuteProps) {
86
108
  });
87
109
  }, []);
88
110
 
89
- const {isToolbarMenuItem} = useToolbarMenu();
90
- const {rtcProps} = useContext(PropsContext);
91
- const {
92
- data: {isHost},
93
- } = useRoomInfo();
94
- const {position} = useToolbar();
95
- const local = useLocalUserInfo();
96
- const isHandRaised = useIsHandRaised();
97
- const localMute = useMuteToggleLocal();
98
- const {isOnActionSheet, isOnFirstRow, showLabel} = useActionSheet();
99
- const {showToolTip = false, disabled = false, showWarningIcon = true} = props;
100
-
101
111
  const micButtonLabel = useString<I18nDeviceStatus>(toolbarItemMicrophoneText);
102
112
  const micButtonTooltip = useString<I18nDeviceStatus>(
103
113
  toolbarItemMicrophoneTooltipText,
@@ -9,7 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useContext, useEffect} from 'react';
12
+ import React, {useContext, useEffect, useRef} from 'react';
13
13
  import {
14
14
  ToggleState,
15
15
  PermissionState,
@@ -65,11 +65,33 @@ function LocalVideoMute(props: LocalVideoMuteProps) {
65
65
  const {dispatch} = useContext(DispatchContext);
66
66
  const {RtcEngineUnsafe} = useContext(RtcContext);
67
67
 
68
+ const {rtcProps} = useContext(PropsContext);
69
+ const {isScreenshareActive} = useScreenshare();
70
+ const {setShowStopScreenSharePopup} = useVideoCall();
71
+ const {isToolbarMenuItem} = useToolbarMenu();
72
+ const {
73
+ data: {isHost},
74
+ } = useRoomInfo();
75
+
76
+ const isHostRef = useRef(isHost);
77
+ useEffect(() => {
78
+ isHostRef.current = isHost;
79
+ }, [isHost]);
80
+
81
+ const local = useLocalUserInfo();
82
+ const isHandRaised = useIsHandRaised();
83
+ const localMute = useMuteToggleLocal();
84
+ const {showToolTip = false, disabled = false, showWarningIcon = true} = props;
85
+
68
86
  useEffect(() => {
69
87
  events.on(controlMessageEnum.disableButton, async ({payload}) => {
70
88
  try {
71
89
  const data = JSON.parse(payload);
72
- if (data && data?.button === MUTE_REMOTE_TYPE.video) {
90
+ if (
91
+ data &&
92
+ data?.button === MUTE_REMOTE_TYPE.video &&
93
+ !isHostRef.current
94
+ ) {
73
95
  if (data?.action === true) {
74
96
  isWebInternal()
75
97
  ? await RtcEngineUnsafe.muteLocalVideoStream(true)
@@ -92,17 +114,6 @@ function LocalVideoMute(props: LocalVideoMuteProps) {
92
114
  });
93
115
  }, []);
94
116
 
95
- const {rtcProps} = useContext(PropsContext);
96
- const {isScreenshareActive} = useScreenshare();
97
- const {setShowStopScreenSharePopup} = useVideoCall();
98
- const {isToolbarMenuItem} = useToolbarMenu();
99
- const {
100
- data: {isHost},
101
- } = useRoomInfo();
102
- const local = useLocalUserInfo();
103
- const isHandRaised = useIsHandRaised();
104
- const localMute = useMuteToggleLocal();
105
- const {showToolTip = false, disabled = false, showWarningIcon = true} = props;
106
117
  const {isOnActionSheet, isOnFirstRow, showLabel} = useActionSheet();
107
118
  const {position} = useToolbar();
108
119
  const {