Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
67a68e9f
Unverified
Commit
67a68e9f
authored
Jan 10, 2020
by
Zachary Anderson
Committed by
GitHub
Jan 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Fix analytics opt out event (#48585)
parent
c90b1182
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
config.dart
packages/flutter_tools/lib/src/commands/config.dart
+3
-1
config_test.dart
...utter_tools/test/commands.shard/hermetic/config_test.dart
+12
-10
No files found.
packages/flutter_tools/lib/src/commands/config.dart
View file @
67a68e9f
...
...
@@ -115,8 +115,10 @@ class ConfigCommand extends FlutterCommand {
if
(
argResults
.
wasParsed
(
'analytics'
))
{
final
bool
value
=
boolArg
(
'analytics'
);
flutterUsage
.
enabled
=
value
;
// We send the analytics event *before* toggling the flag intentionally
// to be sure that opt-out events are sent correctly.
AnalyticsConfigEvent
(
enabled:
value
).
send
();
flutterUsage
.
enabled
=
value
;
globals
.
printStatus
(
'Analytics reporting
${value ? 'enabled' : 'disabled'}
.'
);
}
...
...
packages/flutter_tools/test/commands.shard/hermetic/config_test.dart
View file @
67a68e9f
...
...
@@ -200,6 +200,18 @@ void main() {
final
ConfigCommand
configCommand
=
ConfigCommand
();
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
configCommand
);
when
(
mockUsage
.
sendEvent
(
captureAny
,
captureAny
,
label:
captureAnyNamed
(
'label'
),
value:
anyNamed
(
'value'
),
parameters:
anyNamed
(
'parameters'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
expect
(
mockUsage
.
enabled
,
true
);
expect
(
invocation
.
positionalArguments
,
<
String
>[
'analytics'
,
'enabled'
]);
expect
(
invocation
.
namedArguments
[
#label
],
'false'
);
});
await
commandRunner
.
run
(<
String
>[
'config'
,
'--no-analytics'
,
...
...
@@ -219,16 +231,6 @@ void main() {
any
,
label:
anyNamed
(
'label'
),
));
expect
(
verify
(
mockUsage
.
sendEvent
(
captureAny
,
captureAny
,
label:
captureAnyNamed
(
'label'
),
value:
anyNamed
(
'value'
),
parameters:
anyNamed
(
'parameters'
),
)).
captured
,
<
dynamic
>[
'analytics'
,
'enabled'
,
'false'
],
);
},
overrides:
<
Type
,
Generator
>{
Usage:
()
=>
mockUsage
,
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment