esoftplay 0.0.119-u → 0.0.119-x
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 +40 -54
- package/import_migrator.mjs +2 -1
- package/libs/worker.tsx +1 -1
- package/modules/lib/skeleton.tsx +2 -2
- package/modules/user/index.tsx +6 -3
- package/package.json +1 -1
package/esp.ts
CHANGED
|
@@ -48,9 +48,8 @@ try {
|
|
|
48
48
|
} catch (error) {
|
|
49
49
|
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
static mergeDeep(target, ...sources) {
|
|
51
|
+
const esp = {
|
|
52
|
+
mergeDeep(target, ...sources) {
|
|
54
53
|
target = Object(target);
|
|
55
54
|
for (let source of sources) {
|
|
56
55
|
source = Object(source);
|
|
@@ -65,22 +64,17 @@ export default class esp {
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
return target;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
static assets(path: string): any {
|
|
67
|
+
},
|
|
68
|
+
appjson(): any {
|
|
69
|
+
return esp.mergeDeep(app, conf)
|
|
70
|
+
},
|
|
71
|
+
assets(path: string): any {
|
|
76
72
|
return _assets(path)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
static config(param?: string, ...params: string[]): any {
|
|
73
|
+
},
|
|
74
|
+
versionName(): string {
|
|
75
|
+
return (Platform.OS == 'android' ? Constants?.manifest?.android?.versionCode : Constants?.manifest?.ios?.buildNumber) + '-' + esp.config('publish_id')
|
|
76
|
+
},
|
|
77
|
+
config(param?: string, ...params: string[]): any {
|
|
84
78
|
let out: any = esp._config();
|
|
85
79
|
if (param) {
|
|
86
80
|
var _params = [param, ...params]
|
|
@@ -95,16 +89,14 @@ export default class esp {
|
|
|
95
89
|
}
|
|
96
90
|
}
|
|
97
91
|
return out;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
static isDebug(message: string): boolean {
|
|
92
|
+
},
|
|
93
|
+
isDebug(message: string): boolean {
|
|
101
94
|
if (!lconf) {
|
|
102
95
|
return false
|
|
103
96
|
}
|
|
104
97
|
return conf.config.domain != lconf.config.domain
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
static readDeepObj(obj: any) {
|
|
98
|
+
},
|
|
99
|
+
readDeepObj(obj: any) {
|
|
108
100
|
return function (param?: string, ...params: string[]): any {
|
|
109
101
|
let out: any = obj
|
|
110
102
|
if (param) {
|
|
@@ -119,9 +111,8 @@ export default class esp {
|
|
|
119
111
|
}
|
|
120
112
|
return out;
|
|
121
113
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
static lang(moduleTask: string, langName: string, ...stringToBe: string[]): string {
|
|
114
|
+
},
|
|
115
|
+
lang(moduleTask: string, langName: string, ...stringToBe: string[]): string {
|
|
125
116
|
let string = esp.assets("locale/" + esp.langId() + ".json")?.[moduleTask]?.[langName]
|
|
126
117
|
if (!string) {
|
|
127
118
|
string = esp.assets("locale/id.json")[moduleTask][langName]
|
|
@@ -139,28 +130,26 @@ export default class esp {
|
|
|
139
130
|
string = sprintf(string, 0)
|
|
140
131
|
}
|
|
141
132
|
return string
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
static langId(): string {
|
|
133
|
+
},
|
|
134
|
+
langId(): string {
|
|
145
135
|
return LibLocale.state().get()
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
static mod(path: string): any {
|
|
136
|
+
},
|
|
137
|
+
mod(path: string): any {
|
|
149
138
|
var modtast = path.split("/");
|
|
150
139
|
if (modtast[1] == "") {
|
|
151
140
|
modtast[1] = "index";
|
|
152
141
|
}
|
|
153
142
|
return routers(modtast.join("/"));
|
|
154
|
-
}
|
|
155
|
-
|
|
143
|
+
},
|
|
144
|
+
modProp(path: string): any {
|
|
156
145
|
var modtast = path.split("/");
|
|
157
146
|
if (modtast[1] == "") {
|
|
158
147
|
modtast[1] = "index";
|
|
159
148
|
}
|
|
160
149
|
return properties(modtast.join("/"));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
150
|
+
},
|
|
151
|
+
_config(): string {
|
|
152
|
+
let app = esp.appjson()
|
|
164
153
|
var msg = ''
|
|
165
154
|
if (!app.hasOwnProperty('config')) {
|
|
166
155
|
msg = "tidak ada config"
|
|
@@ -169,11 +158,6 @@ export default class esp {
|
|
|
169
158
|
} else if (!app.config.hasOwnProperty('salt') || app.config.salt.length == 0) {
|
|
170
159
|
msg = "config tidak ada salt"
|
|
171
160
|
}
|
|
172
|
-
if (msg != '') {
|
|
173
|
-
let error = new Error(msg);
|
|
174
|
-
throw error;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
161
|
var config = {
|
|
178
162
|
// default config
|
|
179
163
|
timezone: "Asia/Jakarta",
|
|
@@ -202,23 +186,22 @@ export default class esp {
|
|
|
202
186
|
config.webviewOpen = '<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link href="' + config.content + 'user/editor_css" rel="stylesheet" /> <script type="text/javascript">var _ROOT="' + config.uri + '";var _URL="' + config.content + '";function _Bbc(a,b){var c="BS3load_func";if(!window[c+"i"]){window[c+"i"]=0};window[c+"i"]++;if(!b){b=c+"i"+window[c+"i"]};if(!window[c]){window[c]=b}else{window[c]+=","+b}window[b]=a;if(typeof BS3!="undefined"){window[b](BS3)}};</script> <style type="text/css">body {padding: 0 20px;}</style></head> <body>';
|
|
203
187
|
config.webviewClose = '<script src="' + config.content + 'templates/admin/bootstrap/js/bootstrap.min.js"></script> </body> </html>';
|
|
204
188
|
return config;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
static navigations(): string[] {
|
|
189
|
+
},
|
|
190
|
+
navigations(): string[] {
|
|
208
191
|
return navs;
|
|
209
|
-
}
|
|
210
|
-
|
|
192
|
+
},
|
|
193
|
+
home(): any {
|
|
211
194
|
return esp.mod('user/index');
|
|
212
|
-
}
|
|
213
|
-
|
|
195
|
+
},
|
|
196
|
+
routes(): any {
|
|
214
197
|
return UserRoutes.state().get();
|
|
215
|
-
}
|
|
216
|
-
|
|
198
|
+
},
|
|
199
|
+
log(message?: any, ...optionalParams: any[]) {
|
|
217
200
|
if (esp.config("isDebug") == 1) {
|
|
218
201
|
console.log(message, ...optionalParams, "\x1b[0m");
|
|
219
202
|
}
|
|
220
|
-
}
|
|
221
|
-
|
|
203
|
+
},
|
|
204
|
+
logColor: {
|
|
222
205
|
reset: "\x1b[0m",
|
|
223
206
|
black: "\x1b[30m",
|
|
224
207
|
red: "\x1b[31m",
|
|
@@ -238,6 +221,9 @@ export default class esp {
|
|
|
238
221
|
backgroundWhite: "\x1b[47m",
|
|
239
222
|
}
|
|
240
223
|
}
|
|
224
|
+
|
|
225
|
+
export default esp
|
|
226
|
+
|
|
241
227
|
// var a = esp.assets("bacground") // mengambil file dari folder images
|
|
242
228
|
// var b = esp.config("data", "name") // mengambil value dari config (bisa ditentukan di app.json)
|
|
243
229
|
// var c = esp.mod("module/task") // mengeksekusi module/task
|
package/import_migrator.mjs
CHANGED
|
@@ -35,7 +35,8 @@ if (fs.existsSync('./modules')) {
|
|
|
35
35
|
}
|
|
36
36
|
dFile = dFile.replace(cmatch, "\nimport { " + espMod.join(", ") + " } from 'esoftplay';\n" + adder)
|
|
37
37
|
if (matchGlobal)
|
|
38
|
-
dFile = dFile.replace(matchGlobal, "
|
|
38
|
+
dFile = dFile.replace(matchGlobal, "")
|
|
39
|
+
dFile = dFile.replace("\n","\nimport useGlobalState from 'esoftplay/global';\n")
|
|
39
40
|
fs.writeFileSync('./modules/' + module + '/' + task, dFile, { encoding: 'utf8' })
|
|
40
41
|
}
|
|
41
42
|
})
|
package/libs/worker.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { esp } from "esoftplay";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Platform, View } from 'react-native';
|
|
3
4
|
import WebView from "react-native-webview";
|
|
4
5
|
const _global = require('../_global').default
|
|
5
|
-
const esp = require('../esp').default
|
|
6
6
|
|
|
7
7
|
_global.WorkerBase = React.createRef()
|
|
8
8
|
_global.WorkerTasks = new Map()
|
package/modules/lib/skeleton.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// noPage
|
|
2
|
-
import
|
|
2
|
+
import MaskedView from '@react-native-masked-view/masked-view';
|
|
3
|
+
import { } from 'esoftplay';
|
|
3
4
|
import { LibComponent } from 'esoftplay/cache/lib/component.import';
|
|
4
5
|
import { LibStyle } from 'esoftplay/cache/lib/style.import';
|
|
5
|
-
|
|
6
6
|
import { LinearGradient } from 'expo-linear-gradient';
|
|
7
7
|
import React, { useEffect } from 'react';
|
|
8
8
|
import { View } from 'react-native';
|
package/modules/user/index.tsx
CHANGED
|
@@ -15,10 +15,9 @@ import { UserClass } from 'esoftplay/cache/user/class.import';
|
|
|
15
15
|
import { UserHook } from 'esoftplay/cache/user/hook.import';
|
|
16
16
|
import { UserLoading } from 'esoftplay/cache/user/loading.import';
|
|
17
17
|
import { UserRoutes } from 'esoftplay/cache/user/routes.import';
|
|
18
|
-
|
|
19
18
|
import Worker from 'esoftplay/libs/worker';
|
|
20
19
|
import * as Font from "expo-font";
|
|
21
|
-
import React, { useEffect, useLayoutEffect } from
|
|
20
|
+
import React, { useEffect, useLayoutEffect } from 'react';
|
|
22
21
|
import { Platform, View } from "react-native";
|
|
23
22
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
24
23
|
import Navs from '../../cache/navs';
|
|
@@ -45,8 +44,11 @@ function setFonts(): Promise<void> {
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
|
|
47
|
+
|
|
48
48
|
function isWorkerReady(onReady: () => void): void {
|
|
49
|
+
// @ts-ignore
|
|
49
50
|
if (_global.WorkerReady < 1) {
|
|
51
|
+
|
|
50
52
|
setTimeout(() => isWorkerReady(onReady), 10)
|
|
51
53
|
} else {
|
|
52
54
|
onReady()
|
|
@@ -66,6 +68,7 @@ export default function m(props: UserIndexProps): any {
|
|
|
66
68
|
function handler(currentState: any): void {
|
|
67
69
|
//@ts-ignore
|
|
68
70
|
if (__DEV__) {
|
|
71
|
+
//@ts-ignore
|
|
69
72
|
_global.nav__state = currentState
|
|
70
73
|
}
|
|
71
74
|
UserRoutes.set(currentState)
|
|
@@ -85,6 +88,7 @@ export default function m(props: UserIndexProps): any {
|
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
if (limitReady == 3) {
|
|
91
|
+
|
|
88
92
|
isWorkerReady(() => {
|
|
89
93
|
ready.current += 1
|
|
90
94
|
if (ready.current >= limitReady) {
|
|
@@ -153,4 +157,3 @@ export default function m(props: UserIndexProps): any {
|
|
|
153
157
|
</GestureHandlerRootView>
|
|
154
158
|
)
|
|
155
159
|
}
|
|
156
|
-
|