-
Notifications
You must be signed in to change notification settings - Fork 10
Remove ios native dependencies #889
Remove ios native dependencies #889
Conversation
a0904aa
to
97cbce9
Compare
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.
Please fix relevant comments
] | ||
*/ | ||
const mappedApps = _.map(applicationsOnDevice, app => { | ||
return { |
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.
You can use the short syntax here:
_.map(applicationsOnDevice, app => ({
applicationIdentifier: app.CFBundleIdentifier,
isLiveSyncSupported: app.IceniumLiveSyncEnabled,
configuration: app.configuration,
deviceIdentifier: this.device.deviceInfo.identifier
}));
})); | ||
this.applicationsLiveSyncInfos = this.applicationsLiveSyncInfos.concat(currentList); | ||
}); | ||
this.applicationsLiveSyncInfos = this.applicationsLiveSyncInfos.concat(mappedApps); |
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.
Since you're setting this.applicationsLiveSyncInfos = []
10 rows above, IMO there's no need to concat
here.
You can skip this.applicationsLiveSyncInfos = []
from above and just reassign here:
this.applicationsLiveSyncInfos = mappedApps;
|
||
this.$logger.trace("Application %s has been uninstalled successfully.", appIdentifier); | ||
} | ||
|
||
public async startApplication(appIdentifier: string): Promise<void> { | ||
if (this.$hostInfo.isWindows && !this.$staticConfig.enableDeviceRunCommandOnWindows) { | ||
this.$errors.fail("$%s device run command is not supported on Windows for iOS devices.", this.$staticConfig.CLIENT_NAME.toLowerCase()); | ||
// this.$errors.fail("$%s device run command is not supported on Windows for iOS devices.", this.$staticConfig.CLIENT_NAME.toLowerCase()); |
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.
Do we need this?
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 believe we need it.
try { | ||
await settlePromises(await this.$iosDeviceOperations.uploadFiles(filesToUpload)); | ||
} catch (err) { | ||
if (err.deviceId === this.device.deviceInfo.identifier) { |
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.
settlePromises
alters the thrown error, so you won't get an object that has a deviceId
in the catch
clause
} | ||
} | ||
|
||
@cache() |
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 don't think we should @cache
this - what if we want to start a second device log (e.g. we have two devices attached)
mobile/ios/device/ios-device.ts
Outdated
import * as applicationManagerPath from "./ios-application-manager"; | ||
import * as fileSystemPath from "./ios-device-file-system"; | ||
import * as constants from "../../../constants"; | ||
import * as net from "net"; | ||
|
||
export class IOSDevice implements Mobile.IiOSDevice { | ||
// iOS errors are described here with HEX representation |
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.
IMO you can delete those comments too - they're no longer relevant
mobile/ios/device/ios-device.ts
Outdated
|
||
public async openDeviceLogStream(): Promise<void> { | ||
if (this.deviceInfo.status !== constants.UNREACHABLE_STATUS) { | ||
await this.$iosDeviceOperations.startDeviceLog(this.deviceInfo.identifier, (data: string) => { |
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.
There's no need to await
this - it doesn't return a Promise
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.
The title says: Remove ios native dependencies
However the PR just adds dependency in package.json. Shouldn't we actually delete the native dependencies from package.json?
this.$logger.trace(`Error while uninstalling application ${e}.`); | ||
} | ||
await this.$iosDeviceOperations.uninstall(appIdentifier, [this.device.deviceInfo.identifier], (err: IDeviceOperationError) => { | ||
this.$logger.warn(`Failed to uninstall install ${appIdentifier} on device with identifier ${err.deviceIdentifier}`); |
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.
which operation failed - unisntall or install ?
|
||
public async execute(args: string[]): Promise<void> { | ||
await this.$devicesService.initialize({ deviceId: this.$options.device, skipInferPlatform: true }); | ||
let appIdentifier = args[1]; |
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.
as we modify the command, shouldn't we delete the $options.app
that has been used before (not in the command itself, but in the service behind it. If I understand correctly, we'll support getting of file only from application sandbox, so the $options.app
is a mandatory argument now. So... let's remove $options.app
|
||
this.$logger.trace("Application %s has been uninstalled successfully.", appIdentifier); | ||
} | ||
|
||
public async startApplication(appIdentifier: string): Promise<void> { | ||
if (this.$hostInfo.isWindows && !this.$staticConfig.enableDeviceRunCommandOnWindows) { | ||
this.$errors.fail("$%s device run command is not supported on Windows for iOS devices.", this.$staticConfig.CLIENT_NAME.toLowerCase()); | ||
// this.$errors.fail("$%s device run command is not supported on Windows for iOS devices.", this.$staticConfig.CLIENT_NAME.toLowerCase()); |
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 believe we need it.
c752b38
to
99e1148
Compare
cda297e
to
f06b56e
Compare
related issue: NativeScript/nativescript-cli#2562 |
f06b56e
to
eaec133
Compare
8ebc7b9
to
a82b75c
Compare
We need to remove our native dependencies - ref and ffi because they are casuing problems with each version of NodeJS which has new version of V8 in it. We are using ref and ffi to communicate with iTunes and execute fs and application management operations on iOS devices. This operations are moved in new dependency - device-lib. The device lib has JavaScript wrapper which we use in the CLI. Everything in the ios device file system and ios device application manager is replaced with the exposed methods from the device lib.
f978b57
to
741a91d
Compare
f2d2993
to
220a852
Compare
Since we use the ios-device-lib to connect to the device backend port for debugging, the socket returned from the device can be used only in the ios-device lib. That's why we need to change the logic for creating the Node.js socket in the CLI. The ios-device-lib will expose the device socket on a specific port in the localhost. After we connect to the exposed socket we can continue to work like we used to.
220a852
to
cfd19f2
Compare
💔 |
run ci |
❤️ |
802b22c
to
32ecf38
Compare
❤️ |
We need to remove our native dependencies - ref and ffi because they are casuing problems with each version of NodeJS which has new version of V8 in it. We are using ref and ffi to communicate with iTunes and execute fs and application management operations on iOS devices. This operations are moved in new dependency - device-lib. The device lib has JavaScript wrapper which we use in the CLI. Everything in the ios device file system and ios device application manager is replaced with the exposed methods from the device lib.