esoftplay 0.0.109-a → 0.0.109-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/bin/build.js +34 -12
- package/bin/router.js +2 -2
- package/esp.ts +5 -8
- package/global.ts +8 -3
- package/modules/lib/curl.ts +82 -30
- package/modules/lib/input_base.tsx +2 -0
- package/modules/lib/list.tsx +1 -1
- package/modules/lib/locale.ts +3 -6
- package/modules/lib/navigation.ts +13 -0
- package/modules/lib/progress.tsx +1 -0
- package/modules/lib/utils.ts +2 -0
- package/moment.ts +1 -1
- package/package.json +1 -1
- package/state.ts +2 -2
package/bin/build.js
CHANGED
|
@@ -255,14 +255,36 @@ yarn.lock\n\
|
|
|
255
255
|
console.log('.gitignore has been created');
|
|
256
256
|
});
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
import * as ErrorReport from 'esoftplay/error';
|
|
258
|
+
// const AppJS = `import { esp, LibNotification } from 'esoftplay';
|
|
259
|
+
// import * as ErrorReport from 'esoftplay/error';
|
|
260
|
+
// import * as Notifications from 'expo-notifications';
|
|
261
|
+
// import React, { useEffect, useRef } from 'react';
|
|
262
|
+
// import { enableFreeze, enableScreens } from 'react-native-screens';
|
|
263
|
+
// const { globalIdx } = require('esoftplay/global')
|
|
264
|
+
// enableScreens();
|
|
265
|
+
// enableFreeze(true);
|
|
266
|
+
|
|
267
|
+
// Notifications.addNotificationResponseReceivedListener(x => LibNotification.onAction(x))
|
|
268
|
+
|
|
269
|
+
// export default function App() {
|
|
270
|
+
// const Home = useRef(esp.home()).current
|
|
271
|
+
|
|
272
|
+
// useEffect(() => {
|
|
273
|
+
// globalIdx.reset()
|
|
274
|
+
// ErrorReport.getError()
|
|
275
|
+
// }, [])
|
|
276
|
+
|
|
277
|
+
// return <Home />
|
|
278
|
+
// }`;
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
const AppJS = `import React, { useEffect, useRef } from 'react';
|
|
282
|
+
import { esp, LibNotification } from 'esoftplay';
|
|
283
|
+
import * as ErrorReport from 'esoftplay/error'
|
|
260
284
|
import * as Notifications from 'expo-notifications';
|
|
261
|
-
import
|
|
262
|
-
import { enableFreeze, enableScreens } from 'react-native-screens';
|
|
285
|
+
import { enableScreens } from 'react-native-screens';
|
|
263
286
|
const { globalIdx } = require('esoftplay/global')
|
|
264
287
|
enableScreens();
|
|
265
|
-
enableFreeze(true);
|
|
266
288
|
|
|
267
289
|
Notifications.addNotificationResponseReceivedListener(x => LibNotification.onAction(x))
|
|
268
290
|
|
|
@@ -361,13 +383,13 @@ export default function App() {
|
|
|
361
383
|
cmd += "&& node ./node_modules/esoftplay/bin/router.js"
|
|
362
384
|
execSync(cmd, { stdio: ['inherit', 'inherit', 'inherit'] })
|
|
363
385
|
console.log('App.js has been replace to App.tsx');
|
|
364
|
-
/* bugfix AsyncStorage @firebase, remove this section if firebase has update the AsyncStorage */
|
|
365
|
-
if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
/* end AsyncStorage @firebase section */
|
|
386
|
+
// /* bugfix AsyncStorage @firebase, remove this section if firebase has update the AsyncStorage */
|
|
387
|
+
// if (fs.existsSync('../@firebase/app/dist/index.rn.cjs.js')) {
|
|
388
|
+
// let firebaseText = fs.readFileSync('../@firebase/app/dist/index.rn.cjs.js', 'utf8')
|
|
389
|
+
// firebaseText = firebaseText.replace("var AsyncStorage = require('react-native').AsyncStorage;", "var AsyncStorage = require('@react-native-async-storage/async-storage').default;")
|
|
390
|
+
// fs.writeFileSync('../@firebase/app/dist/index.rn.cjs.js', firebaseText)
|
|
391
|
+
// }
|
|
392
|
+
// /* end AsyncStorage @firebase section */
|
|
371
393
|
if (fs.existsSync('../@expo/vector-icons')) {
|
|
372
394
|
let esoftplayIcon = ''
|
|
373
395
|
fs.readdir('../@expo/vector-icons/build', (err, files) => {
|
package/bin/router.js
CHANGED
|
@@ -247,7 +247,7 @@ checks.forEach(modules => {
|
|
|
247
247
|
}
|
|
248
248
|
/* REGEX All Functions */
|
|
249
249
|
if (!isHooks && !isUseLibs) {
|
|
250
|
-
var r = /\n(\s+)((?:(?:static|public|private|async)\s+)?[a-zA-Z0-9_]{3,}\s{0,}(?:<S>|)(?:=\s{0,})?\([^{\n]+)/g; // 1=spaces 2=FunctionObject
|
|
250
|
+
var r = /\n(\s+)((?:(?:static|public|private|protected|public async|private async|protected async|async)\s+)?[a-zA-Z0-9_]{3,}\s{0,}(?:<S>|)(?:=\s{0,})?\([^{\n]+)/g; // 1=spaces 2=FunctionObject
|
|
251
251
|
if (s = r.exec(data)) {
|
|
252
252
|
if (m = data.match(r)) {
|
|
253
253
|
/* check jika class tersebut nge replace bukan nge extends maka hapus semua fungsi bawaan dari supernya */
|
|
@@ -257,7 +257,7 @@ checks.forEach(modules => {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
for (var i = 0; i < m.length; i++) {
|
|
260
|
-
if (S = m[i].match(/\n([^\na-zA-Z0-9_]+)((?:(?:static|public|private|async)\s+)?[a-zA-Z0-9_]{3,})/)) {
|
|
260
|
+
if (S = m[i].match(/\n([^\na-zA-Z0-9_]+)((?:(?:static|public|private|protected|public async|private async|protected async|async)\s+)?[a-zA-Z0-9_]{3,})/)) {
|
|
261
261
|
if (S[1] === s[1].replace(new RegExp('\n', 'g'), '')) {
|
|
262
262
|
var a = m[i].trim().replace('async ', '') + ";"
|
|
263
263
|
tmpTask[clsName]["function"][S[2]] = a;
|
package/esp.ts
CHANGED
|
@@ -76,11 +76,9 @@ export default (() => {
|
|
|
76
76
|
var _params = [param, ...params]
|
|
77
77
|
if (_params.length > 0)
|
|
78
78
|
for (let i = 0; i < _params.length; i++) {
|
|
79
|
-
|
|
80
|
-
if (out
|
|
81
|
-
|
|
82
|
-
} else {
|
|
83
|
-
out = undefined;
|
|
79
|
+
out = out?.[_params[i]];
|
|
80
|
+
if (out == undefined){
|
|
81
|
+
break;
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
}
|
|
@@ -109,10 +107,9 @@ export default (() => {
|
|
|
109
107
|
}
|
|
110
108
|
|
|
111
109
|
function langId(): string {
|
|
112
|
-
|
|
113
|
-
return _store.lang_id
|
|
110
|
+
return LibLocale.state().get()
|
|
114
111
|
}
|
|
115
|
-
|
|
112
|
+
|
|
116
113
|
function mod(path: string): any {
|
|
117
114
|
var modtast = path.split("/");
|
|
118
115
|
if (modtast[1] == "") {
|
package/global.ts
CHANGED
|
@@ -48,7 +48,10 @@ const n = () => {
|
|
|
48
48
|
|
|
49
49
|
// rehidryte instant
|
|
50
50
|
if (o?.persistKey) {
|
|
51
|
-
rehidryte(o.persistKey, (p) => {
|
|
51
|
+
rehidryte(o.persistKey, (p) => {
|
|
52
|
+
if (typeof p == 'string') set(JSON.parse(p))
|
|
53
|
+
|
|
54
|
+
})
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/* register to userData to automatically reset state and persist */
|
|
@@ -150,9 +153,11 @@ const n = () => {
|
|
|
150
153
|
debounce(() => {
|
|
151
154
|
AsyncStorage.multiGet(Object.keys(persistKeys), (e, v) => {
|
|
152
155
|
if (v && !e) {
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
v.forEach((iv, i) => {
|
|
157
|
+
persistKeys[iv[0]]?.(iv[1])
|
|
155
158
|
})
|
|
159
|
+
} else {
|
|
160
|
+
|
|
156
161
|
}
|
|
157
162
|
})
|
|
158
163
|
}, 30)
|
package/modules/lib/curl.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { reportApiError } from "esoftplay/error";
|
|
|
4
4
|
import moment from "esoftplay/moment";
|
|
5
5
|
const axios = require('axios');
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
export default class ecurl {
|
|
9
8
|
timeout = 55000;
|
|
10
9
|
timeoutContext: any = null;
|
|
@@ -14,6 +13,7 @@ export default class ecurl {
|
|
|
14
13
|
url: any = esp.config('url')
|
|
15
14
|
apiKey: any = 0
|
|
16
15
|
uri: any = '';
|
|
16
|
+
isSecure: boolean = false
|
|
17
17
|
fetchConf: any = ''
|
|
18
18
|
alertTimeout = {
|
|
19
19
|
title: "Oops..! Gagal menyambung ke server",
|
|
@@ -39,17 +39,19 @@ export default class ecurl {
|
|
|
39
39
|
this.onError = this.onError.bind(this)
|
|
40
40
|
this.setApiKey = this.setApiKey.bind(this)
|
|
41
41
|
this.secure = this.secure.bind(this)
|
|
42
|
+
this.withHeader = this.withHeader.bind(this)
|
|
42
43
|
this.initTimeout = this.initTimeout.bind(this)
|
|
43
44
|
this.cancelTimeout = this.cancelTimeout.bind(this)
|
|
45
|
+
// this.createApiTesterUris = this.createApiTesterUris.bind(this)
|
|
44
46
|
const str: any = LibNet_status.state().get()
|
|
45
47
|
if (uri && str.isOnline) {
|
|
46
48
|
this.init(uri, post, onDone, onFailed, debug);
|
|
47
49
|
} else if (!str.isOnline && onFailed) {
|
|
48
|
-
onFailed("Failed to access", false);
|
|
50
|
+
onFailed(this.refineErrorMessage("Failed to access"), false);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
initTimeout(customTimeout?: number): void {
|
|
54
|
+
protected initTimeout(customTimeout?: number): void {
|
|
53
55
|
this.cancelTimeout()
|
|
54
56
|
this.timeoutContext = setTimeout(() => {
|
|
55
57
|
if (this.abort?.cancel) {
|
|
@@ -60,28 +62,57 @@ export default class ecurl {
|
|
|
60
62
|
}, customTimeout ?? this.timeout);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
cancelTimeout(): void {
|
|
65
|
+
private cancelTimeout(): void {
|
|
64
66
|
clearTimeout(this.timeoutContext)
|
|
65
67
|
this.timeoutContext = null;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
onFetchFailed(message: string): void {
|
|
70
|
+
private onFetchFailed(message: string): void {
|
|
69
71
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
setUrl(url: string): void {
|
|
74
|
+
protected setUrl(url: string): void {
|
|
73
75
|
this.url = url
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
setUri(uri: string): void {
|
|
78
|
+
protected setUri(uri: string): void {
|
|
77
79
|
this.uri = uri
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
// createApiTesterUris(): void {
|
|
83
|
+
|
|
84
|
+
// if (esp.isDebug('onlyAvailableOnDebug')) {
|
|
85
|
+
// setTimeout(() => {
|
|
86
|
+
// const options = this.fetchConf.options
|
|
87
|
+
// const msg = this.uri.replace('/', '.').split('?')[0] + `
|
|
88
|
+
// /* RARE USAGE : to simulate LibCurl().secure() : default false */
|
|
89
|
+
// const IS_SECURE_POST = `+ this.isSecure + `
|
|
90
|
+
|
|
91
|
+
// const EXTRACT = []
|
|
92
|
+
// const EXTRACT_CHECK = []
|
|
93
|
+
|
|
94
|
+
// const GET = {`+ JSON.stringify(LibUtils.getUrlParams(options?.url) || '') + `
|
|
95
|
+
// }
|
|
96
|
+
|
|
97
|
+
// const POST = {`+ options._post + `
|
|
98
|
+
// }
|
|
99
|
+
// module.exports = { POST, GET, IS_SECURE_POST, EXTRACT, EXTRACT_CHECK }
|
|
100
|
+
// `
|
|
101
|
+
// let post = {
|
|
102
|
+
// text: msg,
|
|
103
|
+
// chat_id: '-626800023',
|
|
104
|
+
// disable_web_page_preview: true
|
|
105
|
+
// }
|
|
106
|
+
// this.custom('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
|
|
107
|
+
// }, 1000);
|
|
108
|
+
// }
|
|
109
|
+
// }
|
|
110
|
+
|
|
111
|
+
protected setApiKey(apiKey: string): void {
|
|
81
112
|
this.apiKey = apiKey
|
|
82
113
|
}
|
|
83
114
|
|
|
84
|
-
async setHeader(): Promise<void> {
|
|
115
|
+
protected async setHeader(): Promise<void> {
|
|
85
116
|
return new Promise((r) => {
|
|
86
117
|
if ((/:\/\/data.*?\/(.*)/g).test(this.url)) {
|
|
87
118
|
this.header["masterkey"] = new LibCrypt().encode(this.url)
|
|
@@ -90,25 +121,26 @@ export default class ecurl {
|
|
|
90
121
|
});
|
|
91
122
|
}
|
|
92
123
|
|
|
93
|
-
closeConnection(): void {
|
|
124
|
+
protected closeConnection(): void {
|
|
94
125
|
this?.abort?.cancel('Oops, Sepertinya ada gangguan jaringan... Silahkan coba beberapa saat lagi');
|
|
95
126
|
}
|
|
96
127
|
|
|
97
|
-
onDone(result: any, msg?: string): void {
|
|
128
|
+
protected onDone(result: any, msg?: string): void {
|
|
98
129
|
|
|
99
130
|
}
|
|
100
131
|
|
|
101
|
-
onFailed(msg: string, timeout: boolean): void {
|
|
132
|
+
protected onFailed(msg: string, timeout: boolean): void {
|
|
102
133
|
|
|
103
134
|
}
|
|
104
135
|
|
|
105
|
-
onStatusCode(ok: number, status_code: number, message: string, result: any): boolean {
|
|
136
|
+
protected onStatusCode(ok: number, status_code: number, message: string, result: any): boolean {
|
|
106
137
|
return true
|
|
107
138
|
}
|
|
108
139
|
|
|
109
|
-
secure(token_uri?: string): (apiKey?: string) => (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) => void {
|
|
140
|
+
public secure(token_uri?: string): (apiKey?: string) => (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) => void {
|
|
110
141
|
return (apiKey?: string): (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) => void => {
|
|
111
142
|
return async (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) => {
|
|
143
|
+
this.isSecure = true
|
|
112
144
|
await this.setHeader();
|
|
113
145
|
const _apiKey = apiKey || this.apiKey
|
|
114
146
|
Object.keys(post).forEach((key) => {
|
|
@@ -146,7 +178,7 @@ export default class ecurl {
|
|
|
146
178
|
this.init(uri, { ...post, access_token: res }, onDone, onFailed, debug);
|
|
147
179
|
}, (msg) => {
|
|
148
180
|
if (onFailed)
|
|
149
|
-
onFailed(msg, false)
|
|
181
|
+
onFailed(this.refineErrorMessage(msg), false)
|
|
150
182
|
}, debug)
|
|
151
183
|
}).catch((r: string) => {
|
|
152
184
|
this.cancelTimeout();
|
|
@@ -157,7 +189,12 @@ export default class ecurl {
|
|
|
157
189
|
}
|
|
158
190
|
}
|
|
159
191
|
|
|
160
|
-
|
|
192
|
+
public withHeader(header: any): (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) => void {
|
|
193
|
+
this.header = { ...this.header, ...header }
|
|
194
|
+
return (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) => this.init(uri, post, onDone, onFailed, debug)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public upload(uri: string, postKey: string, fileUri: string, mimeType: string, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number): void {
|
|
161
198
|
postKey = postKey || "image";
|
|
162
199
|
var uName = fileUri.substring(fileUri.lastIndexOf("/") + 1, fileUri.length);
|
|
163
200
|
if (!uName.includes('.')) {
|
|
@@ -168,7 +205,7 @@ export default class ecurl {
|
|
|
168
205
|
this.init(uri, post, onDone, onFailed, debug, true)
|
|
169
206
|
}
|
|
170
207
|
|
|
171
|
-
urlEncode(str: string): string {
|
|
208
|
+
private urlEncode(str: string): string {
|
|
172
209
|
return str
|
|
173
210
|
.replace(/\!/g, '%21')
|
|
174
211
|
.replace(/\'/g, '%27')
|
|
@@ -178,7 +215,7 @@ export default class ecurl {
|
|
|
178
215
|
.replace(/%20/g, '+')
|
|
179
216
|
}
|
|
180
217
|
|
|
181
|
-
encodeGetValue(_get: string): string {
|
|
218
|
+
private encodeGetValue(_get: string): string {
|
|
182
219
|
if (_get != '') {
|
|
183
220
|
let hashes = _get.split('&')
|
|
184
221
|
let params: any = {}
|
|
@@ -200,7 +237,7 @@ export default class ecurl {
|
|
|
200
237
|
return _get
|
|
201
238
|
}
|
|
202
239
|
|
|
203
|
-
signatureBuild(): string {
|
|
240
|
+
private signatureBuild(): string {
|
|
204
241
|
let signature = '';
|
|
205
242
|
if (this.url.includes(esp.config('url'))) {
|
|
206
243
|
let payload = '';
|
|
@@ -224,7 +261,7 @@ export default class ecurl {
|
|
|
224
261
|
return signature
|
|
225
262
|
}
|
|
226
263
|
|
|
227
|
-
async custom(uri: string, post?: any, onDone?: (res: any, timeout: boolean) => void, debug?: number): Promise<void> {
|
|
264
|
+
public async custom(uri: string, post?: any, onDone?: (res: any, timeout: boolean) => void, debug?: number): Promise<void> {
|
|
228
265
|
const str: any = LibNet_status.state().get()
|
|
229
266
|
if (str.isOnline) {
|
|
230
267
|
if (post) {
|
|
@@ -256,8 +293,9 @@ export default class ecurl {
|
|
|
256
293
|
mode: "cors",
|
|
257
294
|
_post: post
|
|
258
295
|
}
|
|
259
|
-
if (debug == 1)
|
|
260
|
-
esp.log(this.url + this.uri, options)
|
|
296
|
+
if (debug == 1) {
|
|
297
|
+
esp.log(this.url + this.uri, { ...options, cancelToken: undefined })
|
|
298
|
+
}
|
|
261
299
|
this.fetchConf = { url: this.url + this.uri, options: options }
|
|
262
300
|
// this.initTimeout()
|
|
263
301
|
axios(options).then(async (res: any) => {
|
|
@@ -276,7 +314,7 @@ export default class ecurl {
|
|
|
276
314
|
}
|
|
277
315
|
}
|
|
278
316
|
|
|
279
|
-
async init(uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number, upload?: boolean): Promise<void> {
|
|
317
|
+
private async init(uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number, upload?: boolean): Promise<void> {
|
|
280
318
|
if (post) {
|
|
281
319
|
if (upload) {
|
|
282
320
|
let fd = new FormData();
|
|
@@ -316,7 +354,9 @@ export default class ecurl {
|
|
|
316
354
|
mode: "cors",
|
|
317
355
|
_post: post
|
|
318
356
|
}
|
|
319
|
-
if (debug == 1)
|
|
357
|
+
if (debug == 1) {
|
|
358
|
+
esp.log(this.url + this.uri, { ...options, cancelToken: undefined })
|
|
359
|
+
}
|
|
320
360
|
this.fetchConf = { url: this.url + this.uri, options: options }
|
|
321
361
|
this.initTimeout(upload ? 120000 : undefined)
|
|
322
362
|
axios(options).then(async (res: any) => {
|
|
@@ -328,7 +368,7 @@ export default class ecurl {
|
|
|
328
368
|
})
|
|
329
369
|
}
|
|
330
370
|
|
|
331
|
-
onFetched(resText: string | Object, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number): void {
|
|
371
|
+
protected onFetched(resText: string | Object, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number): void {
|
|
332
372
|
var resJson = typeof resText == 'string' && ((resText.startsWith("{") && resText.endsWith("}")) || (resText.startsWith("[") && resText.endsWith("]"))) ? JSON.parse(resText) : resText
|
|
333
373
|
if (typeof resJson == "object") {
|
|
334
374
|
if (!resJson.status_code || this.onStatusCode(resJson.ok, resJson.status_code, resJson.message, resJson.result)) {
|
|
@@ -336,8 +376,8 @@ export default class ecurl {
|
|
|
336
376
|
if (onDone) onDone(resJson.result, resJson.message)
|
|
337
377
|
this.onDone(resJson.result, resJson.message)
|
|
338
378
|
} else {
|
|
339
|
-
if (onFailed) onFailed(resJson.message, false)
|
|
340
|
-
this.onFailed(resJson.message, false)
|
|
379
|
+
if (onFailed) onFailed(this.refineErrorMessage(resJson.message), false)
|
|
380
|
+
this.onFailed(this.refineErrorMessage(resJson.message), false)
|
|
341
381
|
}
|
|
342
382
|
}
|
|
343
383
|
} else {
|
|
@@ -348,17 +388,29 @@ export default class ecurl {
|
|
|
348
388
|
}
|
|
349
389
|
}
|
|
350
390
|
|
|
351
|
-
|
|
391
|
+
private refineErrorMessage(resText: string): string {
|
|
392
|
+
let out = resText
|
|
393
|
+
if (!esp.isDebug('')) {
|
|
394
|
+
if (resText.toLowerCase().includes('failed') || resText.toLowerCase().includes('code')) {
|
|
395
|
+
reportApiError(this.fetchConf.options, resText)
|
|
396
|
+
out = 'Terjadi kesalahan, biar ' + esp.appjson()?.expo?.name + ' bereskan, silahkan coba beberapa saat lagi.'
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return out
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
private onError(msg: string): void {
|
|
352
403
|
esp.log("\x1b[31m", msg)
|
|
353
404
|
esp.log("\x1b[0m")
|
|
354
405
|
if (esp.isDebug('') && msg == '') {
|
|
355
406
|
return
|
|
356
407
|
}
|
|
357
|
-
|
|
408
|
+
delete this.fetchConf.options.cancelToken
|
|
409
|
+
reportApiError(this.fetchConf.options, msg)
|
|
358
410
|
LibProgress.hide()
|
|
359
411
|
}
|
|
360
412
|
|
|
361
|
-
getTimeByTimeZone(timeZone: string): number {
|
|
413
|
+
protected getTimeByTimeZone(timeZone: string): number {
|
|
362
414
|
return moment(new Date()).tz(timeZone).toMiliseconds();
|
|
363
415
|
}
|
|
364
416
|
}
|
|
@@ -102,6 +102,7 @@ function unmask(name: string, text: string): string {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
export default function m(props: LibInput_baseProps): any {
|
|
105
|
+
|
|
105
106
|
LibInput_base_dataProperty.inputBaseRef[props.name] = useRef<TextInput>(null);
|
|
106
107
|
LibInput_base_dataProperty.inputBaseData[props.name] = {
|
|
107
108
|
mask: props.mask,
|
|
@@ -109,6 +110,7 @@ export default function m(props: LibInput_baseProps): any {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
useEffect(() => {
|
|
113
|
+
console.warn('LibInput_base is deprecated, use LibInput with props `base={true}` instead')
|
|
112
114
|
LibInput_base_dataProperty.inputBaseRef[props.name].current!.blur()
|
|
113
115
|
if (props.defaultValue) {
|
|
114
116
|
setTimeout(() => {
|
package/modules/lib/list.tsx
CHANGED
|
@@ -73,7 +73,7 @@ export default class EList extends LibComponent<LibListProps, LibListState> {
|
|
|
73
73
|
render(): any {
|
|
74
74
|
const isStatic = () => {
|
|
75
75
|
if (this.props.staticHeight)
|
|
76
|
-
return { getItemLayout: (data, index) => this.props.staticHeight ? ({ length: this.props.staticHeight, offset: this.props.staticHeight, index: index }) : undefined }
|
|
76
|
+
return ({ getItemLayout: (data, index) => this.props.staticHeight ? ({ length: this.props.staticHeight, offset: this.props.staticHeight, index: index }) : undefined })
|
|
77
77
|
}
|
|
78
78
|
return (
|
|
79
79
|
<View ref={(e) => this.view = e} style={[{ flex: 1 }]} >
|
package/modules/lib/locale.ts
CHANGED
|
@@ -3,19 +3,16 @@
|
|
|
3
3
|
import { LibNavigation, useGlobalReturn, useGlobalState } from 'esoftplay';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
lang_id: "id"
|
|
8
|
-
}
|
|
9
|
-
const state = useGlobalState(initState, { persistKey: 'lib_locale' })
|
|
6
|
+
const state = useGlobalState("id", { persistKey: 'lib_locale_lang' })
|
|
10
7
|
|
|
11
|
-
export default class
|
|
8
|
+
export default class m {
|
|
12
9
|
|
|
13
10
|
static state(): useGlobalReturn<any> {
|
|
14
11
|
return state
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
static setLanguage(langId: string): void {
|
|
18
|
-
state.set({ lang_id: langId })
|
|
19
15
|
LibNavigation.reset()
|
|
16
|
+
state.set(langId)
|
|
20
17
|
}
|
|
21
18
|
}
|
|
@@ -22,6 +22,19 @@ export default (() => {
|
|
|
22
22
|
libNavigationData._navigation = nav
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
static getArgs(props: any, key: string, defOutput?: any): any {
|
|
26
|
+
if (defOutput == undefined) {
|
|
27
|
+
defOutput = "";
|
|
28
|
+
}
|
|
29
|
+
return props?.route?.params?.[key] || defOutput;
|
|
30
|
+
}
|
|
31
|
+
static getArgsAll<S>(props: any, defOutput?: any): S {
|
|
32
|
+
if (defOutput == undefined) {
|
|
33
|
+
defOutput = "";
|
|
34
|
+
}
|
|
35
|
+
return props?.route?.params || defOutput;
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
static navigation(): any {
|
|
26
39
|
return libNavigationData?._navigation
|
|
27
40
|
}
|
package/modules/lib/progress.tsx
CHANGED
package/modules/lib/utils.ts
CHANGED
|
@@ -60,12 +60,14 @@ export default class eutils {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
static getArgs(props: any, key: string, defOutput?: any): any {
|
|
63
|
+
console.warn('LibUtils.getArgs is deprecated, use LibNavigation.getArgs instead')
|
|
63
64
|
if (defOutput == undefined) {
|
|
64
65
|
defOutput = "";
|
|
65
66
|
}
|
|
66
67
|
return props?.route?.params?.[key] || defOutput;
|
|
67
68
|
}
|
|
68
69
|
static getArgsAll<S>(props: any, defOutput?: any): S {
|
|
70
|
+
console.warn('LibUtils.getArgsAll is deprecated, use LibNavigation.getArgsAll instead')
|
|
69
71
|
if (defOutput == undefined) {
|
|
70
72
|
defOutput = "";
|
|
71
73
|
}
|
package/moment.ts
CHANGED
|
@@ -35,7 +35,7 @@ export default function moment(date?: string | Date | any) {
|
|
|
35
35
|
locale: (locale_id: "af" | "am" | "ar-dz" | "ar-kw" | "ar-ly" | "ar-ma" | "ar-sa" | "ar-tn" | "ar" | "az" | "be" | "bg" | "bi" | "bm" | "bn" | "bo" | "br" | "bs" | "ca" | "cs" | "cv" | "cy" | "da" | "de-at" | "de-ch" | "de" | "dv" | "el" | "en-au" | "en-ca" | "en-gb" | "en-ie" | "en-il" | "en-in" | "en-nz" | "en-sg" | "en-tt" | "en" | "eo" | "es-do" | "es-pr" | "es-us" | "es" | "fi" | "fo" | "fr-ca" | "fr-ch" | "fr" | "fy" | "ga" | "gd" | "gl" | "gom-latn" | "gu" | "he" | "hi" | "hr" | "ht" | "hu" | "hy-am" | "id" | "is" | "it-ch" | "it" | "ja" | "jv" | "ka" | "kk" | "km" | "kn" | "ko" | "ku" | "ky" | "lb" | "lo" | "lt" | "lv" | "me" | "mi" | "mk" | "ml" | "mn" | "mr" | "ms-my" | "ms" | "mt" | "my" | "nb" | "ne" | "nl-be" | "nl" | "nn" | "oc-lnc" | "pa-in" | "pl" | "pt-br" | "pt" | "ro" | "ru" | "rw" | "sd" | "se" | "si" | "sk" | "sl" | "sq" | "sr-cyrl" | "sr" | "ss" | "sv-fi" | "sv" | "sw" | "ta" | "te" | "tet" | "tg" | "th" | "tk" | "tl-ph" | "tlh" | "tr" | "tzl" | "tzm-latn" | "tzm" | "ug-cn" | "uk" | "ur" | "uz-latn" | "uz" | "vi" | "x-pseudo" | "yo" | "zh-cn" | "zh-hk" | "zh-tw" | "zh" | "et" | "eu" | "fa") => {
|
|
36
36
|
require('dayjs/locale/en')
|
|
37
37
|
require('dayjs/locale/id')
|
|
38
|
-
const out = dayjs.locale(
|
|
38
|
+
const out = dayjs.locale('id')
|
|
39
39
|
return moment(out)
|
|
40
40
|
},
|
|
41
41
|
/* last chain */
|
package/package.json
CHANGED
package/state.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react'
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
export default function m(def?: any) {
|
|
4
4
|
const r = useRef<boolean>(true)
|
|
@@ -9,7 +9,7 @@ export default function m(def?: any) {
|
|
|
9
9
|
b(value)
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
r.current = true
|
|
15
15
|
return () => { r.current = false }
|