mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Revert "[flutter_tools] [iOS] Change UIViewControllerBasedStatusBarAppearance to true to fix rotation status bar disappear in portrait" (#95747)
This commit is contained in:
parent
0fb20578fe
commit
aa4ef4cb2a
@ -42,6 +42,6 @@
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<true/>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@ -42,6 +42,6 @@
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<true/>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@ -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<void> runner = createTestCommandRunner(command);
|
||||
|
||||
await runner.run(<String>['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<void> runner = createTestCommandRunner(command);
|
||||
|
||||
await runner.run(<String>['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<void> runner = createTestCommandRunner(command);
|
||||
|
||||
await runner.run(<String>['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: <Type, Generator>{
|
||||
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<void> runner = createTestCommandRunner(command);
|
||||
|
||||
await runner.run(<String>['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: <Type, Generator>{
|
||||
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('<string>', '').replaceAll('</string>', '');
|
||||
}
|
||||
|
||||
bool _getBooleanValueFromPlist({File plistFile, String key}) {
|
||||
final List<String> plist = plistFile.readAsLinesSync().map((String line) => line.trim()).toList();
|
||||
final int keyIndex = plist.indexOf('<key>$key</key>');
|
||||
assert(keyIndex > 0);
|
||||
return plist[keyIndex+1].replaceAll('<', '').replaceAll('/>', '') == 'true';
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user