Skip to content

Commit

Permalink
feat: get only user apps in file-movement for performance aspect, add…
Browse files Browse the repository at this point in the history
… comments (appium#1014)

* get only user app in file management since UIFileSharingEnabled probably only has user app
  • Loading branch information
KazuCocoa authored Jul 26, 2019
1 parent fd1d5b5 commit 1138888
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/commands/file-movement.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,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'});
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,..
*/
async isAppInstalled (bundleid) {
const service = await services.startInstallationProxyService(this.udid);
try {
Expand Down

0 comments on commit 1138888

Please sign in to comment.