Skip to content

Commit

Permalink
Merge branch 'andrew_testing' into feat/tamagui_landing_page
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammadHassan03 committed Aug 28, 2024
2 parents 5c1ef27 + 5aeaaca commit c717f2a
Show file tree
Hide file tree
Showing 10 changed files with 639 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ PUBLIC_X_RAPIDAPI_KEY="Your api key"
PUBLIC_MAPBOX_ACCESS_TOKEN="Your api key, starts with pk..."
PUBLIC_MAPBOX_DOWNLOADS_TOKEN="Your api key, starts with sk..."
PUBLIC_MAPBOX_DOWNLOADS_TOKEN2="Your api key, starts with sk..."
PUBLIC_BUGSNAG_API_KEY="Bugsnag api key"


# Google OAuth
PUBLIC_WEB_CLIENT_ID="Your Google OAuth web client ID"
Expand Down
1 change: 1 addition & 0 deletions apps/expo/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN="Your api key, starts with pk..."
EXPO_PUBLIC_ANDROID_CLIENT_ID="962352557394-........................apps.googleusercontent.com"
EXPO_PUBLIC_IOS_CLIENT_ID="962352557394-........................apps.googleusercontent.com"
MAPBOX_DOWNLOADS_TOKEN="Your api key, starts with sk..."
EXPO_PUBLIC_BUGSNAG_API_KEY="Bugsnag api key"

1 change: 1 addition & 0 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"dependencies": {
"@babel/runtime": "^7.21.0",
"@bugsnag/expo": "^50.0.0",
"@expo/match-media": "^0.4.0",
"@expo/metro-runtime": "~3.1.3",
"@expo/vector-icons": "^14.0.0",
Expand Down
2 changes: 2 additions & 0 deletions apps/vite/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ VITE_PUBLIC_CLIENT_URL="Your client url"
VITE_PUBLIC_API_URL="Your api url"
VITE_PUBLIC_MAPBOX_ACCESS_TOKEN="Your api key, starts with pk..."
VITE_PUBLIC_WEB_CLIENT_ID="962352557394-..................apps.googleusercontent.com"
VITE_PUBLIC_BUGSNAG_API_KEY="Bugsnag api key"


18 changes: 18 additions & 0 deletions packages/app/provider/BugsnagProvider/Bugsnag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Bugsnag from '@bugsnag/expo';
import BugsnagPluginReact from '@bugsnag/plugin-react';
import BugsnagPluginExpoApp from '@bugsnag/plugin-expo-app';
import BugsnagPluginExpoDevice from '@bugsnag/plugin-expo-device';
import { BUGSNAG_API_KEY } from '@packrat/config';

if (BUGSNAG_API_KEY) {
Bugsnag.start({
apiKey: BUGSNAG_API_KEY,
plugins: [
BugsnagPluginReact,
BugsnagPluginExpoApp,
BugsnagPluginExpoDevice,
],
});
}

export default Bugsnag;
7 changes: 7 additions & 0 deletions packages/app/provider/BugsnagProvider/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';
import Bugsnag from './Bugsnag';
import { BUGSNAG_API_KEY } from '@packrat/config';

export const BugsnagErrorBoundary = BUGSNAG_API_KEY
? Bugsnag.getPlugin('react')?.createErrorBoundary(React)
: React.Fragment;
19 changes: 11 additions & 8 deletions packages/app/provider/CombinedProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import React from 'react';
import { SessionProvider } from '../context/Auth/SessionProvider';
import { ThemeProvider } from '../context/theme';
import { TrpcTanstackProvider } from './TrpcTanstackProvider';
import { BugsnagErrorBoundary } from './BugsnagProvider';
import { JotaiProvider } from './JotaiProvider';
import { TrpcTanstackProvider } from './TrpcTanstackProvider';
import { useAttachListeners } from './useAttachListeners';

export function CombinedProvider({ children }: { children: React.ReactNode }) {
useAttachListeners();

return (
<JotaiProvider>
<TrpcTanstackProvider>
<SessionProvider>
<ThemeProvider>{children}</ThemeProvider>
</SessionProvider>
</TrpcTanstackProvider>
</JotaiProvider>
<BugsnagErrorBoundary>
<JotaiProvider>
<TrpcTanstackProvider>
<SessionProvider>
<ThemeProvider>{children}</ThemeProvider>
</SessionProvider>
</TrpcTanstackProvider>
</JotaiProvider>
</BugsnagErrorBoundary>
);
}
6 changes: 6 additions & 0 deletions packages/config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { viteSource } from './sources/vite';
*/

// Simplifying environment variable access using logical OR

const API_URL =
viteSource.VITE_PUBLIC_API_URL ||
process.env.NEXT_PUBLIC_API_URL ||
Expand All @@ -26,6 +27,10 @@ const MAPBOX_ACCESS_TOKEN =
viteSource.VITE_PUBLIC_MAPBOX_ACCESS_TOKEN ||
process.env.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN ||
process.env.EXPO_PUBLIC_MAPBOX_ACCESS_TOKEN;
const BUGSNAG_API_KEY =
viteSource.VITE_PUBLIC_BUGSNAG_API_KEY ||
process.env.NEXT_PUBLIC_BUGSNAG_API_KEY ||
process.env.EXPO_PUBLIC_BUGSNAG_API_KEY;
const APP =
viteSource.VITE_PUBLIC_APP ||
process.env.NEXT_PUBLIC_APP ||
Expand All @@ -42,6 +47,7 @@ export {
IOS_CLIENT_ID,
ANDROID_CLIENT_ID,
MAPBOX_ACCESS_TOKEN,
BUGSNAG_API_KEY,
APP,
CLIENT_URL,
NODE_ENV,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "../../tsconfig.base", // not set up yet
"include": ["src"],
"include": ["src", "../../apps/expo/app/Bugsnag.ts"],
"compilerOptions": {
"composite": true,
"jsx": "react-jsx"
Expand Down
Loading

0 comments on commit c717f2a

Please sign in to comment.