From d58c20291f89d02529f3d22dd5ebaef9b1d68448 Mon Sep 17 00:00:00 2001 From: iGroza Date: Wed, 21 Aug 2024 18:37:19 +0700 Subject: [PATCH] fix: posthog id --- src/services/event-tracker.ts | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/services/event-tracker.ts b/src/services/event-tracker.ts index 70f82bc19..99b2e482c 100644 --- a/src/services/event-tracker.ts +++ b/src/services/event-tracker.ts @@ -2,7 +2,6 @@ import PostHog from 'posthog-react-native'; import {Adjust, AdjustConfig, AdjustEvent} from 'react-native-adjust'; import {AdjustOaid} from 'react-native-adjust-oaid'; import Config from 'react-native-config'; -import EncryptedStorage from 'react-native-encrypted-storage'; import {app} from '@app/contexts'; import {Initializable} from '@app/helpers/initializable'; @@ -114,26 +113,14 @@ export class EventTracker extends Initializable { return this._posthog?.getDistinctId() || ''; } - // TODO: change default type to 'posthog' after removing adjust - async getAdid(type: 'adjust' | 'posthog' = 'adjust'): Promise { - let adid = await EncryptedStorage.getItem('adid'); - - if (!adid) { - switch (type) { - case 'posthog': - adid = await this.getPosthogAdid(); - break; - case 'adjust': - default: - adid = await this.getAdjustAdid(); - } - - if (adid) { - await EncryptedStorage.setItem('adid', adid); - } + async getAdid(type: 'adjust' | 'posthog' = 'posthog'): Promise { + switch (type) { + case 'adjust': + return await this.getAdjustAdid(); + case 'posthog': + default: + return await this.getPosthogAdid(); } - - return adid; } async setPushToken(token: string) {