Skip to content
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: get only user apps in file-movement for performance aspect, add comments #1014

Merged
merged 4 commits into from
Jul 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/commands/file-movement.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,16 @@ async function pullFromRealDevice (device, remotePath, isFile) {
/**
* Get bundleIds which can mount by `--documents` flag
*
*
* @param {Object} udid - The udid of the target device
* @returns {Array<string>} A list of bundle ids
* @returns {Array<string>} A list of User level apps' bundle ids which has
* 'UIFileSharingEnabled' attribute.
* Only user apps might have it.
*/
async function getAvailableBundleIds (udid) {
const service = await services.startInstallationProxyService(udid);
try {
const applications = await service.listApplications();
const applications = await service.listApplications({applicationType: 'User'});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't find UIFileSharingEnabled in system apps so far.
We can ignore it, for now, to improve find app performance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

const bundleIds = [];
for (const [key, value] of Object.entries(applications)) {
if (!value.UIFileSharingEnabled) {
Expand Down
12 changes: 12 additions & 0 deletions lib/ios-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ class IOSDeploy {
await this.install(app);
}

/**
* Return an application object if test app has 'bundleid'.
* The target bundleid can be User and System apps.
* @param {string} bundleid The bundleId to ensure it is installed
* @return {boolean} Returns True if the bundleid exists in the result of 'listApplications' like:
* { "com.apple.Preferences":{
* "UIRequiredDeviceCapabilities":["arm64"],
* "UIRequiresFullScreen":true,
* "CFBundleInfoDictionaryVersion":"6.0",
* "Entitlements":
* {"com.apple.frontboard.delete-application-snapshots":true,..
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can actually speed this part up by using a different API. We can directly ask the phone if a certain bundle id is present. I will try to implement that today

async isAppInstalled (bundleid) {
const service = await services.startInstallationProxyService(this.udid);
try {
Expand Down