esoftplay 0.0.128-e → 0.0.128-g

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/bin/locale.js CHANGED
@@ -6,6 +6,9 @@ function readAsJson(path) {
6
6
  try { out = JSON.parse(fs.readFileSync(path, { encoding: 'utf8' })) } catch (e) { }
7
7
  return out;
8
8
  }
9
+ if (!fs.existsSync("./assets/locale")) {
10
+ fs.mkdirSync("./assets/locale")
11
+ }
9
12
  if (!fs.existsSync("./assets/locale/id.json")) {
10
13
  fs.writeFileSync("./assets/locale/id.json", JSON.stringify({}, undefined, 2))
11
14
  }
@@ -13,15 +13,18 @@ export interface LibNet_statusState {
13
13
  zeroHeight: any
14
14
  }
15
15
 
16
- const state = useGlobalState({ isOnline: true })
16
+ const state = useGlobalState({
17
+ isOnline: true,
18
+ isInternetReachable: true
19
+ })
17
20
 
18
21
  class net_status extends LibComponent<LibNet_statusProps, LibNet_statusState> {
19
22
  static state(): useGlobalReturn<any> {
20
23
  return state
21
24
  }
22
25
 
23
- static setOnline(isOnline: boolean): void {
24
- state.set({ isOnline: isOnline })
26
+ static setOnline(isOnline: boolean, isInternetReachable: boolean): void {
27
+ state.set({ isOnline: isOnline, isInternetReachable: isInternetReachable })
25
28
  }
26
29
 
27
30
  timeout
@@ -36,7 +39,7 @@ class net_status extends LibComponent<LibNet_statusProps, LibNet_statusState> {
36
39
  componentDidMount(): void {
37
40
  super.componentDidMount()
38
41
  this.unsubscribe = NetInfo.addEventListener(state => {
39
- this.onChangeConnectivityStatus(state.isConnected, state.isInternetReachable)
42
+ this.onChangeConnectivityStatus(!!state.isConnected, state.isInternetReachable)
40
43
  });
41
44
  }
42
45
 
@@ -46,8 +49,8 @@ class net_status extends LibComponent<LibNet_statusProps, LibNet_statusState> {
46
49
  }
47
50
 
48
51
  onChangeConnectivityStatus(isConnected: boolean, isInternetReachable): void {
49
- let isOnline = (isConnected == true && isInternetReachable == true) ? true : false
50
- net_status.setOnline(isOnline)
52
+ let isOnline = isConnected && isInternetReachable
53
+ net_status.setOnline(isConnected, isInternetReachable)
51
54
  if (isOnline) {
52
55
  this.timeout = setTimeout(() => {
53
56
  this.setState({ zeroHeight: 1 })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.128-e",
3
+ "version": "0.0.128-g",
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",