From 5a225730b3fa3f2647c1b3f17f7e83a6131b0dc3 Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Tue, 23 Apr 2024 21:38:09 +0200 Subject: [PATCH] adding check for fullstory on production environment --- src/libs/fullstory/index.native.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libs/fullstory/index.native.ts b/src/libs/fullstory/index.native.ts index 10f225ae5c67..c090428fe900 100644 --- a/src/libs/fullstory/index.native.ts +++ b/src/libs/fullstory/index.native.ts @@ -1,6 +1,8 @@ import FullStory, {FSPage} from '@fullstory/react-native'; import type {OnyxEntry} from 'react-native-onyx'; import type {UserMetadata} from '@src/types/onyx'; +import * as Environment from '@src/libs/Environment/Environment'; +import CONST from '@src/CONST'; /** * Fullstory React-Native lib adapter @@ -22,9 +24,14 @@ const FS = { */ consentAndIdentify: (value: OnyxEntry) => { try { - // set consent - FullStory.consent(true); - FS.fsIdentify(value); + Environment.getEnvironment().then((envName: string) => { + if(CONST.ENVIRONMENT.PRODUCTION !== envName) { + return; + } + // We only use FullStory in production environment + FullStory.consent(true); + FS.fsIdentify(value); + }); } catch (e) { // error handler }