Skip to content

Commit

Permalink
Revert "attach account attributes to trace"
Browse files Browse the repository at this point in the history
This reverts commit 49ea16b.
  • Loading branch information
TMisiukiewicz committed Jul 25, 2024
1 parent 85137b5 commit c331083
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 29 deletions.
10 changes: 0 additions & 10 deletions src/libs/Firebase/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import crashlytics from '@react-native-firebase/crashlytics';
import perf from '@react-native-firebase/perf';
import * as Environment from '@libs/Environment/Environment';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as ReportConnection from '@libs/ReportConnection';
import * as SessionUtils from '@libs/SessionUtils';
import type {Log, StartTrace, StopTrace, TraceMap} from './types';

const traceMap: TraceMap = {};
Expand All @@ -15,20 +12,13 @@ const startTrace: StartTrace = (customEventName) => {
return;
}

const countAllReports = ReportConnection.countAllReports();
const countPersonalDetails = PersonalDetailsUtils.countPersonalDetails();
const session = SessionUtils.getSession();

if (traceMap[customEventName]) {
return;
}

perf()
.startTrace(customEventName)
.then((trace) => {
trace.putAttribute('accountID', session?.accountID?.toString() ?? 'N/A');
trace.putAttribute('reports', countAllReports.toString());
trace.putAttribute('personalDetails', countPersonalDetails.toString());
traceMap[customEventName] = {
trace,
start,
Expand Down
5 changes: 0 additions & 5 deletions src/libs/PersonalDetailsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@ function isPersonalDetailsEmpty() {
return !personalDetails.length;
}

function countPersonalDetails() {
return personalDetails.length;
}

export {
isPersonalDetailsEmpty,
getDisplayNameOrDefault,
Expand All @@ -329,5 +325,4 @@ export {
createDisplayName,
extractFirstAndLastNameFromAvailableDetails,
getNewAccountIDsAndLogins,
countPersonalDetails,
};
6 changes: 1 addition & 5 deletions src/libs/ReportConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,4 @@ function getAllReportsNameMap() {
return reportIDToNameMap;
}

function countAllReports() {
return allReports ? Object.keys(allReports).length : 0;
}

export {getAllReports, getAllReportsNameMap, countAllReports};
export {getAllReports, getAllReportsNameMap};
10 changes: 1 addition & 9 deletions src/libs/SessionUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import Onyx from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import ONYXKEYS from '@src/ONYXKEYS';
import type * as OnyxTypes from '@src/types/onyx';

/**
* Determine if the transitioning user is logging in as a new user.
Expand All @@ -28,14 +26,12 @@ function isLoggingInAsNewUser(transitionURL?: string, sessionEmail?: string): bo
}

let loggedInDuringSession: boolean | undefined;
let currentSession: OnyxEntry<OnyxTypes.Session>;

// To tell if the user logged in during this session we will check the value of session.authToken once when the app's JS inits. When the user logs out
// we can reset this flag so that it can be updated again.
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (session) => {
currentSession = session;
if (loggedInDuringSession) {
return;
}
Expand All @@ -57,8 +53,4 @@ function didUserLogInDuringSession() {
return !!loggedInDuringSession;
}

function getSession() {
return currentSession;
}

export {isLoggingInAsNewUser, didUserLogInDuringSession, resetDidUserLogInDuringSession, getSession};
export {isLoggingInAsNewUser, didUserLogInDuringSession, resetDidUserLogInDuringSession};

0 comments on commit c331083

Please sign in to comment.