-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremotedebug-ios-webkit-adapter.patch
141 lines (129 loc) · 5.61 KB
/
remotedebug-ios-webkit-adapter.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
commit 6b3b16b1ebb434e63d473411d650353a7a4f2894
Author: Łukasz Gurdek <[email protected]>
Date: Tue Sep 5 12:30:16 2017 +0200
Initial ReactNative customization
diff --git a/src/adapters/adapter.ts b/src/adapters/adapter.ts
index 523357b..ca07a9a 100644
--- a/src/adapters/adapter.ts
+++ b/src/adapters/adapter.ts
@@ -33,7 +33,7 @@ export class Adapter extends EventEmitter {
options.pollingInterval = options.pollingInterval || 3000;
options.baseUrl = options.baseUrl || 'http://127.0.0.1';
options.path = options.path || '/json';
- options.port = options.port || 9222;
+ options.port = options.port || 9003;
this._options = options;
this._url = `${this._options.baseUrl}:${this._options.port}${this._options.path}`;
@@ -54,13 +54,7 @@ export class Adapter extends EventEmitter {
public start(): Promise<any> {
debug(`adapter.start`, this._options)
- if (!this._options.proxyExePath) {
- debug(`adapter.start: Skip spawnProcess, no proxyExePath available`)
- return Promise.resolve(`skipped`)
- }
-
- return this.spawnProcess(this._options.proxyExePath, this._options.proxyExeArgs)
-
+ return Promise.resolve()
}
public stop(): void {
diff --git a/src/adapters/iosAdapter.ts b/src/adapters/iosAdapter.ts
index 0310753..44a83d8 100644
--- a/src/adapters/iosAdapter.ts
+++ b/src/adapters/iosAdapter.ts
@@ -76,21 +76,19 @@ export class IOSAdapter extends AdapterCollection {
// Now start up all the adapters
devices.forEach(d => {
const adapterId = `${this._id}_${d.deviceId}`;
-
if (!this._adapters.has(adapterId)) {
- const parts = d.url.split(':');
- if (parts.length > 1) {
- // Get the port that the ios proxy exe is forwarding for this device
- const port = parseInt(parts[1], 10);
-
- // Create a new adapter for this device and add it to our list
- const adapter = new Adapter(adapterId, this._proxyUrl, { port: port });
- adapter.start();
- adapter.on('socketClosed', (id) => {
- this.emit('socketClosed', id);
- });
- this._adapters.set(adapterId, adapter);
- }
+
+ // Get the port that the ios proxy exe is forwarding for this device
+ // const port = parseInt(parts[1], 10);
+ const port = 9003;
+
+ // Create a new adapter for this device and add it to our list
+ const adapter = new Adapter(adapterId, this._proxyUrl, { port: port });
+ adapter.start();
+ adapter.on('socketClosed', (id) => {
+ this.emit('socketClosed', id);
+ });
+ this._adapters.set(adapterId, adapter);
}
});
return Promise.resolve(devices);
@@ -142,23 +140,7 @@ export class IOSAdapter extends AdapterCollection {
private static getProxyPath(): Promise<string> {
debug(`iOSAdapter.getProxyPath`)
return new Promise((resolve, reject) => {
- if (os.platform() === 'win32') {
- const proxy = path.resolve(__dirname, '../../node_modules/vs-libimobile/lib/ios_webkit_debug_proxy.exe');
- try {
- fs.statSync(proxy);
- resolve(proxy)
- } catch (err) {
- reject(`ios_webkit_debug_proxy.exe not found. Please install 'npm install -g vs-libimobile'`)
- }
- } else if (os.platform() === 'darwin' || os.platform() === 'linux') {
- which('ios_webkit_debug_proxy', function (err, resolvedPath) {
- if (err) {
- reject('ios_webkit_debug_proxy not found. Please install ios_webkit_debug_proxy (https://github.com/google/ios-webkit-debug-proxy)')
- } else {
- resolve(resolvedPath)
- }
- })
- }
+ resolve()
})
}
@@ -188,26 +170,13 @@ export class IOSAdapter extends AdapterCollection {
private async getDeviceVersion(uuid: string): Promise<string> {
debug(`iOSAdapter.getDeviceVersion`)
- const _iDeviceInfoPath = await IOSAdapter.getDeviceInfoPath();
- var proc = await execFile(_iDeviceInfoPath, ['-u', `${uuid}`, '-k', 'ProductVersion'])
- let deviceVersion = ''
- if (!proc.err) {
- deviceVersion = proc.stdout.trim();
- }
-
- return deviceVersion;
+ return "10";
};
private getProtocolFor(version: string, target: Target): IOSProtocol {
debug(`iOSAdapter.getProtocolFor`)
- const parts = version.split('.');
- if (parts.length > 0) {
- const major = parseInt(parts[0], 10);
- if (major <= 8) {
- return new IOS8Protocol(target);
- }
- }
+
return new IOS9Protocol(target);
}
diff --git a/src/server.ts b/src/server.ts
index 266697d..e6d775b 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -47,8 +47,8 @@ export class ProxyServer extends EventEmitter {
- const port = this._hs.address().port;
+ const port = (this._hs.address() as any).port;
const settings = await IOSAdapter.getProxySettings({
proxyPath: null,
- proxyPort: (port + 100),
+ proxyPort: 9003,
proxyArgs: null
});