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

feat: add MetaMetrics delete on Wallet delete #9768

Merged
merged 6 commits into from
May 30, 2024
3 changes: 3 additions & 0 deletions app/components/hooks/DeleteWallet/useDeleteWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { EXISTING_USER } from '../../../constants/storage';
import { Authentication } from '../../../core';
import AUTHENTICATION_TYPE from '../../../constants/userProperties';
import { resetVaultBackup } from '../../../core/BackupVault/backupVault';
import { MetaMetrics } from '../../../core/Analytics';

const useDeleteWallet = () => {
const resetWalletState = useCallback(async () => {
Expand All @@ -21,8 +22,10 @@ const useDeleteWallet = () => {
}, []);

const deleteUser = useCallback(async () => {
const metrics = MetaMetrics.getInstance();
try {
await AsyncStorage.removeItem(EXISTING_USER);
await metrics.createDataDeletionTask();
} catch (error: any) {
const errorMsg = `Failed to remove key: ${EXISTING_USER} from AsyncStorage`;
Logger.log(error, errorMsg);
Expand Down
Loading