Skip to content

Commit

Permalink
feat: always use vendContainer to add files without extra app permiss…
Browse files Browse the repository at this point in the history
…ions (#2522)
  • Loading branch information
aluedeke authored Jan 30, 2025
1 parent 2f96435 commit 6f3e7b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/guides/file-transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ possible formats this path can take:
* `<container-type>` is the container type
* On simulators, common values are `app`, `data`, `groups`, but a custom one can also be provided
* On real devices, the only accepted value is `documents`. All others are treated as Format 2
* This value can only be specified for apps that have the `UIFileSharingEnabled` flag set to
* In `xcuitest-driver` versions prior to version `v8.3.0` the following limitation applies:
This value can only be specified for apps that have the `UIFileSharingEnabled` flag set to
`true`. You can use the [`mobile: listApps`](../reference/execute-methods.md#mobile-listapps)
extension to identify such apps.
* `<path-to-file-or-folder>` is the target file or folder
Expand Down
9 changes: 3 additions & 6 deletions lib/commands/file-movement.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,14 @@ function verifyIsSubPath(originalPath, root) {
*
* @param {string} udid
* @param {string} [bundleId]
* @param {string} [containerType]
* @returns {Promise<any>}
*/
async function createAfcClient(udid, bundleId, containerType) {
async function createAfcClient(udid, bundleId) {
if (!bundleId) {
return await services.startAfcService(udid);
}
const service = await services.startHouseArrestService(udid);
return isDocumentsContainer(containerType)
? await service.vendDocuments(bundleId)
: await service.vendContainer(bundleId);
return await service.vendContainer(bundleId);
}

/**
Expand All @@ -103,7 +100,7 @@ function isDocumentsContainer(containerType) {
async function createService(remotePath) {
if (CONTAINER_PATH_PATTERN.test(remotePath)) {
const {bundleId, pathInContainer, containerType} = await parseContainerPath.bind(this)(remotePath);
const service = await createAfcClient(this.device.udid, bundleId, containerType);
const service = await createAfcClient(this.device.udid, bundleId);
const relativePath = isDocumentsContainer(containerType)
? path.join(CONTAINER_DOCUMENTS_PATH, pathInContainer)
: pathInContainer;
Expand Down

0 comments on commit 6f3e7b5

Please sign in to comment.