From aa4ef4cb2ae4af1ef7861aa4bdb8405cb4a3d290 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Thu, 23 Dec 2021 14:19:18 -0800 Subject: [PATCH] Revert "[flutter_tools] [iOS] Change UIViewControllerBasedStatusBarAppearance to true to fix rotation status bar disappear in portrait" (#95747) --- .../ios.tmpl/Runner/Info.plist.tmpl | 2 +- .../Runner.tmpl/Info.plist.tmpl | 2 +- .../commands.shard/permeable/create_test.dart | 85 ------------------- 3 files changed, 2 insertions(+), 87 deletions(-) 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 e5332a5951d..4d224546dad 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 @@ -42,6 +42,6 @@ UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance - + 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 3202215f8a6..23f020cccef 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 @@ -42,6 +42,6 @@ UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance - + 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 c9d20913389..3a1e9fb3bee 100755 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -1366,84 +1366,6 @@ void main() { ProcessManager: () => fakeProcessManager, }); - testUsingContext('UIViewControllerBasedStatusBarAppearance is YES for objc iOS project.', () async { - Cache.flutterRoot = '../..'; - - final CreateCommand command = CreateCommand(); - final CommandRunner runner = createTestCommandRunner(command); - - await runner.run(['create', '--template=app', '--no-pub', '--org', 'com.foo.bar','--ios-language=objc', '--project-name=my_project', projectDir.path]); - - 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 viewControllerBasedStatusBarAppearance = _getBooleanValueFromPlist(plistFile: plistFile, key: 'UIViewControllerBasedStatusBarAppearance'); - expect(viewControllerBasedStatusBarAppearance, true); - }); - - testUsingContext('UIViewControllerBasedStatusBarAppearance is YES for objc swift project.', () async { - Cache.flutterRoot = '../..'; - - final CreateCommand command = CreateCommand(); - final CommandRunner runner = createTestCommandRunner(command); - - await runner.run(['create', '--template=app', '--no-pub', '--org', 'com.foo.bar','--ios-language=swift', '--project-name=my_project', projectDir.path]); - - 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 viewControllerBasedStatusBarAppearance = _getBooleanValueFromPlist(plistFile: plistFile, key: 'UIViewControllerBasedStatusBarAppearance'); - expect(viewControllerBasedStatusBarAppearance, true); - }); - - testUsingContext('UIViewControllerBasedStatusBarAppearance is YES for objc iOS module.', () async { - Cache.flutterRoot = '../..'; - - final CreateCommand command = CreateCommand(); - final CommandRunner runner = createTestCommandRunner(command); - - await runner.run(['create', '--template=module', '--org', 'com.foo.bar','--ios-language=objc', '--project-name=my_project', projectDir.path]); - - 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 viewControllerBasedStatusBarAppearance = _getBooleanValueFromPlist(plistFile: plistFile, key: 'UIViewControllerBasedStatusBarAppearance'); - expect(viewControllerBasedStatusBarAppearance, true); - }, overrides: { - Pub: () => Pub( - fileSystem: globals.fs, - logger: globals.logger, - processManager: globals.processManager, - usage: globals.flutterUsage, - botDetector: globals.botDetector, - platform: globals.platform, - ), - }); - - testUsingContext('UIViewControllerBasedStatusBarAppearance is YES for swift iOS module.', () async { - Cache.flutterRoot = '../..'; - - final CreateCommand command = CreateCommand(); - final CommandRunner runner = createTestCommandRunner(command); - - await runner.run(['create', '--template=module', '--org', 'com.foo.bar','--ios-language=swift', '--project-name=my_project', projectDir.path]); - - 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 viewControllerBasedStatusBarAppearance = _getBooleanValueFromPlist(plistFile: plistFile, key: 'UIViewControllerBasedStatusBarAppearance'); - expect(viewControllerBasedStatusBarAppearance, true); - }, overrides: { - Pub: () => Pub( - fileSystem: globals.fs, - logger: globals.logger, - processManager: globals.processManager, - usage: globals.flutterUsage, - botDetector: globals.botDetector, - platform: globals.platform, - ), - }); - testUsingContext('display name is Title Case for objc iOS project.', () async { Cache.flutterRoot = '../..'; @@ -3054,10 +2976,3 @@ 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'; -}