Skip to content

Commit

Permalink
wip: android closeDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
yowpark committed Oct 20, 2023
1 parent 9b49c40 commit f0d6c3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export class AndroidSharedDeviceService implements Zombieable {
throw e;
});
this.state = 'preinstalling';
await this.appiumAdb.setDeviceLocale('en-US');
await Adb.allowNonMarketApps(this.serial, this.printable).catch((e) => {
this.printable.error(`AndroidSharedDeviceService.revive.allowNonMarketApps failed.`, { error: errorify(e) });
});
Expand All @@ -123,13 +124,15 @@ export class AndroidSharedDeviceService implements Zombieable {
this.printable.error(`AndroidSharedDeviceService.revive.joinWifi failed.`, { error: errorify(e) });
});
this.state = 'changing-locale';
await this.appiumAdb.setDeviceLocale('en-US');
await Adb.stayOnWhilePluggedIn(this.serial).catch((e) => {
this.printable.error(`AndroidSharedDeviceService.revive.stayOnWhilePluggedIn failed.`, { error: errorify(e) });
});
await this.closeDialog().catch((e) => {
this.printable.error(`AndroidSharedDeviceService.revive.closeDialog failed.`, { error: errorify(e) });
});
this.isSetupDone = true;
this.state = 'setup-done';
}
await Adb.stayOnWhilePluggedIn(this.serial).catch((e) => {
this.printable.error(`AndroidSharedDeviceService.revive.stayOnWhilePluggedIn failed.`, { error: errorify(e) });
});
this.startLogcatProcess(this.serial, this.printable).catch((e) => {
this.printable.error(e);
});
Expand Down Expand Up @@ -250,6 +253,12 @@ export class AndroidSharedDeviceService implements Zombieable {
await Adb.keyevent(this.serial, DeviceControlKeycode.DEVICE_CONTROL_KEYCODE_MUTE);
}

private async closeDialog(): Promise<void> {
for await (const _ of loop(30, 5)) {
await Adb.keyevent(this.serial, DeviceControlKeycode.DEVICE_CONTROL_KEYCODE_BACK);
}
}

private killLogcatProcess(): void {
if (!this.logcatProc) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,9 @@ func (ldc *DeviceServerWebSocketLabeledDatachannel) onMessage(msg webrtc.DataCha
log.Inst.Error("DeviceServerWebSocketLabeledDatachannel connection is nil", zap.String("name", ldc.label().Name))
return
}
name := ldc.label().Name
path := connection.GetPath()
log.Inst.Info("DeviceServerWebSocketLabeledDatachannel datachannel omMessage", zap.String("name", name), zap.String("path", path))
// name := ldc.label().Name
// path := connection.GetPath()
// log.Inst.Debug("DeviceServerWebSocketLabeledDatachannel datachannel omMessage", zap.String("name", name), zap.String("path", path))

if nil == ldc.conn {
log.Inst.Error("DeviceServerWebSocketLabeledDatachannel connection is nil")
Expand Down

0 comments on commit f0d6c3d

Please sign in to comment.