Skip to content

Commit

Permalink
also send id with getConfig and track
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiCheng-Lu committed Nov 18, 2024
1 parent e4addfa commit 49c363f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Http from '../http';
import Logger from '../logger';
import Session from '../session';
import Navigator from '../navigator';
import Storage from '../storage';

import type { RadarTrackParams } from '../types';

Expand All @@ -16,12 +17,14 @@ class ConfigAPI {
return;
}

const id = Storage.getItem(Storage.ID) || undefined;
const deviceId = params.deviceId || Device.getDeviceId();
const installId = params.installId || Device.getInstallId();
const sessionId = Session.getSessionId();
const locationAuthorization = await Navigator.getPermissionStatus();

const data = {
const data: any = {
id,
deviceId,
installId,
sessionId,
Expand Down
3 changes: 3 additions & 0 deletions src/api/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TrackAPI {
}

// user indentification fields
const id = Storage.getItem(Storage.ID) || undefined; // `undefined` so it's removed from any fields
const userId = params.userId || Storage.getItem(Storage.USER_ID);
const deviceId = params.deviceId || Device.getDeviceId();
const installId = params.installId || Device.getInstallId();
Expand Down Expand Up @@ -84,6 +85,7 @@ class TrackAPI {
userId,
tripOptions,
timeZone,
id,
};

let response: any;
Expand All @@ -99,6 +101,7 @@ class TrackAPI {
method: 'GET',
path: 'config',
data: {
id,
deviceId,
installId,
sessionId,
Expand Down

0 comments on commit 49c363f

Please sign in to comment.