Skip to content

Commit

Permalink
fix: RtcChannel destroyAll
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Oct 23, 2020
1 parent 25cf253 commit d647049
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
13 changes: 4 additions & 9 deletions example/src/examples/advanced/MultiChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class MultiChannel extends Component<{}, State, any> {
const { isJoined0, isJoined1 } = this.state;
return (
<View style={styles.container}>
<View style={styles.bottom}>
<View style={styles.top}>
<Button
onPress={isJoined0 ? this._leaveChannel0 : this._joinChannel0}
title={`${isJoined0 ? 'Leave' : 'Join'} ${channelId0}`}
Expand All @@ -177,7 +177,7 @@ export default class MultiChannel extends Component<{}, State, any> {
<View style={styles.float}>
<Button
onPress={this._publishChannel0}
title={`Pulish ${channelId0}`}
title={`Publish ${channelId0}`}
/>
<Button
onPress={() => {
Expand All @@ -187,7 +187,7 @@ export default class MultiChannel extends Component<{}, State, any> {
/>
<Button
onPress={this._publishChannel1}
title={`Pulish ${channelId1}`}
title={`Publish ${channelId1}`}
/>
<Button
onPress={() => {
Expand Down Expand Up @@ -231,18 +231,13 @@ const styles = StyleSheet.create({
flex: 1,
},
float: {
width: '30%',
position: 'absolute',
right: 0,
bottom: 0,
},
bottom: {
top: {
width: '100%',
},
input: {
borderColor: 'gray',
borderWidth: 1,
},
local: {
flex: 1,
},
Expand Down
9 changes: 4 additions & 5 deletions example/src/examples/basic/JoinChannelAudio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ export default class JoinChannelAudio extends Component<{}, State, any> {
});
};

_switchSpeakerphone = async () => {
_switchSpeakerphone = () => {
const { enableSpeakerphone } = this.state;
await this._engine
this._engine
?.setEnableSpeakerphone(!enableSpeakerphone)
.then(() => {
this.setState({ enableSpeakerphone: !enableSpeakerphone });
Expand All @@ -111,7 +111,7 @@ export default class JoinChannelAudio extends Component<{}, State, any> {
} = this.state;
return (
<View style={styles.container}>
<View style={styles.bottom}>
<View style={styles.top}>
<TextInput
style={styles.input}
onChangeText={(text) => this.setState({ channelId: text })}
Expand Down Expand Up @@ -143,12 +143,11 @@ const styles = StyleSheet.create({
flex: 1,
},
float: {
width: '30%',
position: 'absolute',
right: 0,
bottom: 0,
},
bottom: {
top: {
width: '100%',
},
input: {
Expand Down
5 changes: 2 additions & 3 deletions example/src/examples/basic/JoinChannelVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default class JoinChannelAudio extends Component<{}, State, any> {
const { channelId, isJoined, switchCamera } = this.state;
return (
<View style={styles.container}>
<View style={styles.bottom}>
<View style={styles.top}>
<TextInput
style={styles.input}
onChangeText={(text) => this.setState({ channelId: text })}
Expand Down Expand Up @@ -156,12 +156,11 @@ const styles = StyleSheet.create({
flex: 1,
},
float: {
width: '30%',
position: 'absolute',
right: 0,
bottom: 0,
},
bottom: {
top: {
width: '100%',
},
input: {
Expand Down
15 changes: 2 additions & 13 deletions example/src/examples/basic/StringUid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class StringUid extends Component<{}, State, any> {
const { channelId, stringUid, isJoined } = this.state;
return (
<View style={styles.container}>
<View style={styles.bottom}>
<View style={styles.top}>
<TextInput
style={styles.input}
onChangeText={(text) => this.setState({ channelId: text })}
Expand Down Expand Up @@ -112,26 +112,15 @@ const styles = StyleSheet.create({
flex: 1,
},
float: {
width: '30%',
position: 'absolute',
right: 0,
bottom: 0,
},
bottom: {
top: {
width: '100%',
},
input: {
borderColor: 'gray',
borderWidth: 1,
},
local: {
flex: 1,
},
remote: {
width: 200,
height: 200,
position: 'absolute',
left: 0,
top: 0,
},
});
3 changes: 2 additions & 1 deletion src/common/RtcChannel.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export default class RtcChannel implements RtcChannelInterface {
*/
static destroyAll() {
channels.forEach(async (value) => {
await value.destroy();
value.removeAllListeners();
await value._callMethod('destroy');
});
channels.clear();
}
Expand Down

0 comments on commit d647049

Please sign in to comment.