Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: initial @comapeo/core-react integration #894

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
149 changes: 72 additions & 77 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"dependencies": {
"@bam.tech/react-native-image-resizer": "3.0.11",
"@comapeo/core-react": "1.1.0",
"@comapeo/ipc": "2.1.0",
"@expo-google-fonts/rubik": "0.2.3",
"@formatjs/intl-getcanonicallocales": "2.5.4",
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/Navigation/Stack/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import {useClientApi} from '@comapeo/core-react';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {NativeStackNavigationOptions} from '@react-navigation/native-stack/lib/typescript/src/types';
import {WHITE} from '../../lib/styles';
Expand All @@ -17,7 +18,6 @@ import {getInitialRouteName} from '../../utils/navigation';
import {createDefaultScreenGroup} from './AppScreens';
import {createOnboardingScreens} from './OnboardingScreens';
import {useSuspenseQuery} from '@tanstack/react-query';
import {useApi} from '../../contexts/ApiContext';
import {Loading} from '../../sharedComponents/Loading';
import {useSecurityContext} from '../../contexts/SecurityContext';
import {useNavigationFromRoot} from '../../hooks/useNavigationWithTypes';
Expand Down Expand Up @@ -63,7 +63,7 @@ function RootStackNavigatorChild() {
store => store.value,
);
const {data: presets} = usePresetsQuery();
const mapeoApi = useApi();
const mapeoApi = useClientApi();

const deviceInfo = useSuspenseQuery({
queryKey: [DEVICE_INFO_KEY],
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/contexts/ActiveProjectContext.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import {useClientApi} from '@comapeo/core-react';
import {type MapeoProjectApi} from '@comapeo/ipc';

import {usePersistedProjectId} from '../hooks/persistedState/usePersistedProjectId';
import {useProject, useCreateProject} from '../hooks/server/projects';
import {Loading} from '../sharedComponents/Loading';
import {useApi} from './ApiContext';

const ActiveProjectContext = React.createContext<
{projectId: string; projectApi: MapeoProjectApi} | undefined
Expand All @@ -13,7 +13,7 @@ const ActiveProjectContext = React.createContext<
export const ActiveProjectProvider = ({
children,
}: React.PropsWithChildren<{}>) => {
const mapeoApi = useApi();
const mapeoApi = useClientApi();

const activeProjectId = usePersistedProjectId(store => store.projectId);
const setActiveProjectId = usePersistedProjectId(store => store.setProjectId);
Expand Down
22 changes: 0 additions & 22 deletions src/frontend/contexts/ApiContext.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions src/frontend/contexts/AppProviders.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import {ClientApiProvider} from '@comapeo/core-react';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
import {StyleSheet} from 'react-native';
Expand All @@ -19,7 +20,6 @@ import {
} from './LocalDiscoveryContext';
import {type MapeoClientApi} from '@comapeo/ipc';
import {ServerLoading} from '../ServerLoading';
import {ApiProvider} from './ApiContext';
import {MessagePortLike} from '../lib/MessagePortLike';
import {IntlProvider} from './IntlContext';
import {BottomSheetModalProvider} from '@gorhom/bottom-sheet';
Expand Down Expand Up @@ -55,7 +55,7 @@ export const AppProviders = ({
<GPSModalContextProvider>
<ServerLoading messagePort={messagePort}>
<LocalDiscoveryProvider value={localDiscoveryController}>
<ApiProvider api={mapeoApi}>
<ClientApiProvider clientApi={mapeoApi}>
<MetricsProvider
appMetrics={appMetrics}
deviceMetrics={deviceMetrics}>
Expand All @@ -67,7 +67,7 @@ export const AppProviders = ({
</BottomSheetModalProvider>
</ActiveProjectProvider>
</MetricsProvider>
</ApiProvider>
</ClientApiProvider>
</LocalDiscoveryProvider>
</ServerLoading>
</GPSModalContextProvider>
Expand Down
Loading
Loading