Skip to content

Commit d6f0c4b

Browse files
committed
Update ADBkit for minor type fixes & install error handling
1 parent 4fedbd8 commit d6f0c4b

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"homepage": "https://github.com/httptoolkit/httptoolkit-server",
2727
"bugs": "https://github.com/httptoolkit/httptoolkit-server/issues",
2828
"dependencies": {
29-
"@devicefarmer/adbkit": "^3.2.4",
29+
"@devicefarmer/adbkit": "^3.2.5",
3030
"@graphql-tools/schema": "^8.5.0",
3131
"@graphql-tools/utils": "^8.8.0",
3232
"@httptoolkit/browser-launcher": "^2.1.0",

src/interceptors/android/adb-commands.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const getConnectedDevices = batchCalls(async (adbClient: Adb.Client) => {
6767
try {
6868
const devices = await (adbClient.listDevices() as Promise<Adb.Device[]>);
6969
return devices
70-
.filter((d: { type: string }) => // Required until https://github.com/DeviceFarmer/adbkit/pull/437 is merged
70+
.filter((d) =>
7171
d.type !== 'offline' &&
7272
d.type !== 'unauthorized' &&
7373
!d.type.startsWith("no permissions")
@@ -141,8 +141,7 @@ export async function pushFile(
141141
path: string,
142142
mode?: number
143143
) {
144-
const transfer = await adbClient.push(contents as any, path, mode);
145-
// Any required until https://github.com/DeviceFarmer/adbkit/pull/436 is released
144+
const transfer = await adbClient.push(contents, path, mode);
146145

147146
return new Promise((resolve, reject) => {
148147
transfer.on('end', resolve);

src/interceptors/android/android-adb-interceptor.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,13 @@ export class AndroidAdbInterceptor implements Interceptor {
7171
if (!(await deviceClient.isInstalled('tech.httptoolkit.android.v1'))) {
7272
console.log("App not installed, installing...");
7373
try {
74-
await deviceClient.install(
75-
await streamLatestApk(this.config) as any
76-
// Any required until https://github.com/DeviceFarmer/adbkit/pull/436 is released
77-
);
74+
await deviceClient.install(await streamLatestApk(this.config));
7875
} catch (e) {
7976
console.log("Resetting & retrying APK install, after initial failure:", e);
8077
// This can fail due to connection issues (with the device or while downloading
8178
// the APK) due to a corrupted APK. Reset the APKs and try again, just in case.
8279
await clearAllApks(this.config);
83-
await deviceClient.install(
84-
await streamLatestApk(this.config) as any
85-
// Any required until https://github.com/DeviceFarmer/adbkit/pull/436 is released
86-
);
80+
await deviceClient.install(await streamLatestApk(this.config));
8781
}
8882
console.log("App installed successfully");
8983

0 commit comments

Comments
 (0)