Skip to content

Commit 3476b96

Browse files
authored
Update helper message for --suppress-analytics (#124810)
Fixes: #124808
1 parent 5923075 commit 3476b96

File tree

3 files changed

+7
-39
lines changed

3 files changed

+7
-39
lines changed

packages/flutter_tools/lib/runner.dart

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,6 @@ Future<int> run(
8888
await globals.analytics.setTelemetry(value);
8989
}
9090

91-
// If the user has opted out of legacy analytics, we will continue
92-
// to opt them out of unified analytics and inform them
93-
if (!globals.flutterUsage.enabled && globals.analytics.telemetryEnabled) {
94-
await globals.analytics.setTelemetry(false);
95-
globals.logger.printStatus(
96-
'Please note that analytics reporting was already disabled, and will continue to be disabled.\n');
97-
}
98-
9991
await runner.run(args);
10092

10193
// Triggering [runZoned]'s error callback does not necessarily mean that
@@ -285,6 +277,11 @@ Future<int> _exit(int code, {required ShutdownHooks shutdownHooks}) async {
285277
// Ensure that the consent message has been displayed for unified analytics
286278
if (globals.analytics.shouldShowMessage) {
287279
globals.logger.printStatus(globals.analytics.getConsentMessage);
280+
if (!globals.flutterUsage.enabled) {
281+
globals.printStatus(
282+
'Please note that analytics reporting was already disabled, '
283+
'and will continue to be disabled.\n');
284+
}
288285

289286
// Because the legacy analytics may have also sent a message,
290287
// the conditional below will print additional messaging informing
@@ -296,8 +293,7 @@ Future<int> _exit(int code, {required ShutdownHooks shutdownHooks}) async {
296293
'the flutter tool is migrating to a new analytics system. '
297294
'Disabling analytics collection will disable both the legacy '
298295
'and new analytics collection systems. '
299-
'You can disable analytics reporting by running either `flutter --disable-telemetry` '
300-
'or `flutter config --no-analytics\n');
296+
'You can disable analytics reporting by running `flutter --disable-telemetry`\n');
301297
}
302298

303299
// Invoking this will onboard the flutter tool onto

packages/flutter_tools/lib/src/runner/flutter_command_runner.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class FlutterCommandRunner extends CommandRunner<void> {
7777
help: 'Allow Flutter to check for updates when this command runs.');
7878
argParser.addFlag('suppress-analytics',
7979
negatable: false,
80-
help: 'Suppress analytics reporting when this command runs.');
80+
help: 'Suppress analytics reporting for the current CLI invocation.');
8181
argParser.addFlag('disable-telemetry',
8282
negatable: false,
8383
help: 'Disable telemetry reporting when this command runs.');

packages/flutter_tools/test/general.shard/runner/runner_test.dart

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -346,34 +346,6 @@ void main() {
346346
ProcessManager: () => FakeProcessManager.any(),
347347
},
348348
);
349-
350-
testUsingContext(
351-
'legacy analytics disabled will disable new analytics',
352-
() async {
353-
354-
io.setExitFunctionForTests((int exitCode) {});
355-
356-
await runner.run(
357-
<String>[],
358-
() => <FlutterCommand>[],
359-
// This flutterVersion disables crash reporting.
360-
flutterVersion: '[user-branch]/',
361-
shutdownHooks: ShutdownHooks(),
362-
);
363-
364-
expect(globals.flutterUsage.enabled, false);
365-
expect(globals.analytics.telemetryEnabled, false);
366-
expect(testLogger.statusText.contains(
367-
'Please note that analytics '
368-
'reporting was already disabled'), true);
369-
},
370-
overrides: <Type, Generator>{
371-
Analytics: () => FakeAnalytics(),
372-
FileSystem: () => MemoryFileSystem.test(),
373-
ProcessManager: () => FakeProcessManager.any(),
374-
Usage: () => legacyAnalytics,
375-
},
376-
);
377349
});
378350
}
379351

0 commit comments

Comments
 (0)