From 77fcafb921d4d38339ed04cc1d7161099081a338 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 5 Apr 2024 23:36:14 +0200 Subject: [PATCH] chore: disable countly analytics Minimal changes to hide analytics UI components and stop sending opt-out metrics to instance which no longer works. Close #2198 --- src/bundles/analytics.js | 14 +++++++++++++- src/settings/SettingsPage.js | 14 +++++++++----- src/status/StatusPage.js | 4 +++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/bundles/analytics.js b/src/bundles/analytics.js index 0af2438ee..1f13db2eb 100644 --- a/src/bundles/analytics.js +++ b/src/bundles/analytics.js @@ -65,12 +65,18 @@ import { onlyOnceAfter } from '../lib/hofs/functions.js' * @property {number} lastDisabledAt * @property {string[]} consent * @property {boolean?} showAnalyticsBanner + * @property {boolean?} showAnalyticsComponents * @property {boolean?} optedOut * * @typedef {Object} State * @property {Model} analytics */ +// 2024-Q2: +// All analytics are disabled since we no longer use Countly instance. +// See https://github.com/ipfs/ipfs-webui/issues/2198 +const DISABLE_ALL_ANALYTICS = true + // Unknown actions (can't seem to see anything // dispatching those). const DESKTOP = Enum.from(['DESKTOP_SETTING_TOGGLE']) @@ -213,6 +219,11 @@ const selectors = { * @param {State} state */ selectAnalyticsOptedOut: (state) => state.analytics.optedOut, + /** + * Show or hide all UI compontent related to analytics. + * @param {State} state + */ + selectShowAnalyticsComponents: (state) => state.analytics.showAnalyticsComponents, /** * Show or hide the analytics banner. * @param {State} state @@ -442,8 +453,9 @@ const createAnalyticsBundle = ({ state = state || { lastEnabledAt: 0, lastDisabledAt: 0, + showAnalyticsComponents: DISABLE_ALL_ANALYTICS, // hide related UI for now, see https://github.com/ipfs/ipfs-webui/issues/2198 showAnalyticsBanner: false, - optedOut: false, + optedOut: !DISABLE_ALL_ANALYTICS, // disable analytics by default for now, see https://github.com/ipfs/ipfs-webui/issues/2198 consent: [] } diff --git a/src/settings/SettingsPage.js b/src/settings/SettingsPage.js index b1ccab602..e795e3391 100644 --- a/src/settings/SettingsPage.js +++ b/src/settings/SettingsPage.js @@ -33,6 +33,7 @@ export const SettingsPage = ({ isLoading, isSaving, arePinningServicesSupported, hasSaveFailed, hasSaveSucceded, hasErrors, hasLocalChanges, hasExternalChanges, config, onChange, onReset, onSave, editorKey, analyticsEnabled, doToggleAnalytics, + showAnalyticsComponents, toursEnabled, handleJoyrideCallback, isCliTutorModeEnabled, doToggleCliTutorMode, command }) => (
@@ -92,15 +93,17 @@ export const SettingsPage = ({ -
+
{t('language')}
-
- {t('analytics')} - -
+ { showAnalyticsComponents + ?
+ {t('analytics')} + +
+ : null } @@ -376,6 +379,7 @@ export default connect( 'selectConfigSaveLastError', 'selectIsIpfsDesktop', 'selectToursEnabled', + 'selectShowAnalyticsComponents', 'selectAnalyticsEnabled', 'selectArePinningServicesSupported', 'doToggleAnalytics', diff --git a/src/status/StatusPage.js b/src/status/StatusPage.js index 960626687..ae8c969ec 100644 --- a/src/status/StatusPage.js +++ b/src/status/StatusPage.js @@ -19,6 +19,7 @@ import withTour from '../components/tour/withTour.js' const StatusPage = ({ t, ipfsConnected, + showAnalyticsComponents, showAnalyticsBanner, doEnableAnalytics, doDisableAnalytics, @@ -53,7 +54,7 @@ const StatusPage = ({
- { ipfsConnected && showAnalyticsBanner && + { ipfsConnected && showAnalyticsComponents && showAnalyticsBanner &&