@@ -71,7 +71,7 @@ function findFirstAvailableDevice(list) {
71
71
return ret_obj ;
72
72
}
73
73
74
- function findRuntimesGroupByDeviceProperty ( list , deviceProperty , availableOnly ) {
74
+ function findRuntimesGroupByDeviceProperty ( list , deviceProperty , availableOnly , options = { } ) {
75
75
/*
76
76
// Example result:
77
77
{
@@ -91,6 +91,9 @@ function findRuntimesGroupByDeviceProperty(list, deviceProperty, availableOnly)
91
91
list . devices [ deviceGroup ] . forEach ( function ( device ) {
92
92
var devicePropertyValue = device [ deviceProperty ] ;
93
93
94
+ if ( options . lowerCase ) {
95
+ devicePropertyValue = devicePropertyValue . toLowerCase ( ) ;
96
+ }
94
97
if ( ! runtimes [ devicePropertyValue ] ) {
95
98
runtimes [ devicePropertyValue ] = [ ] ;
96
99
}
@@ -108,8 +111,9 @@ function findRuntimesGroupByDeviceProperty(list, deviceProperty, availableOnly)
108
111
}
109
112
110
113
function findAvailableRuntime ( list , device_name ) {
114
+ device_name = device_name . toLowerCase ( ) ;
111
115
112
- var all_druntimes = findRuntimesGroupByDeviceProperty ( list , 'name' , true ) ;
116
+ var all_druntimes = findRuntimesGroupByDeviceProperty ( list , 'name' , true , { lowerCase : true } ) ;
113
117
var druntime = all_druntimes [ filterDeviceName ( device_name ) ] || all_druntimes [ device_name ] ;
114
118
var runtime_found = druntime && druntime . length > 0 ;
115
119
@@ -199,7 +203,7 @@ function getDeviceFromDeviceTypeId(devicetypeid) {
199
203
// found the runtime, now find the actual device matching devicename
200
204
if ( deviceGroup === ret_obj . runtime ) {
201
205
return list . devices [ deviceGroup ] . some ( function ( device ) {
202
- if ( filterDeviceName ( device . name ) === filterDeviceName ( ret_obj . name ) ) {
206
+ if ( filterDeviceName ( device . name ) . toLowerCase ( ) === filterDeviceName ( ret_obj . name ) . toLowerCase ( ) ) {
203
207
ret_obj . id = device . udid ;
204
208
return true ;
205
209
}
@@ -260,9 +264,13 @@ function withInjectedEnvironmentVariablesToProcess(process, envVariables, action
260
264
// replace hyphens in iPad Pro name which differ in 'Device Types' and 'Devices'
261
265
function filterDeviceName ( deviceName ) {
262
266
// replace hyphens in iPad Pro name which differ in 'Device Types' and 'Devices'
263
- if ( deviceName . indexOf ( ' iPad Pro' ) === 0 ) {
267
+ if ( / ^ i P a d P r o / i . test ( deviceName ) ) {
264
268
return deviceName . replace ( / \- / g, ' ' ) . trim ( ) ;
265
269
}
270
+ // replace ʀ in iPhone Xʀ
271
+ if ( deviceName . indexOf ( 'ʀ' ) > - 1 ) {
272
+ return deviceName . replace ( 'ʀ' , 'R' ) ;
273
+ }
266
274
return deviceName ;
267
275
}
268
276
@@ -345,11 +353,11 @@ var lib = {
345
353
var list = simctl . list ( options ) . json ;
346
354
list = fixSimCtlList ( list ) ;
347
355
348
- var druntimes = findRuntimesGroupByDeviceProperty ( list , 'name' , true ) ;
356
+ var druntimes = findRuntimesGroupByDeviceProperty ( list , 'name' , true , { lowerCase : true } ) ;
349
357
var name_id_map = { } ;
350
358
351
359
list . devicetypes . forEach ( function ( device ) {
352
- name_id_map [ filterDeviceName ( device . name ) ] = device . identifier ;
360
+ name_id_map [ filterDeviceName ( device . name ) . toLowerCase ( ) ] = device . identifier ;
353
361
} ) ;
354
362
355
363
list = [ ] ;
@@ -366,7 +374,7 @@ var lib = {
366
374
367
375
for ( var deviceName in druntimes ) {
368
376
var runtimes = druntimes [ deviceName ] ;
369
- var dname = filterDeviceName ( deviceName ) ;
377
+ var dname = filterDeviceName ( deviceName ) . toLowerCase ( ) ;
370
378
371
379
if ( ! ( dname in name_id_map ) ) {
372
380
continue ;
0 commit comments