Skip to content

Commit 01cf381

Browse files
committed
Fixes ios-control#36 - Add support for "iPhone (Retina 4-inch)" (iPhone 5)
1 parent fbe4d41 commit 01cf381

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Source/iPhoneSimulator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
BOOL verbose;
2222
BOOL alreadyPrintedData;
2323
BOOL retinaDevice;
24+
BOOL tallDevice;
2425
}
2526

2627
- (void)runWithArgc:(int)argc argv:(char **)argv;

Source/iPhoneSimulator.m

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
NSString *simulatorPrefrencesName = @"com.apple.iphonesimulator";
1515
NSString *deviceProperty = @"SimulateDevice";
16-
NSString *deviceIphoneRetina = @"iPhone (Retina 3.5-inch)";
16+
NSString *deviceIphoneRetina3_5Inch = @"iPhone (Retina 3.5-inch)";
17+
NSString *deviceIphoneRetina4_0Inch = @"iPhone (Retina 4-inch)";
1718
NSString *deviceIphone = @"iPhone";
1819
NSString *deviceIpad = @"iPad";
1920
NSString *deviceIpadRetina = @"iPad (Retina)";
@@ -41,6 +42,7 @@ - (void) printUsage {
4142
fprintf(stderr, " --sdk <sdkversion> The iOS SDK version to run the application on (defaults to the latest)\n");
4243
fprintf(stderr, " --family <device family> The device type that should be simulated (defaults to `iphone')\n");
4344
fprintf(stderr, " --retina Start a retina device\n");
45+
fprintf(stderr, " --tall In combination with --retina flag, start the tall version of the retina device (e.g. iPhone 5 (4-inch))\n");
4446
fprintf(stderr, " --uuid <uuid> A UUID identifying the session (is that correct?)\n");
4547
fprintf(stderr, " --env <environment file path> A plist file containing environment key-value pairs that should be set\n");
4648
fprintf(stderr, " --setenv NAME=VALUE Set an environment variable\n");
@@ -237,7 +239,7 @@ - (int)launchApp:(NSString *)path withFamily:(NSString *)family
237239
}
238240
}
239241

240-
[self changeDeviceType:family retina:retinaDevice];
242+
[self changeDeviceType:family retina:retinaDevice isTallDevice:tallDevice];
241243

242244
/* Start the session */
243245
session = [[[DTiPhoneSimulatorSession alloc] init] autorelease];
@@ -254,7 +256,7 @@ - (int)launchApp:(NSString *)path withFamily:(NSString *)family
254256
return EXIT_SUCCESS;
255257
}
256258

257-
- (void) changeDeviceType:(NSString *)family retina:(BOOL)retina {
259+
- (void) changeDeviceType:(NSString *)family retina:(BOOL)retina isTallDevice:(BOOL)isTallDevice {
258260
NSString *devicePropertyValue;
259261
if (retina) {
260262
if (verbose) {
@@ -264,7 +266,11 @@ - (void) changeDeviceType:(NSString *)family retina:(BOOL)retina {
264266
devicePropertyValue = deviceIpadRetina;
265267
}
266268
else {
267-
devicePropertyValue = deviceIphoneRetina;
269+
if (isTallDevice) {
270+
devicePropertyValue = deviceIphoneRetina4_0Inch;
271+
} else {
272+
devicePropertyValue = deviceIphoneRetina3_5Inch;
273+
}
268274
}
269275
} else {
270276
if ([family isEqualToString:@"ipad"]) {
@@ -288,6 +294,7 @@ - (void)runWithArgc:(int)argc argv:(char **)argv {
288294
}
289295

290296
retinaDevice = NO;
297+
tallDevice = NO;
291298
exitOnStartup = NO;
292299
alreadyPrintedData = NO;
293300
startOnly = strcmp(argv[1], "start") == 0;
@@ -379,6 +386,8 @@ - (void)runWithArgc:(int)argc argv:(char **)argv {
379386
NSLog(@"stderrPath: %@", stderrPath);
380387
} else if (strcmp(argv[i], "--retina") == 0) {
381388
retinaDevice = YES;
389+
} else if (strcmp(argv[i], "--tall") == 0) {
390+
tallDevice = YES;
382391
} else if (strcmp(argv[i], "--args") == 0) {
383392
i++;
384393
break;

0 commit comments

Comments
 (0)