TP-70213 | Bundle Version Addition in Clickstream Events (#11439)
This commit is contained in:
@@ -45,6 +45,7 @@ export const EVENT_NAMES = {
|
||||
|
||||
export const EVENT_PROPERTY_KEYS = {
|
||||
STATUS: "status",
|
||||
BUNDLE_VERSION: "bundleVersion",
|
||||
};
|
||||
|
||||
export const EVENT_PROPERTY_VALUES = {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getBundleVersion } from "../../../network/NetworkUtils";
|
||||
import { EVENT_PROPERTY_KEYS } from "../constants";
|
||||
import { AnalyticsEvent } from "../interface";
|
||||
import { NativeAnalyticsModule } from "../native-module/NativeModules";
|
||||
|
||||
@@ -10,10 +12,14 @@ export const useAnalyticsEvent = () => {
|
||||
};
|
||||
|
||||
export const sendAsAnalyticsEvent = (analyticsEvent: AnalyticsEvent) => {
|
||||
const eventName = analyticsEvent.name;
|
||||
const propertiesWithBundleVersion = {
|
||||
...analyticsEvent.properties,
|
||||
[EVENT_PROPERTY_KEYS.BUNDLE_VERSION]: getBundleVersion().toString(),
|
||||
};
|
||||
|
||||
NativeAnalyticsModule.sendAsAnalyticsEvent(
|
||||
eventName,
|
||||
analyticsEvent.properties,
|
||||
analyticsEvent.name,
|
||||
propertiesWithBundleVersion,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@ const getDeviceId = async () => {
|
||||
return await getStringPreference("DEVICE_ID", "string");
|
||||
};
|
||||
|
||||
export const getBundleVersion = () => {
|
||||
return packageJson.versionCode;
|
||||
};
|
||||
|
||||
const addBundleVersionToHeader = (axiosInstance: AxiosInstance) => {
|
||||
axiosInstance.interceptors.request.use(requestConfig => {
|
||||
requestConfig.headers[BUNDLE_VERSION] = (packageJson as any).versionCode;
|
||||
requestConfig.headers[BUNDLE_VERSION] = getBundleVersion();
|
||||
return requestConfig;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "NaviApp",
|
||||
"version": "0.2.1",
|
||||
"versionCode": 6,
|
||||
"version": "0.2.2",
|
||||
"versionCode": 7,
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "yarn react-native start",
|
||||
|
||||
Reference in New Issue
Block a user