Skip to content

Commit

Permalink
adding check for fullstory on production environment
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldoglas committed Apr 23, 2024
1 parent 0c5a8c9 commit 5a22573
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/libs/fullstory/index.native.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -22,9 +24,14 @@ const FS = {
*/
consentAndIdentify: (value: OnyxEntry<UserMetadata>) => {
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
}
Expand Down

0 comments on commit 5a22573

Please sign in to comment.