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
c113bea9
Commit
c113bea9
authored
Feb 20, 2016
by
Chinmay Garde
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2049 from chinmaygarde/master
tvOS, watchOS and old simulators are blacklisted in the tools
parents
73ea415a
d7979956
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
7 deletions
+79
-7
device_android.dart
packages/flutter_tools/lib/src/android/device_android.dart
+2
-0
devices.dart
packages/flutter_tools/lib/src/commands/devices.dart
+6
-2
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+6
-5
device.dart
packages/flutter_tools/lib/src/device.dart
+7
-0
device_ios.dart
packages/flutter_tools/lib/src/ios/device_ios.dart
+58
-0
No files found.
packages/flutter_tools/lib/src/android/device_android.dart
View file @
c113bea9
...
...
@@ -392,6 +392,8 @@ class AndroidDevice extends Device {
bool
isConnected
()
=>
_connected
??
androidSdk
!=
null
;
bool
isSupported
()
=>
true
;
void
setConnected
(
bool
value
)
{
_connected
=
value
;
}
...
...
packages/flutter_tools/lib/src/commands/devices.dart
View file @
c113bea9
...
...
@@ -28,10 +28,12 @@ class DevicesCommand extends FlutterCommand {
printStatus
(
'No connected devices.'
);
}
else
{
printStatus
(
'
${devices.length}
connected
${pluralize('device', devices.length)}
:'
);
printStatus
(
''
);
for
(
Device
device
in
devices
)
{
printStatus
(
'
${device.name}
(
${device.id}
)'
);
printStatus
(
'
\t
${_supportIndicator(device)}
:
${device.name}
(
${device.id}
)'
);
if
(!
device
.
isSupported
())
{
printStatus
(
"
\t\t
${device.supportMessage()}
"
);
}
}
}
...
...
@@ -39,4 +41,6 @@ class DevicesCommand extends FlutterCommand {
}
}
String
_supportIndicator
(
Device
device
)
=>
device
.
isSupported
()
?
"[✔] Supported"
:
"[✘] Unsupported"
;
String
pluralize
(
String
word
,
int
count
)
=>
count
==
1
?
word
:
word
+
's'
;
packages/flutter_tools/lib/src/commands/run.dart
View file @
c113bea9
...
...
@@ -179,6 +179,11 @@ Future<int> startApp(
if
(
package
==
null
||
!
device
.
isConnected
())
continue
;
if
(!
device
.
isSupported
())
{
printStatus
(
"Skipping unsupported device:
${device.name}
"
);
continue
;
}
printTrace
(
'Running build command for
$device
.'
);
Map
<
String
,
dynamic
>
platformArgs
=
<
String
,
dynamic
>{};
...
...
@@ -215,11 +220,7 @@ Future<int> startApp(
}
if
(!
startedSomething
)
{
if
(!
devices
.
all
.
any
((
device
)
=>
device
.
isConnected
()))
{
printError
(
'Unable to run application - no connected devices.'
);
}
else
{
printError
(
'Unable to run application.'
);
}
printError
(
'Unable to run application. Please ensure that a supported device/simulator is connected.'
);
}
return
startedSomething
?
0
:
2
;
...
...
packages/flutter_tools/lib/src/device.dart
View file @
c113bea9
...
...
@@ -106,6 +106,13 @@ abstract class Device {
/// Check if the device is currently connected
bool
isConnected
();
/// Check if the device is supported by Flutter
bool
isSupported
();
// String meant to be displayed to the user indicating if the device is
// supported by Flutter, and, if not, why.
String
supportMessage
()
=>
isSupported
()
?
"Supported"
:
"Unsupported"
;
/// Check if the current version of the given app is already installed
bool
isAppInstalled
(
ApplicationPackage
app
);
...
...
packages/flutter_tools/lib/src/ios/device_ios.dart
View file @
c113bea9
...
...
@@ -149,6 +149,9 @@ class IOSDevice extends Device {
@override
bool
isConnected
()
=>
_getAttachedDeviceIDs
().
contains
(
id
);
@override
bool
isSupported
()
=>
true
;
@override
bool
isAppInstalled
(
ApplicationPackage
app
)
{
try
{
...
...
@@ -291,6 +294,61 @@ class IOSSimulator extends Device {
return
SimControl
.
getConnectedDevices
().
any
((
SimDevice
device
)
=>
device
.
udid
==
id
);
}
@override
bool
isSupported
()
{
if
(!
Platform
.
isMacOS
)
{
_supportMessage
=
"Not supported on a non Mac host"
;
return
false
;
}
// Step 1: Check if the device is part of a blacklisted category.
// We do not support WatchOS or tvOS devices.
RegExp
blacklist
=
new
RegExp
(
r'Apple (TV|Watch)'
,
caseSensitive:
false
);
if
(
blacklist
.
hasMatch
(
name
))
{
_supportMessage
=
"Flutter does not support either the Apple TV or Watch. Choose an iPhone 5s or above."
;
return
false
;
}
// Step 2: Check if the device must be rejected because of its version.
// There is an artitifical check on older simulators where arm64
// targetted applications cannot be run (even though the
// Flutter runner on the simulator is completely different).
RegExp
versionExp
=
new
RegExp
(
r'iPhone ([0-9])+'
);
Match
match
=
versionExp
.
firstMatch
(
name
);
if
(
match
==
null
)
{
// Not an iPhone. All available non-iPhone simulators are compatible.
return
true
;
}
if
(
int
.
parse
(
match
.
group
(
1
))
>
5
)
{
// iPhones 6 and above are always fine.
return
true
;
}
// The 's' subtype of 5 is compatible.
if
(
name
.
contains
(
'iPhone 5s'
))
{
return
true
;
}
_supportMessage
=
"The simulator version is too old. Choose an iPhone 5s or above."
;
return
false
;
}
String
_supportMessage
;
@override
String
supportMessage
()
{
if
(
isSupported
())
{
return
"Supported"
;
}
return
_supportMessage
!=
null
?
_supportMessage
:
"Unknown"
;
}
@override
bool
isAppInstalled
(
ApplicationPackage
app
)
{
try
{
...
...
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