Skip to content

Commit eb89b08

Browse files
Remove more legacy analytics logic (#9817)
* Remove more legacy analytics logic * Remove more legacy analytics logic * review comment * use raw strings
1 parent 7d9ae43 commit eb89b08

5 files changed

Lines changed: 11 additions & 55 deletions

File tree

packages/devtools_app/lib/src/shared/server/_analytics_api.dart

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@
44

55
part of 'server.dart';
66

7-
/// Request DevTools property value 'firstRun' (GA dialog) stored in the file
8-
/// '~/flutter-devtools/.devtools'.
9-
Future<bool> isFirstRun() async {
10-
bool firstRun = false;
11-
if (isDevToolsServerAvailable) {
12-
final resp = await request(apiGetDevToolsFirstRun);
13-
if (resp?.statusCode == 200) {
14-
firstRun = json.decode(resp!.body);
15-
} else {
16-
logWarning(resp, apiGetDevToolsFirstRun);
17-
}
18-
}
19-
return firstRun;
20-
}
21-
227
/// Requests the Flutter client id from the Flutter store file ~\.flutter.
238
///
249
/// If an empty String is returned, this means that Flutter Tool has never been

packages/devtools_shared/CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ Use of this source code is governed by a BSD-style license that can be
44
found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
55
-->
66
# 13.0.0-wip
7-
* Deprecated `DevToolsStoreKeys.analyticsEnabled` since this is only used for legacy analytics.
8-
* **Breaking change:** Removed legacy analytics APIs and state cleanup (e.g. `apiGetFlutterGAEnabled`, `apiGetDevToolsEnabled`, `apiSetDevToolsEnabled`).
7+
* **Breaking change:** Removed `DevToolsStoreKeys.analyticsEnabled` and
8+
`DevToolsStoreKeys.isFirstRun` since these were only used for legacy analytics.
9+
* **Breaking change:** Removed legacy analytics APIs and state cleanup
10+
(e.g. `apiGetFlutterGAEnabled`, `apiGetDevToolsEnabled`, `apiSetDevToolsEnabled`, `apiGetDevToolsFirstRun`, `apiResetDevTools`).
911
* **Breaking change:** Removed public constant `devToolsEnabledPropertyName`.
10-
* **Breaking change:** Removed the `analyticsEnabled` getter and setter from `DevToolsUsage`.
12+
* **Breaking change:** Removed `isFirstRun`, `reset`, and `analyticsEnabled` from `DevToolsUsage`.
1113

1214
# 12.1.0
1315
* Adds additional logging to `IntegrationTestRunner`.

packages/devtools_shared/lib/src/devtools_api.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ const apiParameterVmServiceConnected = 'connected';
1717
/// Flutter GA properties APIs:
1818
const apiGetFlutterGAClientId = '${apiPrefix}getFlutterGAClientId';
1919

20-
/// DevTools GA properties APIs:
21-
const apiResetDevTools = '${apiPrefix}resetDevTools';
22-
const apiGetDevToolsFirstRun = '${apiPrefix}getDevToolsFirstRun';
23-
2420
abstract class PreferencesApi {
2521
/// Returns the preference value in the DevTools store file for the key
2622
/// specified by the [preferenceKeyProperty] query parameter.

packages/devtools_shared/lib/src/server/devtools_store.dart

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@
55
import 'file_system.dart';
66

77
enum DevToolsStoreKeys {
8-
/// The key holding the value for whether Google Analytics (legacy) for
9-
/// DevTools have been enabled.
10-
@Deprecated(
11-
'Use unified_analytics instead; this key is for legacy analytics and will '
12-
'be removed.',
13-
)
14-
analyticsEnabled,
15-
16-
/// The key holding the value for whether this is a user's first run of
17-
/// DevTools.
18-
isFirstRun,
19-
208
/// The key holding the value for the last DevTools version that the user
219
/// viewed release notes for.
2210
lastReleaseNotesVersion,
@@ -59,19 +47,14 @@ class DevToolsUsage {
5947

6048
late IOPersistentProperties properties;
6149

62-
void reset() {
63-
properties.remove(DevToolsStoreKeys.isFirstRun.name);
64-
}
65-
6650
void _removeLegacyKeys() {
6751
// TODO(https://github.com/flutter/devtools/issues/9775): remove this logic
68-
// once legacy keys have been removed for ~1 year.
69-
properties.remove(DevToolsStoreKeys.analyticsEnabled.name);
70-
}
71-
72-
bool get isFirstRun {
73-
return properties[DevToolsStoreKeys.isFirstRun.name] =
74-
properties[DevToolsStoreKeys.isFirstRun.name] == null;
52+
// once legacy keys have been removed for ~1 year. We are intentionally
53+
// using raw strings instead of values from [DevToolsStoreKeys] to avoid
54+
// unnecessary breaking changes in the future.
55+
properties
56+
..remove('analyticsEnabled')
57+
..remove('isFirstRun');
7558
}
7659

7760
bool surveyNameExists(String surveyName) => properties[surveyName] != null;

packages/devtools_shared/lib/src/server/server_api.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,6 @@ class ServerApi {
8282
api: api,
8383
);
8484

85-
// ----- DevTools Store. -----
86-
87-
case apiResetDevTools:
88-
_devToolsStore.reset();
89-
return _encodeResponse(true, api: api);
90-
case apiGetDevToolsFirstRun:
91-
// Has DevTools been run first time? To bring up analytics dialog.
92-
final isFirstRun = _devToolsStore.isFirstRun;
93-
return _encodeResponse(isFirstRun, api: api);
94-
9585
// ----- Preferences api. -----
9686
case PreferencesApi.getPreferenceValue:
9787
return _PreferencesApiHandler.getPreferenceValue(

0 commit comments

Comments
 (0)