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
9618788e
Unverified
Commit
9618788e
authored
Nov 16, 2020
by
Jonah Williams
Committed by
GitHub
Nov 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove globals from features (#70515)
parent
148ae7bf
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
123 deletions
+138
-123
context_runner.dart
packages/flutter_tools/lib/src/context_runner.dart
+5
-1
features.dart
packages/flutter_tools/lib/src/features.dart
+17
-5
features_test.dart
packages/flutter_tools/test/general.shard/features_test.dart
+116
-117
No files found.
packages/flutter_tools/lib/src/context_runner.dart
View file @
9618788e
...
@@ -185,7 +185,11 @@ Future<T> runInContext<T>(
...
@@ -185,7 +185,11 @@ Future<T> runInContext<T>(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
androidWorkflow:
androidWorkflow
,
androidWorkflow:
androidWorkflow
,
),
),
FeatureFlags:
()
=>
const
FlutterFeatureFlags
(),
FeatureFlags:
()
=>
FlutterFeatureFlags
(
flutterVersion:
globals
.
flutterVersion
,
config:
globals
.
config
,
platform:
globals
.
platform
,
),
FlutterVersion:
()
=>
FlutterVersion
(
clock:
const
SystemClock
()),
FlutterVersion:
()
=>
FlutterVersion
(
clock:
const
SystemClock
()),
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
.
find
(),
FuchsiaArtifacts:
()
=>
FuchsiaArtifacts
.
find
(),
FuchsiaDeviceTools:
()
=>
FuchsiaDeviceTools
(),
FuchsiaDeviceTools:
()
=>
FuchsiaDeviceTools
(),
...
...
packages/flutter_tools/lib/src/features.dart
View file @
9618788e
...
@@ -4,8 +4,10 @@
...
@@ -4,8 +4,10 @@
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'base/config.dart'
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'globals.dart'
as
globals
;
import
'base/platform.dart'
;
import
'version.dart'
;
/// The current [FeatureFlags] implementation.
/// The current [FeatureFlags] implementation.
///
///
...
@@ -54,7 +56,17 @@ abstract class FeatureFlags {
...
@@ -54,7 +56,17 @@ abstract class FeatureFlags {
}
}
class
FlutterFeatureFlags
implements
FeatureFlags
{
class
FlutterFeatureFlags
implements
FeatureFlags
{
const
FlutterFeatureFlags
();
FlutterFeatureFlags
({
@required
FlutterVersion
flutterVersion
,
@required
Config
config
,
@required
Platform
platform
,
})
:
_flutterVersion
=
flutterVersion
,
_config
=
config
,
_platform
=
platform
;
final
FlutterVersion
_flutterVersion
;
final
Config
_config
;
final
Platform
_platform
;
@override
@override
bool
get
isLinuxEnabled
=>
isEnabled
(
flutterLinuxDesktopFeature
);
bool
get
isLinuxEnabled
=>
isEnabled
(
flutterLinuxDesktopFeature
);
...
@@ -82,20 +94,20 @@ class FlutterFeatureFlags implements FeatureFlags {
...
@@ -82,20 +94,20 @@ class FlutterFeatureFlags implements FeatureFlags {
@override
@override
bool
isEnabled
(
Feature
feature
)
{
bool
isEnabled
(
Feature
feature
)
{
final
String
currentChannel
=
globals
.
flutterVersion
.
channel
;
final
String
currentChannel
=
_
flutterVersion
.
channel
;
final
FeatureChannelSetting
featureSetting
=
feature
.
getSettingForChannel
(
currentChannel
);
final
FeatureChannelSetting
featureSetting
=
feature
.
getSettingForChannel
(
currentChannel
);
if
(!
featureSetting
.
available
)
{
if
(!
featureSetting
.
available
)
{
return
false
;
return
false
;
}
}
bool
isEnabled
=
featureSetting
.
enabledByDefault
;
bool
isEnabled
=
featureSetting
.
enabledByDefault
;
if
(
feature
.
configSetting
!=
null
)
{
if
(
feature
.
configSetting
!=
null
)
{
final
bool
configOverride
=
globals
.
config
.
getValue
(
feature
.
configSetting
)
as
bool
;
final
bool
configOverride
=
_
config
.
getValue
(
feature
.
configSetting
)
as
bool
;
if
(
configOverride
!=
null
)
{
if
(
configOverride
!=
null
)
{
isEnabled
=
configOverride
;
isEnabled
=
configOverride
;
}
}
}
}
if
(
feature
.
environmentOverride
!=
null
)
{
if
(
feature
.
environmentOverride
!=
null
)
{
if
(
globals
.
platform
.
environment
[
feature
.
environmentOverride
]?.
toLowerCase
()
==
'true'
)
{
if
(
_
platform
.
environment
[
feature
.
environmentOverride
]?.
toLowerCase
()
==
'true'
)
{
isEnabled
=
true
;
isEnabled
=
true
;
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/features_test.dart
View file @
9618788e
This diff is collapsed.
Click to expand it.
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