esoftplay 0.0.111-b → 0.0.111-e

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/esp.ts CHANGED
@@ -8,7 +8,7 @@ import routers from './cache/routers';
8
8
  import './oneplusfixfont';
9
9
  LogBox.ignoreLogs(['YellowBox has been replaced with LogBox. Please call LogBox.ignoreLogs() instead.']);
10
10
  LogBox.ignoreLogs(['VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.']);
11
- LogBox.ignoreLogs([`Got a component with the name 'm' for the screen 'component/map'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.`]);
11
+ LogBox.ignoreLogs([`Got a component with the name 'm'`]);
12
12
  let app = require('../../app.json');
13
13
  let conf = require('../../config.json');
14
14
  let lconf
@@ -9,6 +9,7 @@ const { manifest } = Constants;
9
9
 
10
10
  export default class ecurl {
11
11
  timeout = 55000;
12
+ maxRetry = 2;
12
13
  timeoutContext: any = null;
13
14
  isDebug = esp.config("isDebug");
14
15
  post: any;
@@ -29,6 +30,7 @@ export default class ecurl {
29
30
 
30
31
  constructor(uri?: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) {
31
32
  this.header = {}
33
+ this.maxRetry = 2;
32
34
  this.setUri = this.setUri.bind(this);
33
35
  this.setUrl = this.setUrl.bind(this);
34
36
  this.buildUri = this.buildUri.bind(this);
@@ -59,7 +61,6 @@ export default class ecurl {
59
61
  this.cancelTimeout()
60
62
  this.timeoutContext = setTimeout(() => {
61
63
  if (this.abort?.cancel) {
62
- // reportApiError(`Request timeout`, this.url + this.uri)
63
64
  this.closeConnection()
64
65
  LibProgress.hide()
65
66
  }
@@ -190,7 +191,13 @@ export default class ecurl {
190
191
  onFailed(this.refineErrorMessage(msg), false)
191
192
  }, debug)
192
193
  }).catch((r: string) => {
193
- this.cancelTimeout();
194
+ this.cancelTimeout();
195
+ if (this.maxRetry > 0) {
196
+ this.init(uri, post, onDone, onFailed, debug)
197
+ this.maxRetry = this.maxRetry - 1
198
+ } else {
199
+ this.onFetched(r, onDone, onFailed, debug)
200
+ }
194
201
  LibProgress.hide()
195
202
  this.onFetchFailed(r)
196
203
  })
@@ -369,7 +376,7 @@ export default class ecurl {
369
376
  // console.log(this.url + this.uri, { ...options, cancelToken: undefined })
370
377
  // }
371
378
 
372
- if (esp.isDebug('apitest') && manifest?.packagerOpts?.dev) {
379
+ if (esp.isDebug('apitest') && manifest?.packagerOpts?.dev && LogStateProperty) {
373
380
  const allData = LogStateProperty.state().get() || []
374
381
  const logEnable = LogStateProperty.enableLog().get()
375
382
 
@@ -406,7 +413,12 @@ export default class ecurl {
406
413
  this.onFetched(res.data, onDone, onFailed, debug)
407
414
  }).catch((e: any) => {
408
415
  this.cancelTimeout()
409
- this.onFetched(e, onDone, onFailed, debug)
416
+ if (this.maxRetry > 0) {
417
+ this.init(uri, post, onDone, onFailed, debug)
418
+ this.maxRetry = this.maxRetry - 1
419
+ } else {
420
+ this.onFetched(e, onDone, onFailed, debug)
421
+ }
410
422
  })
411
423
  }
412
424
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.111-b",
3
+ "version": "0.0.111-e",
4
4
  "description": "embedding data from esoftplay framework (web based) into mobile app",
5
5
  "main": "cache/index.js",
6
6
  "types": "../../index.d.ts",