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

Commit

Permalink
Cleanup ethree when signout
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Jun 5, 2020
1 parent f948ec5 commit 63a5ead
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/screen/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AuthType } from '../../types';
import { Button } from '@dooboo-ui/native';
import { FontAwesome } from '@expo/vector-icons';
import { MainStackNavigationProps } from '../navigation/MainStackNavigator';
import { cleanupEThree } from '../../utils/virgil';
import { getString } from '../../../STRINGS';
import { useAuthContext } from '../../providers/AuthProvider';
import { useThemeContext } from '@dooboo-ui/native-theme';
Expand Down Expand Up @@ -80,6 +81,7 @@ function Settings(props: Props): React.ReactElement {
let signInInfoOption: SettingsOption;

const logout = (): void => {
cleanupEThree();
if (navigation) {
AsyncStorage.removeItem('token');
setUser(undefined);
Expand Down
4 changes: 4 additions & 0 deletions src/utils/virgil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,7 @@ export const initializeEThree = async (userId: string): Promise<void> => {
console.log('Ethree register error', err);
}
};

export const cleanupEThree = async (): Promise<void> => {
if (eThree) eThree.cleanup();
};

0 comments on commit 63a5ead

Please sign in to comment.