Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions rollup.module-exports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export default {
// SendbirdProvider
SendbirdProvider: 'src/lib/Sendbird.tsx',
sendbirdSelectors: 'src/lib/selectors.ts',
useSendbirdStateContext: 'src/hooks/useSendbirdStateContext.tsx',
withSendbird: 'src/lib/SendbirdSdkContext.tsx',
// TODO: Support below legacy exports
// useSendbirdStateContext: 'src/hooks/useSendbirdStateContext.tsx',
// withSendbird: 'src/lib/SendbirdSdkContext.tsx',
Comment on lines +15 to +17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support this in the separated PR


// Voice message
'VoiceRecorder/context': 'src/hooks/VoiceRecorder/index.tsx',
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/VoicePlayer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
VOICE_PLAYER_AUDIO_ID,
VOICE_PLAYER_ROOT_ID,
} from '../../utils/consts';
import useSendbirdStateContext from '../useSendbirdStateContext';
import { getParsedVoiceAudioFileInfo } from './utils';
import useSendbird from '../../lib/Sendbird/context/hooks/useSendbird';

// VoicePlayerProvider interface
export interface VoicePlayerProps {
Expand Down Expand Up @@ -64,7 +64,8 @@ export const VoicePlayerProvider = ({
currentPlayer,
audioStorage,
} = voicePlayerStore;
const { config } = useSendbirdStateContext();
const { state } = useSendbird();
const { config } = state;
const { logger } = config;

const stop = (text = '') => {
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/VoiceRecorder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
VOICE_MESSAGE_MIME_TYPE,
VOICE_RECORDER_AUDIO_BIT_RATE,
} from '../../utils/consts';
import useSendbirdStateContext from '../useSendbirdStateContext';
import { type WebAudioUtils } from './WebAudioUtils';
import { noop } from '../../utils/utils';
import useSendbird from '../../lib/Sendbird/context/hooks/useSendbird';

// Input props of VoiceRecorder
export interface VoiceRecorderProps {
Expand All @@ -37,7 +37,8 @@ const Context = createContext<VoiceRecorderContext>({

export const VoiceRecorderProvider = (props: VoiceRecorderProps): React.ReactElement => {
const { children } = props;
const { config } = useSendbirdStateContext();
const { state } = useSendbird();
const { config } = state;
const { logger, groupChannel } = config;
const [mediaRecorder, setMediaRecorder] = useState<MediaRecorder | null>(null);
const [isRecordable, setIsRecordable] = useState<boolean>(false);
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/VoiceRecorder/useVoiceRecorder.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import { VoiceRecorderEventHandler, useVoiceRecorderContext } from '.';
import useSendbirdStateContext from '../useSendbirdStateContext';
import { noop } from '../../utils/utils';
import useSendbird from '../../lib/Sendbird/context/hooks/useSendbird';

// export interface UseVoiceRecorderProps extends VoiceRecorderEventHandler {
// /**
Expand Down Expand Up @@ -31,7 +31,8 @@ export const useVoiceRecorder = ({
onRecordingStarted = noop,
onRecordingEnded = noop,
}: VoiceRecorderEventHandler): UseVoiceRecorderContext => {
const { config } = useSendbirdStateContext();
const { state } = useSendbird();
const { config } = state;
const { voiceRecord } = config;
const maxRecordingTime = voiceRecord.maxRecordingTime;
const voiceRecorder = useVoiceRecorderContext();
Expand Down
22 changes: 0 additions & 22 deletions src/hooks/useSendbirdStateContext.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export { default as MessageSearch } from './modules/MessageSearch';

// HOC for using ui-kit state
// withBird(MyCustomComponent) will give the sendbird state as props to MyCustomComponent
export { default as withSendBird } from './lib/SendbirdSdkContext';
export { withSendBird } from './lib/Sendbird/index';
export { useSendbirdStateContext } from './lib/Sendbird/context/hooks/useSendbirdStateContext';
export { default as sendbirdSelectors } from './lib/selectors';
// for legacy parity, slowly remove
export { default as sendBirdSelectors } from './lib/selectors';
export { default as useSendbirdStateContext } from './hooks/useSendbirdStateContext';

// Public enum included in AppProps
export { TypingIndicatorType } from './types';
Loading