@wavemaker/rn-codegen 11.8.5-patch.5 → 11.8.5-patch.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/rn-codegen",
3
- "version": "11.8.5-patch.5",
3
+ "version": "11.8.5-patch.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -275,52 +275,75 @@ class App extends BaseApp {
275
275
 
276
276
 
277
277
  {{#if enableWavePulse}}
278
- tryToconnectWavepulse(url) {
279
- this.wavepulseAgent = createWavePulseAgent({
280
- handler: this
278
+ confirmWavePulseConnect(connectionData) {
279
+ return new Promise((resolve, reject) => {
280
+ Alert.alert(
281
+ 'Confirm',
282
+ 'This app is going to connect to WavePulse for debugging remotely.' +
283
+ ' Please tap on \'Yes\' button to confirm the connection.' +
284
+ ' If you are not sure, what WavePulse is or if you don\'t want' +
285
+ ' to connect to WavePulse, press on \'no\' button.',
286
+ [
287
+ {
288
+ text: 'No',
289
+ onPress: () => {
290
+ StorageService.removeItem('wavepulse.server');
291
+ resolve();
292
+ },
293
+ style: 'positive'
294
+ }, {
295
+ text: 'Yes',
296
+ onPress: () => resolve(connectionData),
297
+ style: 'negative'
298
+ }
299
+ ],
300
+ [{
301
+ cancelable: true,
302
+ onDismiss: () => {
303
+ StorageService.removeItem('wavepulse.server');
304
+ resolve();
305
+ }
306
+ }]
307
+ )
281
308
  });
282
- Promise.resolve(url).then(url => {
283
- return url || Linking.getInitialURL()
284
- .then(url => {
285
- return url.split('://wavepulse/connect?url=')[1];
286
- }, () => {})
287
- }).then(url => url || StorageService.getItem('wavepulse.server'))
288
- .then(url => {
289
- if (!url || isWebPreviewMode() || this.appConfig.preferences.autoConfirmWavePulse === true) {
290
- return url;
291
- }
292
- return new Promise((resolve, reject) => {
293
- Alert.alert(
294
- 'Confirm',
295
- 'This app is going to connect to WavePulse for debugging remotely.' +
296
- ' Please tap on \'Yes\' button to confirm the connection.' +
297
- ' If you are not sure, what WavePulse is or if you don\'t want' +
298
- ' to connect to WavePulse, press on \'no\' button.',
299
- [
300
- {
301
- text: 'No',
302
- onPress: () => resolve(),
303
- style: 'positive'
304
- }, {
305
- text: 'Yes',
306
- onPress: () => resolve(url),
307
- style: 'negative'
308
- }
309
- ],
310
- [{
311
- cancelable: true,
312
- onDismiss: () => resolve()
313
- }]
314
- )
315
- });
316
- }).then(url => {
317
- if (url) {
318
- this.wavepulseAgent.connect(url);
309
+ }
310
+
311
+ async tryToconnectWavepulse(connectionData) {
312
+ try{
313
+ this.wavepulseAgent = createWavePulseAgent({
314
+ handler: this
315
+ });
316
+ if (!connectionData) {
317
+ connectionData = await Linking.getInitialURL()
318
+ .then(url => {
319
+ const paramStr = url?.split('://wavepulse/connect?')[1];
320
+ return paramStr?.split('&')
321
+ .map(v => v?.split('='))
322
+ .reduce((r, v) => {
323
+ r[v[0]] = v[1];
324
+ return r;
325
+ }, {})
326
+ }, () => {});
327
+ }
328
+ if (!connectionData || !connectionData.url) {
329
+ connectionData = await StorageService.getItem('wavepulse.server')
330
+ .then(d => d && JSON.parse(d));
331
+ }
332
+ if (!connectionData) {
333
+ return;
334
+ }
335
+ if (!(isWebPreviewMode() || this.appConfig.preferences.autoConfirmWavePulse === true)) {
336
+ connectionData = await this.confirmWavePulseConnect(connectionData);
337
+ }
338
+ if (connectionData) {
339
+ this.wavepulseAgent.connect(connectionData.url, connectionData.channelId);
319
340
  BASE_THEME.enableTrace(true);
320
- StorageService.setItem('wavepulse.server', url);
341
+ StorageService.setItem('wavepulse.server', JSON.stringify(connectionData));
321
342
  LogBox.ignoreAllLogs();
322
343
  }
323
- });
344
+ } catch(e) {
345
+ console.error(e);
346
+ }
324
347
  }
325
348
  {{/if}}
326
349
 
@@ -9,10 +9,10 @@
9
9
  "postinstall": "echo \"\""
10
10
  },
11
11
  "dependencies": {
12
- "@wavemaker/app-rn-runtime": "11.8.5-patch.5",
13
- "@wavemaker/variables": "11.8.5-patch.5",
14
- "@wavemaker/rn-codegen": "11.8.5-patch.5",
15
- "@wavemaker/wavepulse-agent": "1.0.1",
12
+ "@wavemaker/app-rn-runtime": "11.8.5-patch.7",
13
+ "@wavemaker/variables": "11.8.5-patch.7",
14
+ "@wavemaker/rn-codegen": "11.8.5-patch.7",
15
+ "@wavemaker/wavepulse-agent": "1.0.9",
16
16
  "deprecated-react-native-prop-types": "4.1.0",
17
17
  "expo": "50.0.17",
18
18
  "expo-build-properties": "0.12.0",
@@ -9,10 +9,10 @@
9
9
  "postinstall": "node ./scripts/post-build.js"
10
10
  },
11
11
  "dependencies": {
12
- "@wavemaker/app-rn-runtime": "11.8.5-patch.5",
13
- "@wavemaker/variables": "11.8.5-patch.5",
14
- "@wavemaker/rn-codegen": "11.8.5-patch.5",
15
- "@wavemaker/wavepulse-agent": "1.0.1",
12
+ "@wavemaker/app-rn-runtime": "11.8.5-patch.7",
13
+ "@wavemaker/variables": "11.8.5-patch.7",
14
+ "@wavemaker/rn-codegen": "11.8.5-patch.7",
15
+ "@wavemaker/wavepulse-agent": "1.0.9",
16
16
  "deprecated-react-native-prop-types": "4.1.0",
17
17
  "expo": "50.0.17",
18
18
  "expo-build-properties": "0.12.0",
@@ -10,9 +10,14 @@ let wavePulseAgent = new (class WavePulseAgent extends Agent {
10
10
  isFlushAllowed() {
11
11
  return this.isConnected;
12
12
  }
13
- connect(debugServerUrl) {
13
+ connect(serverUrl, channelId) {
14
+ const pathIndex = serverUrl.indexOf('/', serverUrl.indexOf('//') + 2);
15
+ const serverOrigin = pathIndex > 0 ? serverUrl.substring(0, pathIndex) : serverUrl;
16
+ const contextPath = pathIndex > 0 ? serverUrl.substring(pathIndex) : undefined;
14
17
  this.setChannel(WebSocketChannel.connect({
15
- 'url': debugServerUrl || ''
18
+ 'url': serverOrigin || '',
19
+ 'path': contextPath + '/socket.io',
20
+ 'channelId': channelId
16
21
  }));
17
22
  }
18
23
  })();