@wavemaker/rn-codegen 11.9.1-next.27517 → 11.9.1-next.27523

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.
rn-codegen/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/rn-codegen",
3
- "version": "11.9.1-next.27517",
3
+ "version": "11.9.1-next.27523",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -336,9 +336,14 @@ class App extends BaseApp {
336
336
  connectionData = await this.confirmWavePulseConnect(connectionData);
337
337
  }
338
338
  if (connectionData) {
339
- this.wavepulseAgent.connect(connectionData.url, connectionData.channelId);
339
+ this.wavepulseAgent
340
+ .connect(connectionData.url, connectionData.channelId)
341
+ .then(() => {
342
+ StorageService.setItem('wavepulse.server', JSON.stringify(connectionData));
343
+ }, () => {
344
+ StorageService.removeItem('wavepulse.server');
345
+ });
340
346
  BASE_THEME.enableTrace(true);
341
- StorageService.setItem('wavepulse.server', JSON.stringify(connectionData));
342
347
  LogBox.ignoreAllLogs();
343
348
  }
344
349
  } catch(e) {
@@ -9,10 +9,10 @@
9
9
  "postinstall": "echo \"\""
10
10
  },
11
11
  "dependencies": {
12
- "@wavemaker/app-rn-runtime": "11.9.1-next.27517",
13
- "@wavemaker/variables": "11.9.1-next.27517",
14
- "@wavemaker/rn-codegen": "11.9.1-next.27517",
15
- "@wavemaker/wavepulse-agent": "1.0.9",
12
+ "@wavemaker/app-rn-runtime": "11.9.1-next.27523",
13
+ "@wavemaker/variables": "11.9.1-next.27523",
14
+ "@wavemaker/rn-codegen": "11.9.1-next.27523",
15
+ "@wavemaker/wavepulse-agent": "1.0.11",
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.9.1-next.27517",
13
- "@wavemaker/variables": "11.9.1-next.27517",
14
- "@wavemaker/rn-codegen": "11.9.1-next.27517",
15
- "@wavemaker/wavepulse-agent": "1.0.9",
12
+ "@wavemaker/app-rn-runtime": "11.9.1-next.27523",
13
+ "@wavemaker/variables": "11.9.1-next.27523",
14
+ "@wavemaker/rn-codegen": "11.9.1-next.27523",
15
+ "@wavemaker/wavepulse-agent": "1.0.11",
16
16
  "deprecated-react-native-prop-types": "4.1.0",
17
17
  "expo": "50.0.17",
18
18
  "expo-build-properties": "0.12.0",
@@ -0,0 +1,61 @@
1
+ export const EVENTS = {
2
+ CONSOLE: {
3
+ LOG: 'console-log'
4
+ },
5
+ DOM: {
6
+ REFRESH: 'refresh'
7
+ },
8
+ VARIABLE: {
9
+ BEFORE_INVOKE: 'variable-before-invoke',
10
+ AFTER_INVOKE: 'variable-after-invoke'
11
+ },
12
+ SERVICE: {
13
+ BEFORE_CALL: 'service_before_call',
14
+ AFTER_CALL: 'service_after_call'
15
+ },
16
+ TIMELINE: {
17
+ EVENT: 'timeline-event'
18
+ }
19
+ };
20
+
21
+ export const CALLS = {
22
+ APP: {
23
+ INFO: 'GET_APP_INFO',
24
+ },
25
+ PLATFORM: {
26
+ INFO: 'GET_PLATFORM_INFO',
27
+ },
28
+ HANDSHAKE: {
29
+ RELOAD: 'RELOAD',
30
+ WISH: 'SAY_HELLO'
31
+ },
32
+ WIDGET: {
33
+ GET: 'GET_WIDGET',
34
+ HIGHLIGHT: 'HIGHLIGHT',
35
+ GET_PROPERTIES_N_STYLES: 'GET_PROPERTIES_N_STYLES',
36
+ TREE: 'GET_WIDGET_TREE'
37
+ },
38
+ EXPRESSION: {
39
+ EVAL: 'EVAL'
40
+ },
41
+ UI: {
42
+ REFRESH: 'REFRESH'
43
+ },
44
+ STATS: {
45
+ START_UP: 'START_UP_METRICS',
46
+ NAVIGATION: 'NAVIGATION_METRICS'
47
+ },
48
+ THEME: {
49
+ GET: 'GET_THEME',
50
+ GET_ACTIVE_THEME: 'GET_ACTIVE_THEME'
51
+ },
52
+ STORAGE: {
53
+ GET: 'GET',
54
+ SET: 'SET',
55
+ REMOVE: 'REMOVE',
56
+ GET_ALL: 'GET_ALL'
57
+ },
58
+ LOCALE: {
59
+ GET: 'GET_LOCALE'
60
+ }
61
+ };
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
- import { Agent, WebSocketChannel, EVENTS, CALLS} from '@wavemaker/wavepulse-agent/index';
2
+ import { Agent, WebSocketChannel } from '@wavemaker/wavepulse-agent/index';
3
+ import { EVENTS, CALLS } from './constants';
3
4
  import axios from 'axios';
4
5
  import RN2CSS from './rn2css.json';
5
6
 
6
7
  const MAX_WAITING_TIME_FOR_CONNECTION = 30 * 1000;
7
8
  let wavePulseAgent = new (class WavePulseAgent extends Agent {
9
+ onConnection;
10
+ onConnectionFailed;
8
11
  constructor() {
9
12
  super(...arguments);
10
13
  this.isConnected = false;
11
14
  this.closed = false;
12
- setTimeout(() => {
13
- if (!this.isConnected) {
14
- this.closed = true;
15
- this.buffer = [];
16
- }
17
- }, MAX_WAITING_TIME_FOR_CONNECTION);
18
15
  }
19
16
  isFlushAllowed() {
20
17
  return this.isConnected;
@@ -28,6 +25,27 @@ let wavePulseAgent = new (class WavePulseAgent extends Agent {
28
25
  'path': contextPath + '/socket.io',
29
26
  'channelId': channelId
30
27
  }));
28
+ this.onConnectionFailed && this.onConnectionFailed();
29
+ setTimeout(() => {
30
+ this.invoke(CALLS.HANDSHAKE.RELOAD);
31
+ }, 1000);
32
+ setTimeout(() => {
33
+ if (!this.isConnected) {
34
+ this.closed = true;
35
+ this.buffer = [];
36
+ this.onConnectionFailed && this.onConnectionFailed();
37
+ }
38
+ }, MAX_WAITING_TIME_FOR_CONNECTION);
39
+ return new Promise((resolve, reject) => {
40
+ this.onConnection = () => {
41
+ this.onConnection = undefined;
42
+ resolve();
43
+ };
44
+ this.onConnectionFailed = () => {
45
+ this.onConnectionFailed = undefined;
46
+ reject();
47
+ };
48
+ });
31
49
  }
32
50
  notify(event, type, args, buffer) {
33
51
  if (!this.closed) {
@@ -255,6 +273,7 @@ function bindCalls() {
255
273
  setTimeout(() => {
256
274
  wavePulseAgent.isConnected = true;
257
275
  wavePulseAgent.isClosed = false;
276
+ wavePulseAgent.onConnection && wavePulseAgent.onConnection();
258
277
  wavePulseAgent.processBuffer();
259
278
  }, 2000);
260
279
  return Promise.resolve('Hello');