diff --git a/packages/flutter_tools/templates/app_shared/ios.tmpl/Runner/Info.plist.tmpl b/packages/flutter_tools/templates/app_shared/ios.tmpl/Runner/Info.plist.tmpl index 4d224546da..e7cece9d6c 100644 --- a/packages/flutter_tools/templates/app_shared/ios.tmpl/Runner/Info.plist.tmpl +++ b/packages/flutter_tools/templates/app_shared/ios.tmpl/Runner/Info.plist.tmpl @@ -43,5 +43,7 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + diff --git a/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Info.plist.tmpl b/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Info.plist.tmpl index 23f020ccce..26210381d1 100644 --- a/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Info.plist.tmpl +++ b/packages/flutter_tools/templates/module/ios/host_app_ephemeral/Runner.tmpl/Info.plist.tmpl @@ -43,5 +43,7 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index d43f8b2469..a27a9e20cc 100755 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -1368,7 +1368,7 @@ void main() { ProcessManager: () => fakeProcessManager, }); - testUsingContext('display name is Title Case for objc iOS project.', () async { + testUsingContext('Correct info.plist key-value pairs for objc iOS project.', () async { Cache.flutterRoot = '../..'; final CreateCommand command = CreateCommand(); @@ -1379,11 +1379,13 @@ void main() { final String plistPath = globals.fs.path.join('ios', 'Runner', 'Info.plist'); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); expect(plistFile, exists); + final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone'); + expect(disabled, isTrue); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); expect(displayName, 'My Project'); }); - testUsingContext('display name is Title Case for swift iOS project.', () async { + testUsingContext('Correct info.plist key-value pairs for objc swift project.', () async { Cache.flutterRoot = '../..'; final CreateCommand command = CreateCommand(); @@ -1394,11 +1396,13 @@ void main() { final String plistPath = globals.fs.path.join('ios', 'Runner', 'Info.plist'); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); expect(plistFile, exists); + final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone'); + expect(disabled, isTrue); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); expect(displayName, 'My Project'); }); - testUsingContext('display name is Title Case for objc iOS module.', () async { + testUsingContext('Correct info.plist key-value pairs for objc iOS module.', () async { Cache.flutterRoot = '../..'; final CreateCommand command = CreateCommand(); @@ -1409,6 +1413,8 @@ void main() { final String plistPath = globals.fs.path.join('.ios', 'Runner', 'Info.plist'); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); expect(plistFile, exists); + final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone'); + expect(disabled, isTrue); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); expect(displayName, 'My Project'); }, overrides: { @@ -1422,7 +1428,7 @@ void main() { ), }); - testUsingContext('display name is Title Case for swift iOS module.', () async { + testUsingContext('Correct info.plist key-value pairs for swift iOS module.', () async { Cache.flutterRoot = '../..'; final CreateCommand command = CreateCommand(); @@ -1433,6 +1439,8 @@ void main() { final String plistPath = globals.fs.path.join('.ios', 'Runner', 'Info.plist'); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); expect(plistFile, exists); + final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone'); + expect(disabled, isTrue); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); expect(displayName, 'My Project'); }, overrides: { @@ -1446,7 +1454,7 @@ void main() { ), }); - testUsingContext('display name is Title Case for swift iOS plugin.', () async { + testUsingContext('Correct info.plist key-value pairs for swift iOS plugin.', () async { Cache.flutterRoot = '../..'; final CreateCommand command = CreateCommand(); @@ -1457,11 +1465,13 @@ void main() { final String plistPath = globals.fs.path.join('example', 'ios', 'Runner', 'Info.plist'); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); expect(plistFile, exists); + final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone'); + expect(disabled, isTrue); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); expect(displayName, 'My Project'); }); - testUsingContext('display name is Title Case for objc iOS plugin.', () async { + testUsingContext('Correct info.plist key-value pairs for objc iOS plugin.', () async { Cache.flutterRoot = '../..'; final CreateCommand command = CreateCommand(); @@ -1472,6 +1482,8 @@ void main() { final String plistPath = globals.fs.path.join('example', 'ios', 'Runner', 'Info.plist'); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); expect(plistFile, exists); + final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone'); + expect(disabled, isTrue); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); expect(displayName, 'My Project'); }); @@ -3161,3 +3173,10 @@ String _getStringValueFromPlist({File plistFile, String key}) { assert(keyIndex > 0); return plist[keyIndex+1].replaceAll('', '').replaceAll('', ''); } + +bool _getBooleanValueFromPlist({File plistFile, String key}) { + final List plist = plistFile.readAsLinesSync().map((String line) => line.trim()).toList(); + final int keyIndex = plist.indexOf('$key'); + assert(keyIndex > 0); + return plist[keyIndex+1].replaceAll('<', '').replaceAll('/>', '') == 'true'; +}