deviceString improvements

This commit is contained in:
sebv
2014-07-04 22:26:38 +08:00
parent 2ccf32c343
commit cd69e64ca7
2 changed files with 23 additions and 5 deletions

View File

@@ -830,14 +830,20 @@ IOS.prototype.getDeviceString = function () {
var isTall = isiPhone;
var isRetina = this.xcodeVersion[0] !== '4';
var is64bit = false;
if (this.args.deviceName) {
var device = this.args.deviceName.toLowerCase();
var deviceName = this.args.deviceName;
var fixDevice = true;
if (deviceName && deviceName[0] === '='){
deviceName = deviceName.substring(1);
fixDevice = false;
}
if (deviceName) {
var device = deviceName.toLowerCase();
if (device.indexOf("iphone") !== -1) {
isiPhone = true;
} else if (device.indexOf("ipad") !== -1) {
isiPhone = false;
}
if (this.args.deviceName !== this.args.platformName) {
if (deviceName !== this.args.platformName) {
isTall = isiPhone && (device.indexOf("4-inch") !== -1);
isRetina = (device.indexOf("retina") !== -1);
is64bit = (device.indexOf("64-bit") !== -1);
@@ -856,7 +862,7 @@ IOS.prototype.getDeviceString = function () {
if (isiPhone) {
if (isRetina && isTall) {
iosDeviceString += is64bit ? " (4-inch 64-bit)" : " (4-inch)";
} else if (this.args.deviceName.toLowerCase().indexOf("3.5") !== -1) {
} else if (deviceName.toLowerCase().indexOf("3.5") !== -1) {
iosDeviceString += " (3.5-inch)";
}
} else {
@@ -867,6 +873,18 @@ IOS.prototype.getDeviceString = function () {
iosDeviceString += " - Simulator - iOS " +
(this.args.platformVersion || this.iOSSDKVersion);
}
if (fixDevice) {
// Some device config are broken in 5.1
var CONFIG_FIX = {
'iPhone - Simulator - iOS 7.1': 'iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1',
'iPad - Simulator - iOS 7.1': 'iPad Retina (64-bit) - Simulator - iOS 7.1'
};
if (CONFIG_FIX[iosDeviceString]) {
iosDeviceString = CONFIG_FIX[iosDeviceString];
logger.debug("Fixing device was changed from:\"", iosDeviceString, "\" to:\"",
CONFIG_FIX[iosDeviceString] + "\"");
}
}
return iosDeviceString;
};