Skip to content

Commit

Permalink
chore: change typedoc compile option (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Nov 23, 2023
1 parent 2bc1363 commit db8db2f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.snapshots/
lib/
src/ti/
docs
43 changes: 28 additions & 15 deletions example/src/advanced/Lock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ import {
IStreamChannel,
JoinChannelOptions,
LockDetail,
MetadataItem,
MetadataOptions,
RTM_CHANNEL_TYPE,
RTM_CONNECTION_CHANGE_REASON,
RTM_CONNECTION_STATE,
RTM_ERROR_CODE,
RtmMetadata,
StorageEvent,
} from 'agora-react-native-rtm';
import React, { useCallback, useEffect, useRef, useState } from 'react';

Expand All @@ -18,12 +14,9 @@ import { ScrollView } from 'react-native';
import BaseComponent from '../../components/BaseComponent';
import {
AgoraButton,
AgoraCard,
AgoraList,
AgoraStyle,
AgoraText,
AgoraTextInput,
AgoraView,
} from '../../components/ui';
import Config from '../../config/agora.config';
import { useRtmClient } from '../../hooks/useRtmClient';
Expand All @@ -32,7 +25,6 @@ import * as log from '../../utils/log';
export default function Lock() {
const [loginSuccess, setLoginSuccess] = useState(false);
const [joinSuccess, setJoinSuccess] = useState(false);
const [acquireLockSuccess, setAcquireLockSuccess] = useState(false);
const [streamChannel, setStreamChannel] = useState<IStreamChannel>();
const [cName, setCName] = useState<string>(Config.channelName);
const acquireLockRequestId = useRef<number>();
Expand Down Expand Up @@ -97,12 +89,31 @@ export default function Lock() {
if (errorCode !== RTM_ERROR_CODE.RTM_ERROR_OK) {
log.error(`acquire lock failed`, `errorCode: ${errorCode}`);
}
if (
requestId === acquireLockRequestId.current &&
errorCode === RTM_ERROR_CODE.RTM_ERROR_OK
) {
setAcquireLockSuccess(true);
}
},
[]
);

const onReleaseLockResult = useCallback(
(
requestId: number,
channelName: string,
channelType: RTM_CHANNEL_TYPE,
_lockName: string,
errorCode: RTM_ERROR_CODE
) => {
log.info(
'onAcquireLockResult',
'requestId',
requestId,
'channelName',
channelName,
'channelType',
channelType,
'lockName',
_lockName,
'errorCode',
errorCode
);
},
[]
);
Expand Down Expand Up @@ -341,6 +352,7 @@ export default function Lock() {
client.addEventListener('onJoinResult', onJoinResult);
client.addEventListener('onSetLockResult', onSetLockResult);
client?.addEventListener('onAcquireLockResult', onAcquireLockResult);
client?.addEventListener('onReleaseLockResult', onReleaseLockResult);
client?.addEventListener('onRevokeLockResult', onRevokeLockResult);
client?.addEventListener('onRemoveLockResult', onRemoveLockResult);
client?.addEventListener('onGetLocksResult', onGetLocksResult);
Expand All @@ -349,6 +361,7 @@ export default function Lock() {
client.removeEventListener('onJoinResult', onJoinResult);
client.removeEventListener('onSetLockResult', onSetLockResult);
client?.removeEventListener('onAcquireLockResult', onAcquireLockResult);
client?.removeEventListener('onReleaseLockResult', onReleaseLockResult);
client?.removeEventListener('onRevokeLockResult', onRevokeLockResult);
client?.removeEventListener('onRemoveLockResult', onRemoveLockResult);
client?.removeEventListener('onGetLocksResult', onGetLocksResult);
Expand All @@ -359,6 +372,7 @@ export default function Lock() {
onJoinResult,
onSetLockResult,
onAcquireLockResult,
onReleaseLockResult,
onRevokeLockResult,
onRemoveLockResult,
onGetLocksResult,
Expand Down Expand Up @@ -389,7 +403,6 @@ export default function Lock() {
RTM_CONNECTION_CHANGE_REASON.RTM_CONNECTION_CHANGED_LOGOUT
) {
setLoginSuccess(false);
setAcquireLockSuccess(false);
destroyStreamChannel();
}
setJoinSuccess(false);
Expand Down
2 changes: 1 addition & 1 deletion example/src/basic/createStreamChannel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { useCallback, useEffect, useState } from 'react';
import { KeyboardAvoidingView, Platform, ScrollView } from 'react-native';

import BaseComponent from '../../components/BaseComponent';
import { AgoraButton, AgoraStyle, AgoraView } from '../../components/ui';
import { AgoraButton, AgoraStyle } from '../../components/ui';
import Config from '../../config/agora.config';
import { useRtmClient } from '../../hooks/useRtmClient';
import * as log from '../../utils/log';
Expand Down
5 changes: 4 additions & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"includeVersion": true,
"hideGenerator": true,
"includes": "./src",
"exclude": ["**/scripts/terra/**/*"]
"exclude": ["**/scripts/terra/**/*"],
"compilerOptions": {
"noUnusedLocals": false
}
}

0 comments on commit db8db2f

Please sign in to comment.