Skip to content

Commit

Permalink
feat: optimize constructor for Classes.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Jun 28, 2021
1 parent 0a961d7 commit d14a41a
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 105 deletions.
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import React from 'react';
import {
SafeAreaView,
StyleSheet,
SectionList,
StyleSheet,
Text,
View,
TouchableOpacity,
View,
} from 'react-native';

import { NavigationContainer } from '@react-navigation/native';
Expand Down
16 changes: 10 additions & 6 deletions example/src/examples/advanced/CreateStreamData.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import React, { Component, Fragment } from 'react';
import {
Alert,
Button,
PermissionsAndroid,
Platform,
StyleSheet,
View,
Alert,
TextInput,
Text,
TextInput,
View,
} from 'react-native';

import RtcEngine, {
AudienceLatencyLevelType,
ChannelProfile,
ClientRole,
DataStreamConfig,
RtcEngineConfig,
RtcLocalView,
RtcRemoteView,
VideoFrameRate,
VideoOutputOrientationMode,
VideoRenderMode,
AudienceLatencyLevelType,
RtcRemoteView,
} from 'react-native-agora';

const config = require('../../../agora.config.json');
Expand All @@ -38,12 +39,15 @@ export default class LiveStreaming extends Component<{}, State, any> {
super(props);
this.state = { isJoin: false };
}

onPressSend = async () => {
const { message } = this.state;
if (!message) {
return;
}
const streamId = await this._engine?.createDataStreamWithConfig({});
const streamId = await this._engine?.createDataStreamWithConfig(
new DataStreamConfig(true, true)
);

await this._engine?.sendStreamMessage(streamId!, message);
this.setState({ message: '' });
Expand Down
6 changes: 3 additions & 3 deletions example/src/examples/advanced/LiveStreaming.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import React, { Component } from 'react';
import {
Alert,
Button,
PermissionsAndroid,
Platform,
StyleSheet,
View,
Alert,
} from 'react-native';

import RtcEngine, {
AudienceLatencyLevelType,
ChannelProfile,
ClientRole,
RtcEngineConfig,
RtcLocalView,
RtcRemoteView,
VideoFrameRate,
VideoOutputOrientationMode,
VideoRenderMode,
AudienceLatencyLevelType,
RtcRemoteView,
} from 'react-native-agora';
import Item from '../component/Item';

Expand Down
15 changes: 8 additions & 7 deletions example/src/examples/advanced/MediaChannelRelay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import {
PermissionsAndroid,
Platform,
StyleSheet,
View,
TextInput,
Text,
TextInput,
View,
} from 'react-native';

import RtcEngine, {
AudienceLatencyLevelType,
ChannelMediaRelayError,
ChannelMediaRelayEvent,
ChannelMediaRelayState,
ChannelProfile,
ClientRole,
RtcEngineConfig,
RtcLocalView,
RtcRemoteView,
VideoFrameRate,
VideoOutputOrientationMode,
VideoRenderMode,
AudienceLatencyLevelType,
RtcRemoteView,
ChannelMediaRelayState,
ChannelMediaRelayError,
ChannelMediaRelayEvent,
} from 'react-native-agora';

const config = require('../../../agora.config.json');
Expand All @@ -41,6 +41,7 @@ export default class MediaChannelRelay extends Component<{}, State, any> {
super(props);
this.state = { isJoin: false, isRelaying: false };
}

onPressRelay = async () => {
const { anotherChannelName } = this.state;
if (!anotherChannelName) {
Expand Down
19 changes: 10 additions & 9 deletions example/src/examples/advanced/VoiceChange.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
import React, { Component, useState, useEffect } from 'react';
import React, { Component, useEffect, useState } from 'react';
import {
Alert,
Button,
FlatList,
PermissionsAndroid,
Platform,
StyleSheet,
View,
Text,
FlatList,
Alert,
View,
} from 'react-native';
import Slider from '@react-native-community/slider';
import RtcEngine, {
AudioEffectPreset,
AudioEqualizationBandFrequency,
AudioProfile,
AudioReverbType,
AudioScenario,
ChannelProfile,
ClientRole,
RtcEngineConfig,
AudioProfile,
AudioScenario,
VoiceBeautifierPreset,
AudioEffectPreset,
AudioEqualizationBandFrequency,
AudioReverbType,
} from 'react-native-agora';
import VoiceChangeConfig, {
FreqOptions,
ReverbKeyOptions,
} from '../config/VoiceChangeConfig';

const config = require('../../../agora.config.json');

interface State {
Expand Down
2 changes: 1 addition & 1 deletion example/src/examples/component/Item.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { View, Switch, StyleSheet, TouchableOpacity, Text } from 'react-native';
import { StyleSheet, Switch, Text, TouchableOpacity, View } from 'react-native';
import Slider from '@react-native-community/slider';

interface ItemProps {
Expand Down
2 changes: 1 addition & 1 deletion example/src/examples/config/VoiceChangeConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
VoiceBeautifierPreset,
AudioEffectPreset,
AudioEqualizationBandFrequency,
AudioReverbType,
VoiceBeautifierPreset,
} from 'react-native-agora';

export default [
Expand Down
Loading

0 comments on commit d14a41a

Please sign in to comment.