Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Commit

Permalink
Remove apollo client (#135)
Browse files Browse the repository at this point in the history
* Remove apollo client
* Fix tsc by removing queries
  • Loading branch information
hyochan authored Jun 9, 2020
1 parent a590f7e commit 8800b53
Show file tree
Hide file tree
Showing 32 changed files with 1,820 additions and 1,725 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
3. [VSCODE](https://code.visualstudio.com)
- We are using `vscode` as our ide. Please install `eslint` plugin.
4. [Graphql](https://graphql.org)
5. [Apollo Client](https://www.apollographql.com/docs/react/why-apollo)
5. [Relay](https://relay.dev)

### Installation

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
- [@testing-library/react-native](https://www.native-testing-library.com/docs/install)
- [react-hook](https://reactjs.org/docs/hooks-intro.html)
- [graphql](https://graphql.org)
- [apollo-client](https://www.apollographql.com/docs/react)
- [relay](https://relay.dev)

### Gain points

Expand Down Expand Up @@ -60,7 +60,6 @@ app/
├─ node_modules/
├─ src/
│ └─ apis
│ └─ apollo
│ └─ components
│ └─ navigations
│ └─ screen
Expand Down
4 changes: 0 additions & 4 deletions ios/HackaTalk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@
"${BUILT_PRODUCTS_DIR}/UMAppLoader/UMAppLoader.framework",
"${BUILT_PRODUCTS_DIR}/UMCore/UMCore.framework",
"${BUILT_PRODUCTS_DIR}/UMPermissionsInterface/UMPermissionsInterface.framework",
"${BUILT_PRODUCTS_DIR}/UMReactNativeAdapter/UMReactNativeAdapter.framework",
"${PODS_ROOT}/VSCCrypto/Carthage/iOS/VSCCommon.framework",
"${PODS_ROOT}/VSCCrypto/Carthage/iOS/VSCFoundation.framework",
"${PODS_ROOT}/VSCCrypto/Carthage/iOS/VSCPythia.framework",
Expand Down Expand Up @@ -652,7 +651,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMAppLoader.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMPermissionsInterface.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMReactNativeAdapter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VSCCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VSCFoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VSCPythia.framework",
Expand Down Expand Up @@ -754,7 +752,6 @@
"${BUILT_PRODUCTS_DIR}/UMAppLoader/UMAppLoader.framework",
"${BUILT_PRODUCTS_DIR}/UMCore/UMCore.framework",
"${BUILT_PRODUCTS_DIR}/UMPermissionsInterface/UMPermissionsInterface.framework",
"${BUILT_PRODUCTS_DIR}/UMReactNativeAdapter/UMReactNativeAdapter.framework",
"${PODS_ROOT}/VSCCrypto/Carthage/iOS/VSCCommon.framework",
"${PODS_ROOT}/VSCCrypto/Carthage/iOS/VSCFoundation.framework",
"${PODS_ROOT}/VSCCrypto/Carthage/iOS/VSCPythia.framework",
Expand Down Expand Up @@ -824,7 +821,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMAppLoader.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMPermissionsInterface.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UMReactNativeAdapter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VSCCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VSCFoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VSCPythia.framework",
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ SPEC CHECKSUMS:
UMFontInterface: d9d3b27af698c5389ae9e20b99ef56a083f491fb
UMImageLoaderInterface: 14dd2c46c67167491effc9e91250e9510f12709e
UMPermissionsInterface: 5e83a9167c177e4a0f0a3539345983cc749efb3e
UMReactNativeAdapter: 126da3486c1a1f11945b649d557d6c2ebb9407b2
UMReactNativeAdapter: a4221ffb5a4a7f2d078f988b2a864b025e2421aa
UMSensorsInterface: 48941f70175e2975af1a9386c6d6cb16d8126805
UMTaskManagerInterface: cb890c79c63885504ddc0efd7a7d01481760aca2
VirgilCrypto: c2831582c5230eeb2adba2365336c768cd6d8c59
Expand Down
8 changes: 0 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"build:android": "ENVFILE=.env.prod react-native bundle --entry-file index.js --platform android --dev false --verbose --bundle-output android/main.jsbundle --assets-dest ./android"
},
"dependencies": {
"@apollo/react-hooks": "^3.1.5",
"@dooboo-ui/native": "^0.6.3",
"@dooboo-ui/native-pinch-zoom-slider-modal": "^0.0.5",
"@dooboo-ui/native-theme": "^0.1.7",
Expand All @@ -51,14 +50,8 @@
"@react-navigation/stack": "^5.4.0",
"@virgilsecurity/e3kit-native": "^2.3.1",
"@virgilsecurity/key-storage-rn": "^1.0.0",
"apollo-boost": "^0.4.9",
"apollo-link": "^1.2.14",
"apollo-link-context": "^1.0.20",
"apollo-link-error": "^1.1.13",
"apollo-link-ws": "^1.0.20",
"expo": "~37.0.3",
"expo-updates": "~0.2.0",
"apollo-utilities": "^1.3.4",
"expo-apple-authentication": "^2.1.1",
"expo-asset": "~8.1.5",
"expo-constants": "^9.0.0",
Expand Down Expand Up @@ -104,7 +97,6 @@
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@apollo/react-testing": "^3.1.4",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-class-properties": "^7.8.3",
Expand Down
31 changes: 13 additions & 18 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Device from 'expo-device';

import { ApolloProvider, useQuery } from '@apollo/react-hooks';
import { AppearanceProvider, useColorScheme } from 'react-native-appearance';
import { AuthProvider, useAuthContext } from './providers/AuthProvider';
import { DeviceProvider, useDeviceContext } from './providers/DeviceProvider';
Expand All @@ -12,10 +11,8 @@ import { dark, light } from './theme';
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
import AsyncStorage from '@react-native-community/async-storage';
import Config from 'react-native-config';
import { QUERY_ME } from './graphql/queries';
import RootNavigator from './components/navigation/RootStackNavigator';
import { User } from './types';
import client from './apollo/Client';
import { initializeEThree } from './utils/virgil';

const onReceived = (notification: ReceivedNotification): void => {
Expand All @@ -37,22 +34,22 @@ function AppWithTheme(): ReactElement {
const { setUser } = useAuthContext();
const { setDeviceType } = useDeviceContext();

const { loading, data } = useQuery<{ me: User }>(QUERY_ME);
// const { loading, data } = useQuery<{ me: User }>(QUERY_ME);

const setDevice = async (): Promise<void> => {
const deviceType = await Device.getDeviceTypeAsync();
setDeviceType(deviceType);
};

useEffect(() => {
if (data && data.me) {
initializeEThree(data.me.id);
setUser(data.me);
} else if (data) {
AsyncStorage.removeItem('token');
}
setDevice();
}, [loading]);
// useEffect(() => {
// if (data && data.me) {
// initializeEThree(data.me.id);
// setUser(data.me);
// } else if (data) {
// AsyncStorage.removeItem('token');
// }
// setDevice();
// }, [loading]);

return <RootNavigator />;
}
Expand Down Expand Up @@ -90,11 +87,9 @@ function ProviderWrapper(): ReactElement {
<AppearanceProvider>
<DeviceProvider>
<AuthProvider>
<ApolloProvider client={client}>
<ActionSheetProvider>
<App />
</ActionSheetProvider>
</ApolloProvider>
<ActionSheetProvider>
<App />
</ActionSheetProvider>
</AuthProvider>
</DeviceProvider>
</AppearanceProvider>
Expand Down
68 changes: 0 additions & 68 deletions src/apollo/Client.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/apollo/testClient.ts

This file was deleted.

43 changes: 19 additions & 24 deletions src/components/screen/ChangePw.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Alert, EmitterSubscription, Keyboard, KeyboardEvent, Platform, SafeAreaView } from 'react-native';
import { Button, EditText } from '@dooboo-ui/native';
import { MUTATION_CHANGE_PASSWORD, MutationChangePasswordInput } from '../../graphql/mutations';
import React, {
ReactElement,
useEffect,
Expand All @@ -13,7 +12,6 @@ import { MainStackNavigationProps } from '../navigation/MainStackNavigator';
import { getString } from '../../../STRINGS';
import { isIPhoneX } from '../../utils/Styles';
import styled from 'styled-components/native';
import { useMutation } from '@apollo/react-hooks';
import { useThemeContext } from '@dooboo-ui/native-theme';

const InnerContainer = styled.View`
Expand All @@ -40,9 +38,6 @@ function ChangePw(props: Props): ReactElement {
const [currentPw, setCurrentPw] = useState('');
const [newPw, setNewPw] = useState('');
const [confirmPw, setConfirmPw] = useState('');
const [changePassword] = useMutation<{ changeEmailPassword: boolean }, MutationChangePasswordInput>(
MUTATION_CHANGE_PASSWORD,
);

const navigateBack = (): void => navigation.goBack();

Expand All @@ -57,25 +52,25 @@ function ChangePw(props: Props): ReactElement {
newPassword: newPw,
};

try {
const result = await changePassword({ variables });
if (result.data?.changeEmailPassword) {
Keyboard.dismiss();
Alert.alert('', getString('PASSWORD_IS_CHANGED'), [
{
text: getString('OK'),
onPress: navigateBack,
},
]);
}
} catch (e) {
Alert.alert('', getString('CHANGE_PASSWORD_HAS_FAILED'), [
{
text: getString('OK'),
onPress: navigateBack,
},
]);
}
// try {
// const result = await changePassword({ variables });
// if (result.data?.changeEmailPassword) {
// Keyboard.dismiss();
// Alert.alert('', getString('PASSWORD_IS_CHANGED'), [
// {
// text: getString('OK'),
// onPress: navigateBack,
// },
// ]);
// }
// } catch (e) {
// Alert.alert('', getString('CHANGE_PASSWORD_HAS_FAILED'), [
// {
// text: getString('OK'),
// onPress: navigateBack,
// },
// ]);
// }
};

const [keyboardOffset, setKeyboardOffset] = useState(0);
Expand Down
24 changes: 11 additions & 13 deletions src/components/screen/FindPw.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Button, EditText } from '@dooboo-ui/native';
import { MUTATION_FIND_PASSWORD, MutationFindPasswordInput } from '../../graphql/mutations';
import React, { ReactElement, useState } from 'react';
import { showAlertForGrpahqlError, validateEmail } from '../../utils/common';
import { Alert } from 'react-native';

import { Alert } from 'react-native';
import { AuthStackNavigationProps } from '../navigation/AuthStackNavigator';
import { getString } from '../../../STRINGS';
import styled from 'styled-components/native';
import { useMutation } from '@apollo/react-hooks';
import { useThemeContext } from '@dooboo-ui/native-theme';

const Container = styled.View`
Expand All @@ -34,7 +32,7 @@ function Page({ navigation }: Props): ReactElement {
const [findingPw, setFindingPw] = useState<boolean>(false);

const { theme } = useThemeContext();
const [findPassword] = useMutation<{ findPassword: boolean }, MutationFindPasswordInput>(MUTATION_FIND_PASSWORD);
// const [findPassword] = useMutation<{ findPassword: boolean }, MutationFindPasswordInput>(MUTATION_FIND_PASSWORD);

const navigateToSignIn = (): void => navigation.navigate('SignIn');

Expand All @@ -46,15 +44,15 @@ function Page({ navigation }: Props): ReactElement {

try {
setFindingPw(true);
const result = await findPassword({ variables: { email } });
if (result.data?.findPassword) {
Alert.alert('', getString('PASSWORD_RESET_EMAIL_SENT'), [
{
text: getString('OK'),
onPress: navigateToSignIn,
},
]);
}
// const result = await findPassword({ variables: { email } });
// if (result.data?.findPassword) {
// Alert.alert('', getString('PASSWORD_RESET_EMAIL_SENT'), [
// {
// text: getString('OK'),
// onPress: navigateToSignIn,
// },
// ]);
// }
} catch ({ graphQLErrors }) {
showAlertForGrpahqlError(graphQLErrors);
} finally {
Expand Down
Loading

0 comments on commit 8800b53

Please sign in to comment.