Skip to content

Commit

Permalink
Explicitly pass app theme style to analytics
Browse files Browse the repository at this point in the history
Cal-L committed Mar 9, 2022
1 parent 62aea77 commit cb98bc8
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ exports[`SlippageSlider should render correctly 1`] = `
>
<Path
d="M0 8C0 3.58172 3.58172 0 8 0H32C36.4183 0 40 3.58172 40 8V20.6866C40 25.1049 36.4183 28.6866 32 28.6866H27.7778L20 36L12.2222 28.6866H8C3.58172 28.6866 0 25.1049 0 20.6866V8Z"
fill="#00000060"
fill="#00000075"
/>
</Svg>
<Text
6 changes: 4 additions & 2 deletions app/core/Analytics.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import { METRICS_OPT_IN, AGREED, DENIED } from '../constants/storage';
import { NativeModules } from 'react-native';
import { Appearance, NativeModules } from 'react-native';
import DefaultPreference from 'react-native-default-preference';
import Logger from '../util/Logger';
import { ANALYTICS_EVENTS_V2 } from '../util/analyticsV2';
@@ -56,6 +56,8 @@ class Analytics {
const reduxState = store.getState();
const preferencesController = reduxState?.engine?.backgroundState?.PreferencesController;
const appTheme = reduxState?.user?.appTheme;
// This will return either "light" or "dark"
const appThemeStyle = appTheme === 'os' ? Appearance.getColorScheme() : appTheme;

RCTAnalytics.setUserProfileProperty(
USER_PROFILE_PROPERTY.ENABLE_OPENSEA_API,
@@ -65,7 +67,7 @@ class Analytics {
USER_PROFILE_PROPERTY.NFT_AUTODETECTION,
preferencesController?.useCollectibleDetection ? USER_PROFILE_PROPERTY.ON : USER_PROFILE_PROPERTY.OFF
);
RCTAnalytics.setUserProfileProperty(USER_PROFILE_PROPERTY.THEME, appTheme);
RCTAnalytics.setUserProfileProperty(USER_PROFILE_PROPERTY.THEME, appThemeStyle);
};

/**

0 comments on commit cb98bc8

Please sign in to comment.