Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit b88415a

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #408 from telerik/fatme/fail-if-invalid-timeout-is-specified
Fix iosDeviceDiscovery timeout option
2 parents f34ab7f + f764569 commit b88415a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

mobile/ios/ios-device.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class IOSDevice implements Mobile.IiOSDevice {
2222
private static INCOMPATIBLE_IMAGE_SIGNATURE_ERROR_CODE = 3892314163;
2323
private static INTERFACE_USB = 1;
2424

25-
private identifier: string = null;
2625
private voidPtr = ref.refType(ref.types.void);
2726
private mountImageCallbackPtr: NodeBuffer = null;
2827

@@ -292,7 +291,7 @@ export class IOSDevice implements Mobile.IiOSDevice {
292291

293292
if (result !== 0 && result !== IOSDevice.IMAGE_ALREADY_MOUNTED_ERROR_CODE) { // 3892314230 - already mounted
294293
if(result === IOSDevice.INCOMPATIBLE_IMAGE_SIGNATURE_ERROR_CODE) { // 3892314163
295-
this.$logger.warn("Unable to mount image %s on device %s.", imagePath, this.identifier);
294+
this.$logger.warn("Unable to mount image %s on device %s.", imagePath, this.deviceInfo.identifier);
296295
} else {
297296
this.$errors.fail("Unable to mount image on device.");
298297
}

mobile/mobile-core/device-discovery.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class IOSDeviceDiscovery extends DeviceDiscovery {
6363
private $mobileDevice: Mobile.IMobileDevice,
6464
private $errors: IErrors,
6565
private $injector: IInjector,
66-
private $options: IOptions) {
66+
private $options: IOptions,
67+
private $utils: IUtils) {
6768
super();
6869
this.timerCallbackPtr = CoreTypes.CoreTypes.cf_run_loop_timer_callback.toPointer(IOSDeviceDiscovery.timerCallback);
6970
this.notificationCallbackPtr = CoreTypes.CoreTypes.am_device_notification_callback.toPointer(IOSDeviceDiscovery.deviceNotificationCallback);
@@ -72,8 +73,10 @@ class IOSDeviceDiscovery extends DeviceDiscovery {
7273
public startLookingForDevices(): IFuture<void> {
7374
return (() => {
7475
this.subscribeForNotifications();
75-
let defaultTimeoutInSeconds = this.$options.timeout ? parseInt(this.$options.timeout, 10)/1000 : 1;
76-
this.startRunLoopWithTimer(defaultTimeoutInSeconds);
76+
let defaultTimeoutInSeconds = 1;
77+
let parsedTimeout = this.$utils.getParsedTimeout(1);
78+
let timeout = parsedTimeout > defaultTimeoutInSeconds ? parsedTimeout/1000 : defaultTimeoutInSeconds;
79+
this.startRunLoopWithTimer(timeout);
7780
}).future<void>()();
7881
}
7982

utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class Utils implements IUtils {
1212
if(!isNaN(parsedValue) && parsedValue >= 0) {
1313
timeout = parsedValue;
1414
} else {
15-
this.$logger.info("Specify timeout in a number of seconds to wait. Default value: " + timeout + " seconds will be used.");
15+
this.$logger.warn("Specify timeout in a number of seconds to wait. Default value: " + timeout + " seconds will be used.");
1616
}
1717
}
1818

0 commit comments

Comments
 (0)