@mcesystems/adb-kit 1.0.91 → 1.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -31479,7 +31479,7 @@ var AdbDeviceKit = class {
31479
31479
  return client;
31480
31480
  }
31481
31481
  async listDevices() {
31482
- const devices = await this.client.listDevices();
31482
+ const devices = await this.client.listDevices().filter((device) => device.type === "device");
31483
31483
  return devices;
31484
31484
  }
31485
31485
  async getProperty(adbDevice, property) {
@@ -31542,13 +31542,20 @@ var AdbDeviceKit = class {
31542
31542
  waitForUsbDebugging(timeout2 = 12e4, _numberOfAllowedAttempts = 5) {
31543
31543
  const events = new EventEmitter();
31544
31544
  const promise = (async () => {
31545
- if (await this.hasUsbDebugging()) {
31545
+ const device = (await this.client.listDevices()).find((device2) => device2.id === this.deviceId);
31546
+ logDetail(`Device: ${device?.id} (${device?.type})`);
31547
+ if (device?.type === "device") {
31546
31548
  logDetail("USB debugging is already enabled");
31547
31549
  return true;
31548
31550
  }
31549
31551
  const trackingClient = this.createTrackingClient();
31550
31552
  const tracker = await trackingClient.trackDevices();
31551
- events.emit(USB_DEBUGGING_EVENT_OFF);
31553
+ if (device?.type === "unauthorized") {
31554
+ logDetail("Device needs 'Always allow' authorization");
31555
+ events.emit(USB_DEBUGGING_EVENT_NEEDS_ALWAYS_ALLOW);
31556
+ } else {
31557
+ events.emit(USB_DEBUGGING_EVENT_OFF);
31558
+ }
31552
31559
  let settled = false;
31553
31560
  return new Promise((resolve, reject) => {
31554
31561
  const timeoutId = setTimeout(() => {
@@ -31575,14 +31582,14 @@ var AdbDeviceKit = class {
31575
31582
  reject(result.err);
31576
31583
  }
31577
31584
  };
31578
- const handleAddOrChange = (device) => {
31579
- if (!this.matchesDeviceId(device)) return;
31580
- if (device.type === "unauthorized") {
31585
+ const handleAddOrChange = (device2) => {
31586
+ if (!this.matchesDeviceId(device2)) return;
31587
+ if (device2.type === "unauthorized") {
31581
31588
  logDetail("Device needs 'Always allow' authorization");
31582
31589
  events.emit(USB_DEBUGGING_EVENT_NEEDS_ALWAYS_ALLOW);
31583
31590
  return;
31584
31591
  }
31585
- if (device.type === "device") {
31592
+ if (device2.type === "device") {
31586
31593
  logDetail("Device authorized");
31587
31594
  events.emit(USB_DEBUGGING_EVENT_AUTHORIZED);
31588
31595
  settle({ type: "resolve", value: true });