Skip to content

Commit

Permalink
perf(example): add log sink and some new cases (#7)
Browse files Browse the repository at this point in the history
* perf(example): add some new examples
* chore: set ACCESS_NETWORK_STATE permission
  • Loading branch information
guoxianzhe authored Dec 6, 2023
1 parent 0764942 commit 94e4fd0
Show file tree
Hide file tree
Showing 24 changed files with 2,131 additions and 386 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ on:
required: false
type: boolean
default: false
pull_request:
types: [labeled, synchronize]
build_ios:
description: 'build iOS'
required: false
type: boolean
default: true

jobs:
build-android:
# if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:dep-update') }}
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
Expand Down Expand Up @@ -70,8 +72,8 @@ jobs:
- name: Modify APP ID
run: |
sed "s/localAppId = '\(.*\)'/localAppId = '${{ secrets.APP_ID_RTM }}'/g" agora.config.ts > tmp
mv tmp agora.config.ts
touch env_local.ts
echo "export default { appId: '${{ secrets.APP_ID_RTM }}', token: '${{ secrets.APP_ID_RTM }}' };" > env_local.ts
working-directory: example/src/config

- name: Build example for Android
Expand All @@ -87,7 +89,7 @@ jobs:
if-no-files-found: error

build-ios:
# if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:dep-update') }}
if: ${{ inputs.build_ios }}
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/ios
Expand Down Expand Up @@ -138,8 +140,8 @@ jobs:
- name: Modify APP ID
run: |
sed "s/localAppId = '\(.*\)'/localAppId = '${{ secrets.APP_ID_RTM }}'/g" agora.config.ts > tmp
mv tmp agora.config.ts
touch env_local.ts
echo "export default { appId: '${{ secrets.APP_ID_RTM }}', token: '${{ secrets.APP_ID_RTM }}' };" > env_local.ts
working-directory: example/src/config

- name: Install the Apple certificate and provisioning profile
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ android {

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
manifest.srcFile "src/main/AndroidManifest.xml"
//for local test
jniLibs.srcDirs = ['../lib']
}
Expand Down
1 change: 1 addition & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -775,4 +775,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 2bbca92df7080e9f2d35e75cac68a828cb902110

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
29 changes: 10 additions & 19 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ import {
StackScreenProps,
createStackNavigator,
} from '@react-navigation/stack';
import createAgoraRtmClient, {
isDebuggable,
setDebuggable,
} from 'agora-react-native-rtm';
import { isDebuggable, setDebuggable } from 'agora-react-native-rtm';
import React, { useEffect } from 'react';
import {
AppState,
Keyboard,
Platform,
SafeAreaView,
SectionList,
StyleSheet,
Expand All @@ -23,22 +18,11 @@ import {
import Advanced from './advanced';
import Basic from './basic';
import Client from './components/Client';
import { ConfigHeader } from './config/ConfigHeader';
const RootStack = createStackNavigator<any>();
// setDebuggable(!isDebuggable());
const DATA = [Basic, Advanced];

export default function App() {
useEffect(() => {
let subscription = AppState.addEventListener('change', (state) => {
//just for live reload mode To reset the rtm client in Android
if (state === 'background' && Platform.OS === 'android') {
createAgoraRtmClient().release();
}
});
return () => {
subscription.remove();
};
}, []);
return (
<NavigationContainer>
<SafeAreaView
Expand Down Expand Up @@ -70,7 +54,9 @@ export default function App() {
onPress={() => {
setDebuggable(!isDebuggable());
}}
/>
>
<Text style={styles.version}>Powered by Agora RTM SDK</Text>
</TouchableOpacity>
</SafeAreaView>
</NavigationContainer>
);
Expand All @@ -79,6 +65,11 @@ export default function App() {
const AppSectionList = SectionList<any>;

const Home = ({ navigation }: StackScreenProps<any>) => {
useEffect(() => {
const headerRight = () => <ConfigHeader />;
navigation.setOptions({ headerRight });
}, [navigation]);

return (
<AppSectionList
sections={DATA}
Expand Down
Loading

0 comments on commit 94e4fd0

Please sign in to comment.