From a7516785630022899caa478124030be51c5b281c Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 9 May 2018 13:34:39 -0700 Subject: [PATCH] Allow 32-bit iOS device simulators (#17443) Previously, Flutter did not support iOS devices with armv7 or armv7s CPUs. We now support these devices. This eliminates the previous hardcoded checks that prevented running on simulators of older devices. We maintain the existing restriction on running on watchOS or tvOS simulators. --- .../flutter_tools/lib/src/ios/simulators.dart | 29 ++----------------- .../test/ios/simulators_test.dart | 18 ++++++++---- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart index aa881bf55f..740a6e579c 100644 --- a/packages/flutter_tools/lib/src/ios/simulators.dart +++ b/packages/flutter_tools/lib/src/ios/simulators.dart @@ -247,36 +247,13 @@ class IOSSimulator extends Device { return false; } - // Step 1: Check if the device is part of a blacklisted category. - // We do not support WatchOS or tvOS devices. - + // Check if the device is part of a blacklisted category. + // We do not yet support WatchOS or tvOS devices. final RegExp blacklist = new RegExp(r'Apple (TV|Watch)', caseSensitive: false); if (blacklist.hasMatch(name)) { - _supportMessage = 'Flutter does not support Apple TV or Apple Watch. Select an iPhone 5s or above.'; + _supportMessage = 'Flutter does not support Apple TV or Apple Watch.'; return false; } - - // Step 2: Check if the device must be rejected because of its version. - // There is an artificial check on older simulators where arm64 - // targeted applications cannot be run (even though the Flutter - // runner on the simulator is completely different). - - // Check for unsupported iPads. - final Match iPadMatch = new RegExp(r'iPad (2|Retina)', caseSensitive: false).firstMatch(name); - if (iPadMatch != null) { - _supportMessage = 'Flutter does not yet support iPad 2 or iPad Retina. Select an iPad Air or above.'; - return false; - } - - // Check for unsupported iPhones. - final Match iPhoneMatch = new RegExp(r'iPhone [0-5]').firstMatch(name); - if (iPhoneMatch != null) { - if (name == 'iPhone 5s') - return true; - _supportMessage = 'Flutter does not yet support iPhone 5 or earlier. Select an iPhone 5s or above.'; - return false; - } - return true; } diff --git a/packages/flutter_tools/test/ios/simulators_test.dart b/packages/flutter_tools/test/ios/simulators_test.dart index b6ee8ee052..03fc5304e0 100644 --- a/packages/flutter_tools/test/ios/simulators_test.dart +++ b/packages/flutter_tools/test/ios/simulators_test.dart @@ -122,20 +122,20 @@ void main() { Platform: () => osx, }); - testUsingContext('iPad 2 is unsupported', () { - expect(new IOSSimulator('x', name: 'iPad 2').isSupported(), false); + testUsingContext('iPad 2 is supported', () { + expect(new IOSSimulator('x', name: 'iPad 2').isSupported(), true); }, overrides: { Platform: () => osx, }); - testUsingContext('iPad Retina is unsupported', () { - expect(new IOSSimulator('x', name: 'iPad Retina').isSupported(), false); + testUsingContext('iPad Retina is supported', () { + expect(new IOSSimulator('x', name: 'iPad Retina').isSupported(), true); }, overrides: { Platform: () => osx, }); - testUsingContext('iPhone 5 is unsupported', () { - expect(new IOSSimulator('x', name: 'iPhone 5').isSupported(), false); + testUsingContext('iPhone 5 is supported', () { + expect(new IOSSimulator('x', name: 'iPhone 5').isSupported(), true); }, overrides: { Platform: () => osx, }); @@ -157,6 +157,12 @@ void main() { }, overrides: { Platform: () => osx, }); + + testUsingContext('iPhone X is supported', () { + expect(new IOSSimulator('x', name: 'iPhone X').isSupported(), true); + }, overrides: { + Platform: () => osx, + }); }); group('Simulator screenshot', () {