Skip to content

Commit 3058bbc

Browse files
committed
fix: change names of context
1 parent 35a2018 commit 3058bbc

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

package/src/components/Channel/Channel.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ import {
5353
MessageContextValue,
5454
} from '../../contexts';
5555
import {
56-
AudioPlayerPoolContextProps,
57-
AudioPlayerPoolProvider,
58-
} from '../../contexts/audioPlayerPoolContext/AudioPlayerPoolContext';
56+
AudioPlayerContextProps,
57+
WithAudioPlayback,
58+
} from '../../contexts/audioPlayerContext/AudioPlayerContext';
5959
import { ChannelContextValue, ChannelProvider } from '../../contexts/channelContext/ChannelContext';
6060
import type { UseChannelStateValue } from '../../contexts/channelsStateContext/useChannelState';
6161
import { useChannelState } from '../../contexts/channelsStateContext/useChannelState';
@@ -1667,7 +1667,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
16671667
}
16681668
});
16691669

1670-
const audioPlayerPoolProviderProps = useMemo<AudioPlayerPoolContextProps>(
1670+
const audioPlayerProviderProps = useMemo<AudioPlayerContextProps>(
16711671
() => ({
16721672
allowConcurrentAudioPlayback,
16731673
}),
@@ -2012,12 +2012,12 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
20122012
<AttachmentPickerProvider value={attachmentPickerContext}>
20132013
<MessageComposerProvider value={messageComposerContext}>
20142014
<MessageInputProvider value={inputMessageInputContext}>
2015-
<AudioPlayerPoolProvider props={audioPlayerPoolProviderProps}>
2015+
<WithAudioPlayback props={audioPlayerProviderProps}>
20162016
<View style={{ height: '100%' }}>{children}</View>
20172017
{!disableAttachmentPicker && (
20182018
<AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} />
20192019
)}
2020-
</AudioPlayerPoolProvider>
2020+
</WithAudioPlayback>
20212021
</MessageInputProvider>
20222022
</MessageComposerProvider>
20232023
</AttachmentPickerProvider>

package/src/contexts/audioPlayerPoolContext/AudioPlayerPoolContext.tsx renamed to package/src/contexts/audioPlayerContext/AudioPlayerContext.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import React, { createContext, PropsWithChildren, useContext, useEffect, useMemo
33
import { AudioPlayerPool } from '../../state-store/audio-player-pool';
44
import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
55

6-
export type AudioPlayerPoolContextProps = {
6+
export type AudioPlayerContextProps = {
77
allowConcurrentAudioPlayback: boolean;
88
};
99

10-
export type AudioPlayerPoolContextValue = {
10+
export type AudioPlayerContextValue = {
1111
audioPlayerPool: AudioPlayerPool;
1212
};
1313

14-
export const AudioPlayerPoolContext = createContext<AudioPlayerPoolContextValue>(
15-
DEFAULT_BASE_CONTEXT_VALUE as AudioPlayerPoolContextValue,
14+
export const AudioPlayerContext = createContext<AudioPlayerContextValue>(
15+
DEFAULT_BASE_CONTEXT_VALUE as AudioPlayerContextValue,
1616
);
1717

18-
export const AudioPlayerPoolProvider = ({
18+
export const WithAudioPlayback = ({
1919
props: { allowConcurrentAudioPlayback },
2020
children,
21-
}: PropsWithChildren<{ props: AudioPlayerPoolContextProps }>) => {
21+
}: PropsWithChildren<{ props: AudioPlayerContextProps }>) => {
2222
const audioPlayerPool = useMemo(
2323
() => new AudioPlayerPool({ allowConcurrentAudioPlayback }),
2424
[allowConcurrentAudioPlayback],
@@ -33,10 +33,10 @@ export const AudioPlayerPoolProvider = ({
3333
);
3434

3535
return (
36-
<AudioPlayerPoolContext.Provider value={audioPlayerPoolContextValue}>
36+
<AudioPlayerContext.Provider value={audioPlayerPoolContextValue}>
3737
{children}
38-
</AudioPlayerPoolContext.Provider>
38+
</AudioPlayerContext.Provider>
3939
);
4040
};
4141

42-
export const useAudioPlayerPoolContext = () => useContext(AudioPlayerPoolContext);
42+
export const useAudioPlayerContext = () => useContext(AudioPlayerContext);

package/src/contexts/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ export * from './typingContext/TypingContext';
2828
export * from './utils/getDisplayName';
2929
export * from './pollContext';
3030
export * from './liveLocationManagerContext';
31-
export * from './audioPlayerPoolContext/AudioPlayerPoolContext';
31+
export * from './audioPlayerContext/AudioPlayerContext';

package/src/hooks/useAudioPlayerControl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useMemo } from 'react';
22

3-
import { useAudioPlayerPoolContext } from '../contexts/audioPlayerPoolContext/AudioPlayerPoolContext';
3+
import { useAudioPlayerContext } from '../contexts/audioPlayerContext/AudioPlayerContext';
44
import { AudioPlayerOptions } from '../state-store/audio-player';
55

66
export type UseAudioPlayerControlProps = {
@@ -39,7 +39,7 @@ export const useAudioPlayerControl = ({
3939
uri,
4040
id: fileId,
4141
}: UseAudioPlayerControlProps) => {
42-
const { audioPlayerPool } = useAudioPlayerPoolContext();
42+
const { audioPlayerPool } = useAudioPlayerContext();
4343
const id = makeAudioPlayerId({ id: fileId, requester, src: uri ?? '' });
4444
const audioPlayer = useMemo(
4545
() =>

0 commit comments

Comments
 (0)