mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-05 10:49:24 +02:00
refactor(adb): further split sync module
This commit is contained in:
parent
65e0ba042e
commit
d887639efd
18 changed files with 482 additions and 419 deletions
|
@ -1,23 +1,18 @@
|
|||
import { AdbCommandBase } from './base';
|
||||
|
||||
export class AdbTcpIpCommand extends AdbCommandBase {
|
||||
private async getProp(key: string): Promise<string> {
|
||||
const output = await this.adb.shell('getprop', key);
|
||||
return output.trim();
|
||||
}
|
||||
|
||||
public async getAddresses(): Promise<string[]> {
|
||||
const propAddr = await this.getProp('service.adb.listen_addrs');
|
||||
const propAddr = await this.adb.getProp('service.adb.listen_addrs');
|
||||
if (propAddr) {
|
||||
return propAddr.split(',');
|
||||
}
|
||||
|
||||
let port = await this.getProp('service.adb.tcp.port');
|
||||
let port = await this.adb.getProp('service.adb.tcp.port');
|
||||
if (port) {
|
||||
return [`0.0.0.0:${port}`];
|
||||
}
|
||||
|
||||
port = await this.getProp('persist.adb.tcp.port');
|
||||
port = await this.adb.getProp('persist.adb.tcp.port');
|
||||
if (port) {
|
||||
return [`0.0.0.0:${port}`];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue