Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically inject UILaunchImages in Info.plist #6094

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 76 additions & 0 deletions iphone/cli/commands/_build.js
Expand Up @@ -2079,6 +2079,82 @@ iOSBuilder.prototype.createInfoPlist = function createInfoPlist(next) {
}
}
}, this);

// scan for launch images, unless the user is managing them
if (!Array.isArray(plist.UILaunchImages) && !Array.isArray(plist['UILaunchImages~ipad'])) {
[{
"orientation" : "Portrait",
"minimum-system-version" : "8.0",
"name": "Default-Portrait",
"subtype": "736h",
"scale": "3x",
"size": "{414, 736}"
},
{
"orientation" : "Landscape",
"minimum-system-version" : "8.0",
"name": "Default-Landscape",
"subtype": "736h",
"scale": "3x",
"size": "{414, 736}"
},
{
"orientation" : "Portrait",
"minimum-system-version" : "8.0",
"name": "Default",
"subtype": "667h",
"scale": "2x",
"size": "{375, 667}"
},
{
"orientation" : "Portrait",
"minimum-system-version" : "7.0",
"name": "Default",
"scale": ["1x", "2x"],
"size": "{320, 480}"
},
{
"orientation" : "Portrait",
"minimum-system-version" : "7.0",
"name": "Default",
"subtype": "568h",
"scale": "2x",
"size": "{320, 568}"
},
{
"orientation" : "Portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"name": "Default-Portrait",
"scale": ["1x", "2x"],
"size": "{768, 1024}"
},
{
"orientation" : "Landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"name": "Default-Landscape",
"scale": ["1x", "2x"],
"size": "{768, 1024}"
}].forEach(function (asset) {
(Array.isArray(asset.scale) ? asset.scale : [asset.scale]).some(function (scale) {
var key, filename = asset.name + (asset.subtype ? '-' + asset.subtype : '') + (scale !== '1x' ? '@' + scale : '') + '.png';
if (fs.existsSync(path.join(this.projectDir, 'Resources', filename)) ||
fs.existsSync(path.join(this.projectDir, 'Resources', 'iphone', filename)) ||
fs.existsSync(path.join(this.projectDir, 'Resources', 'ios', filename))) {
key = 'UILaunchImages' + (asset.idiom === 'ipad' ? '~' + asset.idiom : '');
Array.isArray(plist[key]) || (plist[key] = []);
plist[key].push({
UILaunchImageName: asset.name,
UILaunchImageOrientation: asset.orientation,
UILaunchImageSize: asset.size,
UILaunchImageMinimumVersion: asset['minimum-system-version']
});
return true;
}
}, this);
}, this);
}

// scan for ttf and otf font files
var fontMap = {},
Expand Down