Unverified Commit 291b2864 authored by Chris Yang's avatar Chris Yang Committed by GitHub

[tool] Add CADisableMinimumFrameDurationOnPhone to iOS templates (#94509)

parent 0aab2280
...@@ -43,5 +43,7 @@ ...@@ -43,5 +43,7 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict> </dict>
</plist> </plist>
...@@ -43,5 +43,7 @@ ...@@ -43,5 +43,7 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict> </dict>
</plist> </plist>
...@@ -1368,7 +1368,7 @@ void main() { ...@@ -1368,7 +1368,7 @@ void main() {
ProcessManager: () => fakeProcessManager, 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 = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
...@@ -1379,11 +1379,13 @@ void main() { ...@@ -1379,11 +1379,13 @@ void main() {
final String plistPath = globals.fs.path.join('ios', 'Runner', 'Info.plist'); final String plistPath = globals.fs.path.join('ios', 'Runner', 'Info.plist');
final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath));
expect(plistFile, exists); expect(plistFile, exists);
final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone');
expect(disabled, isTrue);
final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName');
expect(displayName, 'My Project'); 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 = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
...@@ -1394,11 +1396,13 @@ void main() { ...@@ -1394,11 +1396,13 @@ void main() {
final String plistPath = globals.fs.path.join('ios', 'Runner', 'Info.plist'); final String plistPath = globals.fs.path.join('ios', 'Runner', 'Info.plist');
final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath));
expect(plistFile, exists); expect(plistFile, exists);
final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone');
expect(disabled, isTrue);
final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName');
expect(displayName, 'My Project'); 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 = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
...@@ -1409,6 +1413,8 @@ void main() { ...@@ -1409,6 +1413,8 @@ void main() {
final String plistPath = globals.fs.path.join('.ios', 'Runner', 'Info.plist'); final String plistPath = globals.fs.path.join('.ios', 'Runner', 'Info.plist');
final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath));
expect(plistFile, exists); expect(plistFile, exists);
final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone');
expect(disabled, isTrue);
final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName');
expect(displayName, 'My Project'); expect(displayName, 'My Project');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -1422,7 +1428,7 @@ void main() { ...@@ -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 = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
...@@ -1433,6 +1439,8 @@ void main() { ...@@ -1433,6 +1439,8 @@ void main() {
final String plistPath = globals.fs.path.join('.ios', 'Runner', 'Info.plist'); final String plistPath = globals.fs.path.join('.ios', 'Runner', 'Info.plist');
final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath)); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath));
expect(plistFile, exists); expect(plistFile, exists);
final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone');
expect(disabled, isTrue);
final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName');
expect(displayName, 'My Project'); expect(displayName, 'My Project');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -1446,7 +1454,7 @@ void main() { ...@@ -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 = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
...@@ -1457,11 +1465,13 @@ void main() { ...@@ -1457,11 +1465,13 @@ void main() {
final String plistPath = globals.fs.path.join('example', 'ios', 'Runner', 'Info.plist'); 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)); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath));
expect(plistFile, exists); expect(plistFile, exists);
final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone');
expect(disabled, isTrue);
final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName');
expect(displayName, 'My Project'); 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 = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
...@@ -1472,6 +1482,8 @@ void main() { ...@@ -1472,6 +1482,8 @@ void main() {
final String plistPath = globals.fs.path.join('example', 'ios', 'Runner', 'Info.plist'); 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)); final File plistFile = globals.fs.file(globals.fs.path.join(projectDir.path, plistPath));
expect(plistFile, exists); expect(plistFile, exists);
final bool disabled = _getBooleanValueFromPlist(plistFile: plistFile, key: 'CADisableMinimumFrameDurationOnPhone');
expect(disabled, isTrue);
final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName'); final String displayName = _getStringValueFromPlist(plistFile: plistFile, key: 'CFBundleDisplayName');
expect(displayName, 'My Project'); expect(displayName, 'My Project');
}); });
...@@ -3161,3 +3173,10 @@ String _getStringValueFromPlist({File plistFile, String key}) { ...@@ -3161,3 +3173,10 @@ String _getStringValueFromPlist({File plistFile, String key}) {
assert(keyIndex > 0); assert(keyIndex > 0);
return plist[keyIndex+1].replaceAll('<string>', '').replaceAll('</string>', ''); 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';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment