Skip to content

Commit

Permalink
Merge branch 'develop' into updateDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ygit authored Jul 23, 2024
2 parents f8bcbfc + 3f2a51b commit 25a2b66
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/react-native-room-kit/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/react-native-room-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"@100mslive/types-prebuilt": "^0.12.8",
"@100mslive/types-prebuilt": "^0.12.9",
"@react-navigation/native": "^6.0.8",
"react-redux": "^7.2.4",
"redux": "^4.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PressableIcon } from './PressableIcon';
import { styles } from './styles';
import { useSelector } from 'react-redux';
import type { RootState } from '../redux';
import { useHMSLayoutConfig } from '../hooks-util';

export const HMSManageNoiseCancellation = () => {
const noiseCancellationPlugin = useSelector(
Expand All @@ -12,6 +13,20 @@ export const HMSManageNoiseCancellation = () => {
const [isNoiseCancellationEnabled, setIsNoiseCancellationEnabled] =
React.useState(false);

const enabledByDefault = useHMSLayoutConfig((layoutConfig) => {
return (
layoutConfig?.screens?.preview?.default?.elements?.noise_cancellation
?.enabled_by_default || false
);
});

React.useEffect(() => {
if (enabledByDefault) {
noiseCancellationPlugin?.enable();
setIsNoiseCancellationEnabled(true);
}
}, []);

const handleButtonPress = async () => {
const isAvailable =
await noiseCancellationPlugin?.isNoiseCancellationAvailable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { RootState } from '../redux';
import { Footer } from './Footer';
import { DisplayView } from './DisplayView';
import { Header } from './Header';
import { useKeyboardState } from '../hooks-util';
import { useHMSLayoutConfig, useKeyboardState } from '../hooks-util';
import { HMSStatusBar } from './StatusBar';
import { AnimatedFooter } from './AnimatedFooter';
import { AnimatedHeader } from './AnimatedHeader';
Expand Down Expand Up @@ -138,6 +138,26 @@ export const MeetingScreenContent: React.FC<MeetingScreenContentProps> = ({
.onEnd(() => toggleControls())
.requireExternalGestureToFail();

const enabledByDefault = useHMSLayoutConfig((layoutConfig) => {
return (
layoutConfig?.screens?.preview?.default?.elements?.noise_cancellation
?.enabled_by_default || false
);
});

const shouldEnableNoiseCancellation =
Platform.OS === 'ios' && enabledByDefault;

const noiseCancellationPlugin = useSelector(
(state: RootState) => state.hmsStates.noiseCancellationPlugin
);

React.useEffect(() => {
if (shouldEnableNoiseCancellation) {
noiseCancellationPlugin?.enable();
}
}, []);

return (
<View style={styles.container}>
<HMSStatusBar hidden={controlsHidden} barStyle={'light-content'} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export const RoomSettingsModalContent: React.FC<
}, [noiseCancellationPlugin]);

const handleNoiseCancellation = () => {
// Register callback to be called when bottom sheet is hiddden
// Register callback to be called when bottom sheet is hidden
registerOnModalHideAction(() => {
if (!noiseCancellationPlugin || !isNoiseCancellationAvailable) return;

Expand Down

0 comments on commit 25a2b66

Please sign in to comment.