Skip to content

Commit

Permalink
chore: drop dotenv from RN dogfood app (#1042)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede authored Sep 1, 2023
1 parent 05da438 commit 1fe2492
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 32 deletions.
12 changes: 1 addition & 11 deletions sample-apps/react-native/dogfood/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
module.exports = {
presets: ['@rnx-kit/babel-preset-metro-react-native'],
plugins: [
'react-native-reanimated/plugin',
[
'module:react-native-dotenv',
// Added for Chat SDK
{
moduleName: 'react-native-dotenv',
path: '.env',
},
],
],
plugins: ['react-native-reanimated/plugin'],
};
1 change: 1 addition & 0 deletions sample-apps/react-native/dogfood/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const STREAM_API_KEY = 'hd8szvscpxvd';
1 change: 0 additions & 1 deletion sample-apps/react-native/dogfood/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"react-native": "0.71.11",
"react-native-callkeep": "4.3.11",
"react-native-device-info": "^10.6.0",
"react-native-dotenv": "^3.4.7",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.12.0",
"react-native-haptic-feedback": "^2.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Chat, OverlayProvider, Streami18n } from 'stream-chat-react-native';
import { useChatClient } from '../hooks/useChatClient';
import { AuthenticationProgress } from './AuthenticatingProgress';
import { StreamChatGenerics } from '../../types';
import { STREAM_API_KEY } from 'react-native-dotenv';
import { useAppGlobalStoreValue } from '../contexts/AppContext';
import { createToken } from '../modules/helpers/createToken';
import { useStreamChatTheme } from '../hooks/useTheme';
import { STREAM_API_KEY } from '../../config';

const streami18n = new Streami18n({
language: 'en',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
StreamVideo,
StreamVideoClient,
} from '@stream-io/video-react-native-sdk';
import { STREAM_API_KEY } from 'react-native-dotenv';
import { useAppGlobalStoreValue } from '../contexts/AppContext';
import { createToken } from '../modules/helpers/createToken';
import translations from '../translations';
import { STREAM_API_KEY } from '../../config';

export const VideoWrapper = ({ children }: PropsWithChildren<{}>) => {
const userId = useAppGlobalStoreValue((store) => store.userId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { STREAM_API_KEY } from 'react-native-dotenv';
import { STREAM_API_KEY } from '../../../config';

type ParamsType = {
user_id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { MeetingStackParamList } from '../../../types';
import { MeetingUI } from '../../components/MeetingUI';
import { createToken } from '../../modules/helpers/createToken';
import { STREAM_API_KEY } from '../../../config';

type Props = NativeStackScreenProps<
MeetingStackParamList,
Expand All @@ -20,7 +21,6 @@ export const GuestMeetingScreen = (props: Props) => {
const [videoClient, setVideoClient] = useState<StreamVideoClient | undefined>(
undefined,
);
const apiKey = process.env.STREAM_API_KEY as string;
const {
params: { guestUserId, callId, mode },
} = props.route;
Expand Down Expand Up @@ -49,7 +49,7 @@ export const GuestMeetingScreen = (props: Props) => {

useEffect(() => {
const _videoClient = new StreamVideoClient({
apiKey,
apiKey: STREAM_API_KEY,
user: userToConnect,
tokenProvider: mode === 'anonymous' ? tokenProvider : undefined,
options: { logLevel: 'warn' },
Expand All @@ -60,7 +60,7 @@ export const GuestMeetingScreen = (props: Props) => {
_videoClient?.disconnectUser();
setVideoClient(undefined);
};
}, [tokenProvider, userToConnect, apiKey, mode]);
}, [tokenProvider, userToConnect, mode]);

const call = useMemo<Call | undefined>(() => {
if (!videoClient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
StreamVideoRN,
} from '@stream-io/video-react-native-sdk';
import { AndroidImportance } from '@notifee/react-native';
import { STREAM_API_KEY } from 'react-native-dotenv';
import { staticNavigate } from './staticNavigationUtils';
import { mmkvStorage } from '../contexts/createStoreContext';
import { createToken } from '../modules/helpers/createToken';
import { STREAM_API_KEY } from '../../config';

export function setPushConfig() {
StreamVideoRN.setPushConfig({
Expand Down
14 changes: 1 addition & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6870,7 +6870,6 @@ __metadata:
react-native: 0.71.11
react-native-callkeep: 4.3.11
react-native-device-info: ^10.6.0
react-native-dotenv: ^3.4.7
react-native-fs: ^2.20.0
react-native-gesture-handler: ^2.12.0
react-native-haptic-feedback: ^2.0.3
Expand Down Expand Up @@ -12557,7 +12556,7 @@ __metadata:
languageName: node
linkType: hard

"dotenv@npm:^16.0.3, dotenv@npm:^16.1.4, dotenv@npm:^16.3.1":
"dotenv@npm:^16.1.4, dotenv@npm:^16.3.1":
version: 16.3.1
resolution: "dotenv@npm:16.3.1"
checksum: 15d75e7279018f4bafd0ee9706593dd14455ddb71b3bcba9c52574460b7ccaf67d5cf8b2c08a5af1a9da6db36c956a04a1192b101ee102a3e0cf8817bbcf3dfd
Expand Down Expand Up @@ -22852,17 +22851,6 @@ __metadata:
languageName: node
linkType: hard

"react-native-dotenv@npm:^3.4.7":
version: 3.4.8
resolution: "react-native-dotenv@npm:3.4.8"
dependencies:
dotenv: ^16.0.3
peerDependencies:
"@babel/runtime": ^7.20.6
checksum: 8443cec44862d3e110f236b1120d8a1f829cb4545a85c8462e6c01935aa216f50b05eb659661db29939d4d293ce7de6212bf877963e3b37f6c900629f6546d67
languageName: node
linkType: hard

"react-native-fs@npm:^2.20.0":
version: 2.20.0
resolution: "react-native-fs@npm:2.20.0"
Expand Down

0 comments on commit 1fe2492

Please sign in to comment.