esoftplay 0.0.114-e → 0.0.114-f

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/router.js CHANGED
@@ -55,6 +55,7 @@ var SuffixHooksProperty = ('Property').trim()
55
55
  var Persistor = {};
56
56
  var Extender = {};
57
57
  var NavsExclude = {};
58
+ var NavsOptions = {};
58
59
  var grabClass = null;
59
60
  var delReducer = true;
60
61
  var countLoop = 0; // jumlah file yang telah dihitung
@@ -127,11 +128,14 @@ checks.forEach(modules => {
127
128
  var isHooks = false
128
129
  var isUseLibs = false
129
130
  /* REGEX HOOKS */
130
- if (n = (/\n?(?:(?:\/\/\s{0,})|(?:\/\*\s{0,}))noPage/).exec(data)) {
131
+ if ((/\n?(?:(?:\/\/\s{0,})|(?:\/\*\s{0,}))noPage/).exec(data)) {
131
132
  NavsExclude[module + '/' + file.slice(0, file.lastIndexOf('.'))] = true
132
133
  } else {
133
134
  NavsExclude[module + '/' + file.slice(0, file.lastIndexOf('.'))] = false
134
135
  }
136
+ if ((/\n?(?:(?:\/\/\s{0,})|(?:\/\*\s{0,}))landscapeOrientation/).exec(data)) {
137
+ NavsOptions[module + '/' + file.slice(0, file.lastIndexOf('.'))] = true
138
+ }
135
139
  if (isIndexed) {
136
140
  if (n = (/\n?(?:(?:\/\/\s{0,})|(?:\/\*\s{0,}))useLibs/).exec(data)) {
137
141
  isUseLibs = true
@@ -646,10 +650,14 @@ function createRouter() {
646
650
  let importer = []
647
651
  let screens = []
648
652
  Navigations.forEach((nav) => {
653
+ const options = NavsOptions[nav]
649
654
  const [module, task] = nav.split('/')
650
655
  const comp = ucword(module) + ucword(task)
651
656
  importer.push(comp)
652
- screens.push("\t\t\t\t<Stack.Screen name={\"" + nav + "\"} component={" + comp + "} />")
657
+ if (options)
658
+ screens.push("\t\t\t\t<Stack.Screen name={\"" + nav + "\"} options={{ orientation: 'landscape' }} component={" + comp + "} />")
659
+ else
660
+ screens.push("\t\t\t\t<Stack.Screen name={\"" + nav + "\"} component={" + comp + "} />")
653
661
  })
654
662
 
655
663
  let N = Nav5(importer.join(", "), screens.join("\n"))
@@ -1,7 +1,7 @@
1
1
  // withHooks
2
2
  // noPage
3
3
 
4
- import { esp, LibDialog, LibImage, LibNet_status, LibProgress, LibStyle, LibToast, LibUpdaterProperty, LibVersion, LibWorker, LibWorkloop, LibWorkview, UseDeeplink, UserClass, UserLoading, UserMain, UserRoutes, useSafeState, _global } from 'esoftplay';
4
+ import { esp, LibDialog, LibImage, LibNet_status, LibProgress, LibStyle, LibToast, LibVersion, LibWorker, LibWorkloop, LibWorkview, UseDeeplink, UserClass, UserLoading, UserMain, UserRoutes, useSafeState, _global } from 'esoftplay';
5
5
  import * as Font from "expo-font";
6
6
  import React, { useEffect, useLayoutEffect } from "react";
7
7
  import { View } from "react-native";
@@ -64,7 +64,7 @@ export default function m(props: UserIndexProps): any {
64
64
  if (ready.current >= 2) {
65
65
  setLoading(false)
66
66
  }
67
- LibUpdaterProperty.check((isNew) => { })
67
+ // LibUpdaterProperty.check((isNew) => { })
68
68
  })
69
69
  if (esp.config('firebase').hasOwnProperty('apiKey')) {
70
70
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.114-e",
3
+ "version": "0.0.114-f",
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",
package/persist.ts CHANGED
@@ -1,17 +1,17 @@
1
- import AsyncStorage from '@react-native-async-storage/async-storage'
2
- import { useEffect, useMemo, useRef, useState } from 'react'
3
- import { fastFilter, fastLoop } from './fast'
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
+ import { useLayoutEffect, useMemo, useRef, useState } from 'react';
3
+ import { fastFilter, fastLoop } from './fast';
4
4
 
5
5
  export default (() => {
6
6
  let obj: any = {}
7
7
  let setter = {}
8
8
  return (key: string, def?: any): any[] => {
9
9
  const r = useRef(true)
10
- const [a, b] = useState(def)
10
+ const [state, setState] = useState(def)
11
11
 
12
12
  useMemo(() => { if (!setter[key]) setter[key] = [] }, [])
13
13
 
14
- function c(value: any) {
14
+ function set(value: any) {
15
15
  if (r.current) {
16
16
  if (value != undefined)
17
17
  AsyncStorage.setItem(key, JSON.stringify(value));
@@ -21,9 +21,10 @@ export default (() => {
21
21
  }
22
22
  }
23
23
 
24
- function e(callback?: (a?: typeof def) => void) {
24
+ function updater(callback?: (a?: typeof def) => void) {
25
25
  if (obj[key]) {
26
26
  clearTimeout(obj[key])
27
+ delete obj[key]
27
28
  }
28
29
  obj[key] = setTimeout(() => {
29
30
  if (r.current)
@@ -32,28 +33,28 @@ export default (() => {
32
33
  if (x) {
33
34
  const xx = JSON.parse(x)
34
35
  if (callback) callback(xx)
35
- c(xx)
36
+ set(xx)
36
37
  } else {
37
38
  if (callback) callback(def)
38
- c(def)
39
+ set(def)
39
40
  }
40
41
  })
41
42
  }, 100);
42
43
  }
43
44
 
44
- function d() {
45
+ function del() {
45
46
  AsyncStorage.removeItem(key)
46
47
  }
47
48
 
48
- useEffect(() => {
49
- setter[key].push(b)
50
- e()
49
+ useLayoutEffect(() => {
50
+ setter[key].push(setState)
51
+ updater()
51
52
  return () => {
52
53
  r.current = false
53
54
  setter[key] = fastFilter(setter[key], (x) => x !== b);
54
55
  }
55
56
  }, [])
56
57
 
57
- return [a, c, e, d]
58
+ return [state, set, updater, del]
58
59
  }
59
60
  })()