-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Don't show legacy welcome message when analytics are disabled #140956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Not sure how to best test this. |
|
Sorry for missing this, I was toying with my github notifications last week and basically didn't get any. |
|
Adding Elias as a reviewer, as this is tricky and he has the most context |
|
|
||
| // Prints the welcome message if needed for legacy analytics. | ||
| globals.flutterUsage.printWelcome(); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies on the delayed review, slipped through the cracks
But couldn't we just check if we are on a bot before invoking the print statement for the welcome message? The globals.analytics.shouldShowMessage is not a good indicator for first run, it can return true if we had to change something within package:unified_analytics that would require us to show the consent message again
Future<int> exitWithHooks(int code, {required ShutdownHooks shutdownHooks}) async {
// Need to get the boolean returned from `messenger.shouldDisplayLicenseTerms()`
// before invoking the print welcome method because the print welcome method
// will set `messenger.shouldDisplayLicenseTerms()` to false
final FirstRunMessenger messenger =
FirstRunMessenger(persistentToolState: globals.persistentToolState!);
final bool legacyAnalyticsMessageShown =
messenger.shouldDisplayLicenseTerms();
// Prints the welcome message if needed for legacy analytics.
// globals.flutterUsage.printWelcome();
if (!(await globals.isRunningOnBot)) { // <--- Added
globals.flutterUsage.printWelcome();
}You can test if this fix works by:
- Deleting the tool state file from your home directory
~/.config/flutter/tool_state - Add the conditional above for the
printWelcomemethod - Rebuild the flutter tool (can trigger a rebuild by deleting the
$FLUTTER_ROOT/bin/cachedirectory) - Run the following command
CI=true flutter --version --machine, this should output the below without the welcome message
{
"frameworkVersion": "3.19.0-9.0.pre.58",
"channel": "master",
"repositoryUrl": "https://github.com/eliasyishak/flutter.git",
"frameworkRevision": "bfa245fa3485e5e66c3fe816129565d478eadc84",
"frameworkCommitDate": "2024-01-22 10:45:08 -0500",
"engineRevision": "40c5e9ce6596e1898ce195ef9982959a82d03fbd",
"dartSdkVersion": "3.4.0 (build 3.4.0-52.0.dev)",
"devToolsVersion": "2.31.0",
"flutterVersion": "3.19.0-9.0.pre.58",
"flutterRoot": "/Users/eliasyishak/Desktop/flutter"
}
After testing, you should delete the tool state file again so that your workstation isn't labeled as a bot for future flutter invocations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can test if this fix works by:
I was more wondering about the best way to write a test for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But couldn't we just check if we are on a bot before invoking the print statement for the welcome message?
That works for me - updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was more wondering about the best way to write a test for it.
Understood, I was just trying to provide a way for you to test the change with what was causing your errors
I've also pushed an update for adding a test to help :)
eliasyishak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if all presubmits pass!
Manual roll requested by [email protected] flutter/flutter@a8efa77...2f6fdf2 2024-01-26 [email protected] Start renaming by adding a new `bringup: true` as an Android emulator. (flutter/flutter#142257) 2024-01-26 [email protected] Instrument ImageInfo. (flutter/flutter#141411) 2024-01-26 [email protected] Fix `SegmentedButton` default size and default tappable size (flutter/flutter#142243) 2024-01-26 [email protected] Update name for android_defines_test. (flutter/flutter#142273) 2024-01-26 [email protected] Enable native compilation for windows-arm64 (flutter/flutter#141930) 2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions)" (flutter/flutter#142274) 2024-01-25 [email protected] Run a few mac tests only on arm. (flutter/flutter#142188) 2024-01-25 [email protected] fix Ink not updating on TextField newline (flutter/flutter#140700) 2024-01-25 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 3.1.4 to 3.1.5 (flutter/flutter#142259) 2024-01-25 [email protected] Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions) (flutter/flutter#142264) 2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Reverts "Rename `integration_tests/external_ui` but do not touch anything else..."" (flutter/flutter#142268) 2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Rename `integration_tests/external_ui` but do not touch anything else..." (flutter/flutter#142265) 2024-01-25 [email protected] Roll Flutter Engine from b2167a93c1a0 to 4b145d041560 (3 revisions) (flutter/flutter#142256) 2024-01-25 [email protected] Implementing `switch` expressions in the `cupertino/` directory (flutter/flutter#141591) 2024-01-25 [email protected] Rename `integration_tests/external_ui` but do not touch anything else... (flutter/flutter#142238) 2024-01-25 [email protected] Roll Flutter Engine from 55eefd5bd255 to b2167a93c1a0 (2 revisions) (flutter/flutter#142252) 2024-01-25 [email protected] Roll Flutter Engine from 3b4779324b44 to 55eefd5bd255 (6 revisions) (flutter/flutter#142245) 2024-01-25 [email protected] Fix incorrect zh-cn translation for Look Up Label in selection controls (flutter/flutter#142158) 2024-01-25 [email protected] PopScope example improvements (flutter/flutter#142163) 2024-01-25 [email protected] Roll Flutter Engine from 1d3f16b0d62e to 3b4779324b44 (1 revision) (flutter/flutter#142225) 2024-01-25 [email protected] Roll Packages from 8fbdf65 to 21b5abb (6 revisions) (flutter/flutter#142224) 2024-01-25 [email protected] Don't show legacy welcome message when analytics are disabled (flutter/flutter#140956) 2024-01-25 [email protected] Roll Flutter Engine from 7c4ed15cb271 to 1d3f16b0d62e (1 revision) (flutter/flutter#142223) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
The legacy welcome message would be printed even if
CI=trueconfusing parsers of the output.This fixes: #139737