esoftplay 0.0.118 → 0.0.119
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/_cache.ts +14 -12
- package/bin/build.js +16 -7
- package/bin/cli.js +31 -7
- package/bin/router.js +19 -6
- package/error.ts +10 -10
- package/global.ts +11 -27
- package/modules/lib/component.ts +1 -1
- package/modules/lib/curl.ts +1 -1
- package/modules/lib/icon.tsx +21 -21
- package/modules/lib/list.tsx +1 -1
- package/modules/lib/notify.ts +46 -0
- package/modules/lib/scroll.tsx +1 -1
- package/modules/lib/scrollpicker.tsx +4 -4
- package/modules/lib/skeleton.tsx +1 -1
- package/modules/lib/sociallogin.tsx +1 -1
- package/modules/lib/style.ts +1 -1
- package/modules/lib/textstyle.tsx +1 -1
- package/modules/lib/utils.ts +1 -1
- package/modules/user/class.ts +2 -2
- package/modules/user/index.tsx +1 -1
- package/modules/user/login.tsx +3 -3
- package/modules/user/notifbadge.tsx +1 -1
- package/package.json +1 -1
- package/storage.ts +1 -1
package/_cache.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
+
import Storage from 'esoftplay/storage';
|
|
2
3
|
import * as R from 'react';
|
|
3
4
|
import { fastFilter, fastLoop } from './fast';
|
|
4
5
|
const isEqual = require('react-fast-compare');
|
|
@@ -11,21 +12,22 @@ export interface UseCache_return<T> {
|
|
|
11
12
|
|
|
12
13
|
export interface UseCache_options {
|
|
13
14
|
persistKey?: string,
|
|
15
|
+
inFile?: boolean,
|
|
14
16
|
listener?: (data: any) => void
|
|
15
17
|
}
|
|
16
18
|
export default (() => {
|
|
17
19
|
let useCacheIdx = 0
|
|
18
|
-
let useCacheSubscriber = []
|
|
19
|
-
let value = []
|
|
20
|
+
let useCacheSubscriber: any[] = []
|
|
20
21
|
return <T>(initValue: T, o?: UseCache_options): UseCache_return<T> => {
|
|
22
|
+
const STORAGE = o?.inFile ? new Storage() : AsyncStorage
|
|
21
23
|
const _idx = useCacheIdx
|
|
22
24
|
if (!useCacheSubscriber[_idx]) {
|
|
23
25
|
useCacheSubscriber[_idx] = [];
|
|
24
26
|
}
|
|
25
|
-
value
|
|
27
|
+
let value = initValue
|
|
26
28
|
// rehidryte instant
|
|
27
29
|
if (o?.persistKey) {
|
|
28
|
-
|
|
30
|
+
STORAGE.getItem(o.persistKey).then((p) => {
|
|
29
31
|
if (p)
|
|
30
32
|
set(JSON.parse(p))
|
|
31
33
|
})
|
|
@@ -33,24 +35,24 @@ export default (() => {
|
|
|
33
35
|
|
|
34
36
|
function set(ns: T | ((x: T) => T)) {
|
|
35
37
|
let isChange = false
|
|
36
|
-
if (!isEqual(value
|
|
38
|
+
if (!isEqual(value, ns)) {
|
|
37
39
|
isChange = true
|
|
38
40
|
}
|
|
39
41
|
if (isChange) {
|
|
40
|
-
value
|
|
41
|
-
fastLoop(useCacheSubscriber[_idx], (c: any) => c?.(value
|
|
42
|
+
value = ns instanceof Function ? ns(value) : ns
|
|
43
|
+
fastLoop(useCacheSubscriber[_idx], (c: any) => c?.(value))
|
|
42
44
|
if (o?.persistKey) {
|
|
43
|
-
|
|
45
|
+
STORAGE.setItem(o.persistKey, JSON.stringify(value))
|
|
44
46
|
}
|
|
45
47
|
if (o?.listener) {
|
|
46
|
-
o?.listener?.(ns instanceof Function ? ns(value
|
|
48
|
+
o?.listener?.(ns instanceof Function ? ns(value) : ns)
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
function del() {
|
|
52
54
|
if (o?.persistKey) {
|
|
53
|
-
|
|
55
|
+
STORAGE.removeItem(o.persistKey)
|
|
54
56
|
}
|
|
55
57
|
set(initValue)
|
|
56
58
|
}
|
|
@@ -67,7 +69,7 @@ export default (() => {
|
|
|
67
69
|
|
|
68
70
|
|
|
69
71
|
function useCache(): [T, (newCache: T | ((oldCache: T) => T)) => void, () => void] {
|
|
70
|
-
let l = R.useRef<T>(value
|
|
72
|
+
let l = R.useRef<T>(value).current;
|
|
71
73
|
|
|
72
74
|
const sl = (ns: T | ((oldCache: T) => T)) => {
|
|
73
75
|
l = ns instanceof Function ? ns(l) : ns
|
|
@@ -78,6 +80,6 @@ export default (() => {
|
|
|
78
80
|
return [l, set, del];
|
|
79
81
|
};
|
|
80
82
|
useCacheIdx++
|
|
81
|
-
return { useCache, get: () => value
|
|
83
|
+
return { useCache, get: () => value, set: set };
|
|
82
84
|
}
|
|
83
85
|
})()
|
package/bin/build.js
CHANGED
|
@@ -24,7 +24,10 @@ const pathLowercasePrompt = DIR + 'node_modules/@react-navigation/core/src/useNa
|
|
|
24
24
|
|
|
25
25
|
if (fs.existsSync(packjson)) {
|
|
26
26
|
let txt = fs.readFileSync(packjson, 'utf8');
|
|
27
|
-
let $package
|
|
27
|
+
let $package
|
|
28
|
+
try {
|
|
29
|
+
$package = JSON.parse(txt)
|
|
30
|
+
} catch (error) { }
|
|
28
31
|
let args = process.argv.slice(2);
|
|
29
32
|
|
|
30
33
|
/* ADD SCRIPTS.PRESTART AND SCRIPTS.POSTSTOP */
|
|
@@ -41,7 +44,9 @@ if (fs.existsSync(packjson)) {
|
|
|
41
44
|
if (args[0] == "install") {
|
|
42
45
|
let $config = {}
|
|
43
46
|
if (fs.existsSync(confjson))
|
|
44
|
-
|
|
47
|
+
try {
|
|
48
|
+
$config = JSON.parse(fs.readFileSync(confjson, 'utf8')) || {};
|
|
49
|
+
} catch (error) { }
|
|
45
50
|
if (!$config.hasOwnProperty('config')) {
|
|
46
51
|
$config.config = {
|
|
47
52
|
"domain": "domain.com",
|
|
@@ -63,14 +68,18 @@ if (fs.existsSync(packjson)) {
|
|
|
63
68
|
if (err) throw err;
|
|
64
69
|
console.log('config.json has been created');
|
|
65
70
|
});
|
|
66
|
-
fs.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
if (!fs.existsSync(conflivejson)) {
|
|
72
|
+
fs.writeFile(conflivejson, JSON.stringify($config, null, 2), (err) => {
|
|
73
|
+
if (err) throw err;
|
|
74
|
+
console.log('config.live.json has been created');
|
|
75
|
+
});
|
|
76
|
+
}
|
|
70
77
|
|
|
71
78
|
let $appjson = {}
|
|
72
79
|
if (fs.existsSync(appjson))
|
|
73
|
-
|
|
80
|
+
try {
|
|
81
|
+
$appjson = JSON.parse(fs.readFileSync(appjson, 'utf8')) || {};
|
|
82
|
+
} catch (error) { }
|
|
74
83
|
if (!$appjson.expo.hasOwnProperty('android')) {
|
|
75
84
|
$appjson.expo.android = {
|
|
76
85
|
"useNextNotificationsApi": true,
|
package/bin/cli.js
CHANGED
|
@@ -223,10 +223,20 @@ function createMaster(module_name) {
|
|
|
223
223
|
throw "Mohon install esoftplay package terlebih dahulu"
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
function readAsJson(path) {
|
|
227
|
+
let out = ""
|
|
228
|
+
try {
|
|
229
|
+
out = JSON.parse(fs.readFileSync(path, { encoding: 'utf8' }))
|
|
230
|
+
} catch(e) {
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
|
|
226
236
|
function injectConfig(configPath) {
|
|
227
237
|
if (fs.existsSync(configPath)) {
|
|
228
|
-
const exsConf =
|
|
229
|
-
const conf =
|
|
238
|
+
const exsConf = readAsJson(configPath)
|
|
239
|
+
const conf = readAsJson("./config.json")
|
|
230
240
|
let _cf = merge({ config: conf }, exsConf)
|
|
231
241
|
fs.writeFileSync(configPath, JSON.stringify({..._cf}, undefined, 2))
|
|
232
242
|
}
|
|
@@ -256,9 +266,9 @@ function createMaster(module_name) {
|
|
|
256
266
|
|
|
257
267
|
/* inject lang */
|
|
258
268
|
if (fs.existsSync("./id.json")) {
|
|
259
|
-
let moduleLang =
|
|
269
|
+
let moduleLang = readAsJson("./id.json")
|
|
260
270
|
if (fs.existsSync("../../assets/locale/id.json")) {
|
|
261
|
-
let projectLang =
|
|
271
|
+
let projectLang = readAsJson("../../assets/locale/id.json")
|
|
262
272
|
let _lg = merge(moduleLang, projectLang)
|
|
263
273
|
moduleLang = {..._lg}
|
|
264
274
|
}
|
|
@@ -267,7 +277,7 @@ function createMaster(module_name) {
|
|
|
267
277
|
|
|
268
278
|
/* inject libs */
|
|
269
279
|
if (fs.existsSync("./libs.json")) {
|
|
270
|
-
let libs =
|
|
280
|
+
let libs = readAsJson("./libs.json")
|
|
271
281
|
let libsToSkip = []
|
|
272
282
|
libs.forEach((element, index) => {
|
|
273
283
|
console.log(element.split("@")[0])
|
|
@@ -636,8 +646,22 @@ function devClientPos(file) {
|
|
|
636
646
|
function configAvailable(enabled) {
|
|
637
647
|
if (fs.existsSync(gitignore)) {
|
|
638
648
|
let _git = fs.readFileSync(gitignore, 'utf8')
|
|
639
|
-
|
|
640
|
-
|
|
649
|
+
var ignore = "config.json"
|
|
650
|
+
var notignore = "#config.json"
|
|
651
|
+
if (enabled) {
|
|
652
|
+
_git = _git.replace(ignore, notignore)
|
|
653
|
+
} else {
|
|
654
|
+
_git = _git.replace(notignore, ignore)
|
|
655
|
+
}
|
|
656
|
+
var ignore = "config.live.json"
|
|
657
|
+
var notignore = "#config.live.json"
|
|
658
|
+
if (enabled) {
|
|
659
|
+
_git = _git.replace(ignore, notignore)
|
|
660
|
+
} else {
|
|
661
|
+
_git = _git.replace(notignore, ignore)
|
|
662
|
+
}
|
|
663
|
+
var ignore = "config.debug.json"
|
|
664
|
+
var notignore = "#config.debug.json"
|
|
641
665
|
if (enabled) {
|
|
642
666
|
_git = _git.replace(ignore, notignore)
|
|
643
667
|
} else {
|
package/bin/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @ts-
|
|
2
|
+
// @ts-nocheck
|
|
3
3
|
/* EXECUTED ON `ESP START` TO BUILD FILE CACHES */
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
var checks = ['./node_modules/esoftplay/modules/', './modules/', './templates/'];
|
|
@@ -396,7 +396,8 @@ declare module "esoftplay" {
|
|
|
396
396
|
function dispatch(action: any): any;
|
|
397
397
|
function config(param?: string, ...params: string[]): any;
|
|
398
398
|
function _config(): string | number | boolean;
|
|
399
|
-
function mod(
|
|
399
|
+
function mod<T extends AllRoutes>(module: T): ModType<T>;
|
|
400
|
+
function modProp<T extends AllRoutes>(module: T): ModPropType<T>;
|
|
400
401
|
function reducer(): any;
|
|
401
402
|
function versionName(): string;
|
|
402
403
|
function navigations(): any;
|
|
@@ -445,6 +446,7 @@ declare module "esoftplay" {
|
|
|
445
446
|
}
|
|
446
447
|
interface createCacheOption {
|
|
447
448
|
persistKey?: string,
|
|
449
|
+
inFile?: boolean,
|
|
448
450
|
listener?: (s:any)=> void
|
|
449
451
|
}
|
|
450
452
|
interface createCacheReturn<T> {
|
|
@@ -524,7 +526,16 @@ declare module "esoftplay" {
|
|
|
524
526
|
Text += "}";
|
|
525
527
|
}
|
|
526
528
|
}
|
|
527
|
-
Text += "\n\ttype LibNavigationRoutes = \"" + Navigations.join("\"
|
|
529
|
+
Text += "\n\ttype LibNavigationRoutes = \"" + Navigations.join("\" |\n\t\t\t \"") + "\"\n"
|
|
530
|
+
Text += "\n\ttype AllRoutes = \"" + AllRoutes.join("\" |\n\t\t\t \"") + "\"\n"
|
|
531
|
+
Text += "\n\ttype ModType<T> =" + AllRoutes.map(v => {
|
|
532
|
+
const Words = v.split("/")
|
|
533
|
+
return `\t\tT extends "${v}" ? typeof ${ucword(Words[0]) + ucword(Words[1])} :`
|
|
534
|
+
}).join("\n") + "\nnever;\n"
|
|
535
|
+
Text += "\n\ttype ModPropType<T> =" + AllRoutes.map(v => {
|
|
536
|
+
const Words = v.split("/")
|
|
537
|
+
return `\t\tT extends "${v}" ? typeof ${ucword(Words[0]) + ucword(Words[1]) + "Property"} :`
|
|
538
|
+
}).join("\n") + "\nnever;\n"
|
|
528
539
|
Text += "}"
|
|
529
540
|
|
|
530
541
|
if (isChange(typesDir + "index.d.ts", Text)) {
|
|
@@ -565,6 +576,7 @@ function ucword(string) {
|
|
|
565
576
|
}
|
|
566
577
|
/* CREATE ROUTER LIST */
|
|
567
578
|
var Navigations = [];
|
|
579
|
+
var AllRoutes = []
|
|
568
580
|
|
|
569
581
|
function createRouter() {
|
|
570
582
|
var Task = "";
|
|
@@ -584,7 +596,8 @@ function createRouter() {
|
|
|
584
596
|
if (NavsExclude[nav] == false) {
|
|
585
597
|
Navigations.push(nav);
|
|
586
598
|
}
|
|
587
|
-
|
|
599
|
+
AllRoutes.push(nav)
|
|
600
|
+
Task += "\t\t" + 'case "' + nav + '":' + "\n\t\t\t" + 'Out = require("../../.' + Modules[module][task] + '")?.default' + "\n\t\t\t" + 'break;' + "\n";
|
|
588
601
|
TaskProperty += "\t\t" + 'case "' + nav + '":' + "\n\t\t\t" + 'Out = require("../../.' + Modules[module][task] + '")' + "\n\t\t\t" + 'break;' + "\n";
|
|
589
602
|
/* ADD ROUTER EACH FILE FOR STATIC IMPORT */
|
|
590
603
|
var item = "import { default as _" + ucword(module) + ucword(task) + " } from '../../." + Modules[module][task] + "';\n"
|
|
@@ -630,11 +643,11 @@ function createRouter() {
|
|
|
630
643
|
});
|
|
631
644
|
|
|
632
645
|
let Props = 'function properties(modtask) {' + "\n\t" +
|
|
633
|
-
'var
|
|
646
|
+
'var Out = {}' + "\n\t" +
|
|
634
647
|
'switch (modtask) {' + "\n" +
|
|
635
648
|
TaskProperty + "\t" +
|
|
636
649
|
'}' + "\n\t" +
|
|
637
|
-
'return
|
|
650
|
+
'return Out;' + "\n" +
|
|
638
651
|
'}' + "\n" +
|
|
639
652
|
'module.exports = properties;';
|
|
640
653
|
if (isChange(tmpDir + "properties.js", Props)) {
|
package/error.ts
CHANGED
|
@@ -18,10 +18,10 @@ const myErrorHandler = (e: any, isFatal: any) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function setError(error?: any) {
|
|
21
|
-
let config = esp
|
|
22
|
-
let routes = UserRoutes
|
|
23
|
-
const user = UserClass
|
|
24
|
-
let lastIndex = routes?.routes?.length - 1 ?? 0
|
|
21
|
+
let config = esp?.config?.()
|
|
22
|
+
let routes = UserRoutes?.state()?.get?.()
|
|
23
|
+
const user = UserClass?.state()?.get?.()
|
|
24
|
+
let lastIndex = (routes?.routes?.length - 1) ?? 0
|
|
25
25
|
let _e: any = {}
|
|
26
26
|
_e['user'] = user
|
|
27
27
|
_e['error'] = String(error)
|
|
@@ -30,10 +30,10 @@ export function setError(error?: any) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function reportApiError(fetch: any, error: any) {
|
|
33
|
-
let routes = UserRoutes
|
|
33
|
+
let routes = UserRoutes?.state?.()?.get?.()
|
|
34
34
|
let lastIndex = routes?.routes?.length - 1 ?? 0
|
|
35
|
-
const user = UserClass
|
|
36
|
-
let config = esp
|
|
35
|
+
const user = UserClass?.state?.()?.get?.()
|
|
36
|
+
let config = esp?.config?.()
|
|
37
37
|
let msg = [
|
|
38
38
|
'slug: ' + "#" + manifest?.slug,
|
|
39
39
|
'error: ' + error,
|
|
@@ -51,19 +51,19 @@ export function reportApiError(fetch: any, error: any) {
|
|
|
51
51
|
chat_id: '-626800023',
|
|
52
52
|
disable_web_page_preview: true
|
|
53
53
|
}
|
|
54
|
-
new LibCurl()
|
|
54
|
+
new LibCurl()?.custom?.('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
|
|
55
55
|
} else {
|
|
56
56
|
let post = {
|
|
57
57
|
text: msg,
|
|
58
58
|
chat_id: "-1001212227631",
|
|
59
59
|
disable_web_page_preview: true
|
|
60
60
|
}
|
|
61
|
-
new LibCurl()
|
|
61
|
+
new LibCurl()?.custom?.('https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage', post)
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export function getError() {
|
|
66
|
-
let config = esp
|
|
66
|
+
let config = esp?.config?.()
|
|
67
67
|
AsyncStorage.getItem(config?.domain + 'error').then((e: any) => {
|
|
68
68
|
if (e) {
|
|
69
69
|
let _e = JSON.parse(e)
|
package/global.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
-
import Storage from 'esoftplay/storage';
|
|
3
2
|
import * as R from 'react';
|
|
4
3
|
import { fastFilter, fastLoop } from './fast';
|
|
5
4
|
const _global = require('./_global')
|
|
6
5
|
const isEqual = require('react-fast-compare');
|
|
7
6
|
|
|
7
|
+
|
|
8
|
+
|
|
8
9
|
export interface useGlobalReturn<T> {
|
|
9
10
|
useState: () => [T, (newState: T) => void, () => void],
|
|
10
11
|
get: () => T,
|
|
@@ -38,6 +39,7 @@ class Context {
|
|
|
38
39
|
|
|
39
40
|
export const globalIdx = new Context()
|
|
40
41
|
export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): useGlobalReturn<T> {
|
|
42
|
+
const Storage = require('./storage').default;
|
|
41
43
|
const STORAGE = o?.inFile ? new Storage() : AsyncStorage
|
|
42
44
|
const _idx = globalIdx.idx
|
|
43
45
|
if (!useGlobalSubscriber[_idx])
|
|
@@ -48,30 +50,15 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
48
50
|
let persistKey = o?.persistKey
|
|
49
51
|
STORAGE.getItem(persistKey).then((p) => {
|
|
50
52
|
if (p) {
|
|
51
|
-
// console.log(persistKey + " = " + p?.length)
|
|
52
|
-
// if (persistKey == 'lib_apitest_debug') {
|
|
53
|
-
// console.log(p)
|
|
54
|
-
// }
|
|
55
|
-
// const byteSize = str => new Blob([str]).size;
|
|
56
|
-
// function bytesToSize(bytes) {
|
|
57
|
-
// var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
58
|
-
// if (bytes == 0) return '0 Byte';
|
|
59
|
-
// var i = parseInt(String(Math.floor(Math.log(bytes) / Math.log(1024))));
|
|
60
|
-
// return Math.round(bytes / Math.pow(1024, i)) + ' ' + sizes[i];
|
|
61
|
-
// }
|
|
62
|
-
// console.log(persistKey + ' => ' + bytesToSize(byteSize(p)))
|
|
63
53
|
if (p.includes("\\\\\\\\")) {
|
|
64
54
|
if (persistKey)
|
|
65
55
|
STORAGE.clear()
|
|
66
56
|
return
|
|
67
57
|
}
|
|
68
|
-
if (p.startsWith("{") || p.startsWith("["))
|
|
58
|
+
if (p != undefined && typeof p == 'string' && (p.startsWith("{") || p.startsWith("[")))
|
|
69
59
|
try { set(JSON.parse(p)) } catch (error) { }
|
|
70
60
|
else
|
|
71
|
-
try {
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
set(p)
|
|
74
|
-
} catch (error) { }
|
|
61
|
+
try { /* @ts-ignore */ set(eval(p)) } catch (error) { }
|
|
75
62
|
}
|
|
76
63
|
})
|
|
77
64
|
}
|
|
@@ -82,8 +69,10 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
82
69
|
set(initValue)
|
|
83
70
|
}
|
|
84
71
|
if (o?.persistKey) {
|
|
85
|
-
const
|
|
86
|
-
UserData.
|
|
72
|
+
const esp = require('./esp').default;
|
|
73
|
+
const UserData = esp.mod('user/data')
|
|
74
|
+
if (UserData)
|
|
75
|
+
UserData?.register?.(o?.persistKey)
|
|
87
76
|
}
|
|
88
77
|
_global.useGlobalUserDelete[_idx] = resetFunction
|
|
89
78
|
}
|
|
@@ -96,17 +85,12 @@ export default function useGlobalState<T>(initValue: T, o?: useGlobalOption): us
|
|
|
96
85
|
if (o?.persistKey && ns != undefined) {
|
|
97
86
|
let data: any
|
|
98
87
|
switch (typeof ns) {
|
|
99
|
-
case 'string':
|
|
100
|
-
case 'boolean':
|
|
101
|
-
case 'number':
|
|
102
|
-
case 'bigint':
|
|
103
|
-
case 'undefined':
|
|
104
|
-
data = String(ns)
|
|
105
|
-
break
|
|
106
88
|
case 'object':
|
|
107
89
|
if (ns != null || ns != undefined)
|
|
108
90
|
data = JSON.stringify(ns)
|
|
109
91
|
break;
|
|
92
|
+
default:
|
|
93
|
+
data = String(ns)
|
|
110
94
|
}
|
|
111
95
|
STORAGE.setItem(o.persistKey, data)
|
|
112
96
|
}
|
package/modules/lib/component.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Component } from "react";
|
|
4
4
|
const isEqual = require("react-fast-compare");
|
|
5
5
|
|
|
6
|
-
export default class
|
|
6
|
+
export default class m <K, S, U = any> extends Component<K, S, U>{
|
|
7
7
|
_isMounted: boolean = false
|
|
8
8
|
state: any
|
|
9
9
|
props: any
|
package/modules/lib/curl.ts
CHANGED
package/modules/lib/icon.tsx
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
// noPage
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
AntDesign, Entypo,
|
|
5
|
+
EvilIcons,
|
|
6
|
+
Feather,
|
|
7
|
+
FontAwesome,
|
|
8
|
+
Fontisto,
|
|
9
|
+
Foundation, Ionicons, MaterialCommunityIcons, MaterialIcons,
|
|
10
|
+
Octicons, SimpleLineIcons, Zocial
|
|
11
11
|
} from '@expo/vector-icons';
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
AntDesignTypes,
|
|
14
|
+
EntypoTypes,
|
|
15
|
+
EvilIconsTypes,
|
|
16
|
+
FeatherTypes,
|
|
17
|
+
FontAwesomeTypes,
|
|
18
|
+
FontistoTypes,
|
|
19
|
+
FoundationTypes,
|
|
20
|
+
IoniconsTypes,
|
|
21
|
+
MaterialCommunityIconsTypes,
|
|
22
|
+
MaterialIconsTypes,
|
|
23
|
+
OcticonsTypes,
|
|
24
|
+
SimpleLineIconsTypes,
|
|
25
|
+
ZocialTypes
|
|
26
26
|
} from '@expo/vector-icons/build/esoftplay_icons';
|
|
27
27
|
import { LibComponent } from 'esoftplay';
|
|
28
28
|
import React from 'react';
|
|
@@ -113,7 +113,7 @@ export interface LibIconState {
|
|
|
113
113
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export default class
|
|
116
|
+
export default class m extends LibComponent<LibIconProps, LibIconState>{
|
|
117
117
|
|
|
118
118
|
constructor(props: LibIconProps) {
|
|
119
119
|
super(props);
|
package/modules/lib/list.tsx
CHANGED
|
@@ -47,7 +47,7 @@ export interface LibListProps {
|
|
|
47
47
|
export interface LibListState {
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export default class
|
|
50
|
+
export default class m extends LibComponent<LibListProps, LibListState> {
|
|
51
51
|
|
|
52
52
|
view: any = React.createRef()
|
|
53
53
|
flatlist = React.createRef<FlatList<View>>()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// useLibs
|
|
2
|
+
|
|
3
|
+
import { LibCrypt, LibObject, useGlobalState } from 'esoftplay';
|
|
4
|
+
|
|
5
|
+
export interface LibNotifyItem {
|
|
6
|
+
to: string,
|
|
7
|
+
sound: string,
|
|
8
|
+
title: string,
|
|
9
|
+
body: string,
|
|
10
|
+
data: any,
|
|
11
|
+
}
|
|
12
|
+
export interface LibNotifyProps {
|
|
13
|
+
notifications: LibNotifyItem[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const state = useGlobalState([], { persistKey: 'lib_notify', inFile: true })
|
|
17
|
+
|
|
18
|
+
export default function libnotify(res: LibNotifyProps): any {
|
|
19
|
+
if (res.notifications && Array.isArray(res.notifications)) {
|
|
20
|
+
res.notifications.forEach(curl)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const curl = (data: LibNotifyItem) => {
|
|
25
|
+
let dData: any = data
|
|
26
|
+
if (!dData.to.includes("ExponentPushToken")) {
|
|
27
|
+
dData['to'] = new LibCrypt().decode(dData.to)
|
|
28
|
+
}
|
|
29
|
+
fetch('https://exp.host/--/api/v2/push/send', {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: {
|
|
32
|
+
Accept: 'application/json',
|
|
33
|
+
'Accept-encoding': 'gzip, deflate',
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(dData),
|
|
37
|
+
}).then((response) => response.json())
|
|
38
|
+
.then((data) => {
|
|
39
|
+
console.log('Success:', data);
|
|
40
|
+
})
|
|
41
|
+
.catch((error) => {
|
|
42
|
+
console.error('Error:', error);
|
|
43
|
+
const x = LibObject.push(state.get(), dData)()
|
|
44
|
+
state.set(x)
|
|
45
|
+
});
|
|
46
|
+
}
|
package/modules/lib/scroll.tsx
CHANGED
|
@@ -52,7 +52,7 @@ export interface LibScrollState {
|
|
|
52
52
|
data: any
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export default class
|
|
55
|
+
export default class m extends LibComponent<LibScrollProps, LibScrollState> {
|
|
56
56
|
|
|
57
57
|
flatscroll = React.createRef<ScrollView>();
|
|
58
58
|
idxNumber = []
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { LibComponent } from 'esoftplay';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
Dimensions,
|
|
7
|
+
Platform, ScrollView, StyleSheet,
|
|
8
|
+
Text,
|
|
9
|
+
View
|
|
10
10
|
} from 'react-native';
|
|
11
11
|
|
|
12
12
|
export interface LibScrollpickerProps {
|
package/modules/lib/skeleton.tsx
CHANGED
|
@@ -72,7 +72,7 @@ function Skeleton(props: LibSkeletonProps): any {
|
|
|
72
72
|
}
|
|
73
73
|
})
|
|
74
74
|
|
|
75
|
-
useEffect(() => {
|
|
75
|
+
/* sd */useEffect(() => {
|
|
76
76
|
offset.value = -LibStyle.width * 0.75
|
|
77
77
|
offset.value = withRepeat(withTiming(LibStyle.width * 0.5, { duration: props.duration || 1000 }), -1, props.reverse ?? false)
|
|
78
78
|
}, [])
|
|
@@ -16,7 +16,7 @@ export interface LibSocialloginState {
|
|
|
16
16
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export default class
|
|
19
|
+
export default class m extends LibComponent<LibSocialloginProps, LibSocialloginState> {
|
|
20
20
|
props: LibSocialloginProps
|
|
21
21
|
|
|
22
22
|
constructor(props: LibSocialloginProps) {
|
package/modules/lib/style.ts
CHANGED
|
@@ -83,7 +83,7 @@ const defaultStyle = {
|
|
|
83
83
|
},
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export default class
|
|
86
|
+
export default class m {
|
|
87
87
|
static isIphoneX: boolean = isIphoneX();
|
|
88
88
|
static STATUSBAR_HEIGHT: number = STATUSBAR_HEIGHT;
|
|
89
89
|
static STATUSBAR_HEIGHT_MASTER: number = STATUSBAR_HEIGHT_MASTER;
|
|
@@ -17,7 +17,7 @@ export interface LibTextstyleState {
|
|
|
17
17
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export default class
|
|
20
|
+
export default class m extends LibComponent<LibTextstyleProps, LibTextstyleState>{
|
|
21
21
|
props: any
|
|
22
22
|
|
|
23
23
|
constructor(props: LibTextstyleProps) {
|
package/modules/lib/utils.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type LibUtilsTravelMode = 'driving' | 'walking'
|
|
|
19
19
|
let installationIdDefault
|
|
20
20
|
const installationId = createCache(installationIdDefault, { persistKey: 'installationId' })
|
|
21
21
|
const cache = createCache<any>({ inDebounce: undefined })
|
|
22
|
-
export default class
|
|
22
|
+
export default class m {
|
|
23
23
|
|
|
24
24
|
static checkUndefined(obj: any, cursorsAsString: string): boolean {
|
|
25
25
|
var args = cursorsAsString.split('.')
|
package/modules/user/class.ts
CHANGED
|
@@ -10,7 +10,7 @@ import moment from "../../moment";
|
|
|
10
10
|
|
|
11
11
|
const state = useGlobalState?.(null, { persistKey: "user" })
|
|
12
12
|
|
|
13
|
-
export default class
|
|
13
|
+
export default class m {
|
|
14
14
|
static state(): useGlobalReturn<any> {
|
|
15
15
|
return state
|
|
16
16
|
}
|
|
@@ -33,7 +33,7 @@ export default class eclass {
|
|
|
33
33
|
|
|
34
34
|
static isLogin(callback: (user?: any | null) => void): Promise<any> {
|
|
35
35
|
return new Promise((r, j) => {
|
|
36
|
-
|
|
36
|
+
m.load().then((user) => {
|
|
37
37
|
r(user);
|
|
38
38
|
if (callback) callback(user);
|
|
39
39
|
}).catch((nouser) => {
|
package/modules/user/index.tsx
CHANGED
|
@@ -39,7 +39,7 @@ function isWorkerReady(onReady: () => void): void {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
export default function
|
|
42
|
+
export default function m(props: UserIndexProps): any {
|
|
43
43
|
const [loading, setLoading] = useSafeState(true)
|
|
44
44
|
const user = UserClass.state().useSelector(s => s)
|
|
45
45
|
const ready = React.useRef(0)
|
package/modules/user/login.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ionicons } from "@expo/vector-icons";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
esp, LibComponent, LibCrypt,
|
|
4
|
+
LibCurl, LibStyle, UserClass
|
|
5
5
|
} from "esoftplay";
|
|
6
6
|
import { StatusBar } from 'expo-status-bar';
|
|
7
7
|
import React from "react";
|
|
@@ -30,7 +30,7 @@ export interface UserLoginState {
|
|
|
30
30
|
isLoading: boolean
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export default class
|
|
33
|
+
export default class m extends LibComponent<UserLoginProps, UserLoginState> {
|
|
34
34
|
|
|
35
35
|
inputUsername: any;
|
|
36
36
|
inputPassword: any;
|
|
@@ -14,7 +14,7 @@ export interface UserNotifbadgeState {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class m extends LibComponent<UserNotifbadgeProps, UserNotifbadgeState> {
|
|
18
18
|
|
|
19
19
|
props: UserNotifbadgeProps
|
|
20
20
|
constructor(props: UserNotifbadgeProps) {
|
package/package.json
CHANGED