-
-
Notifications
You must be signed in to change notification settings - Fork 424
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
feat: bump generic iPhone for iOS 13.0 #1068
Conversation
4da3461
to
d7a56bc
Compare
lib/utils.js
Outdated
let genericIosSimulator; | ||
|
||
// Find the highest iOS version in the list that is below the provided version | ||
for (const [platformVersionFromList, iosSimulator] of genericSimulators) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_.toPairs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They aren't pairs. It's a list of lists
"iPhone": [
[<ios-version>, <default>],
[<ios-version-next>, <default-next>],
...
],
lib/utils.js
Outdated
* @param {string} deviceName Type of IOS device. Can be iPhone, iPad (possibly more in the future) | ||
*/ | ||
function getGenericSimulatorForIosVersion (platformVersion, deviceName) { | ||
const genericSimulators = iosGenericSimulators[deviceName]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if this returns undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just fixed that now. That did cause an error.
lib/utils.js
Outdated
if (deviceName !== devName) { | ||
log.debug(`Changing deviceName from '${devName}' to '${deviceName}'`); | ||
function translateDeviceName (platformVersion, deviceName = '') { | ||
const translatedDeviceName = getGenericSimulatorForIosVersion(platformVersion, deviceName.toLowerCase().trim()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if this is undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't be now. The getGenericSimulatorForIosVersion
always returns device name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
@@ -0,0 +1,10 @@ | |||
export default { | |||
'ipad simulator': [ | |||
['0.0', 'iPad Retina'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth noting that these need to be strictly in order, or the parsing logic won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Maybe I should just sort them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sort them now to be safe.
lib/utils.js
Outdated
if (deviceName !== devName) { | ||
log.debug(`Changing deviceName from '${devName}' to '${deviceName}'`); | ||
function translateDeviceName (platformVersion, deviceName = '') { | ||
const translatedDeviceName = getGenericSimulatorForIosVersion(platformVersion, deviceName.toLowerCase().trim()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would opt for a variable name that is not so close to the function name, for readability's sake.
305ffe6
to
37cc52b
Compare
* Get the generic simulator for a given IOS version and device type (iPhone, iPad) | ||
* | ||
* @param {string|number} platformVersion IOS version. e.g.) 13.0 | ||
* @param {string} deviceName Type of IOS device. Can be iPhone, iPad (possibly more in the future) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing return description
lib/utils.js
Outdated
function getGenericSimulatorForIosVersion (platformVersion, deviceName) { | ||
let genericSimulators = iosGenericSimulators[deviceName]; | ||
|
||
//console.log(util.compareVersions('0.0', '>', '10.3')); process.exit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this comment needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
37cc52b
to
3d29855
Compare
} | ||
genericIosSimulator = iosSimulator; | ||
} | ||
return genericIosSimulator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can the result be undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The lowest iOS version in the list is 0.0
so every iOS version we test it against will be above that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes sense to leave a comment about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it so now it can be undefined and translateDeviceName
handles that case.
return deviceName; | ||
} | ||
|
||
function translateDeviceName (platformVersion, deviceName = '') { | ||
const deviceNameTranslated = getGenericSimulatorForIosVersion(platformVersion, deviceName.toLowerCase().trim()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to change the device name to lower case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mykola-mokhnach yeah if somebody provides iPhone Simulator
we want it to be case-insensitive.
bc62b9c
to
f5f87f7
Compare
@mykola-mokhnach @imurchie fixes pushed. |
f5f87f7
to
52116c4
Compare
What this pull request does
iphone simulator
for iOS 13+ fromiPhone 6
toiPhone X
WHY?:
iOS 13
does not supportiPhone 6
so this needs to be changed. ChoseiPhone X
overiPhone 11
because it's not quite the latest and not bleeding edge.ios-generic-simulators.js
WHY?: So we're not hardcoding this in code. We just need to keep this file (and the tests) up-to-date