esoftplay 0.0.123 → 0.0.124-b
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/assets/cancel.mjs +8 -0
- package/assets/prepare.mjs +9 -0
- package/assets/withAndroidVerifiedLinksWorkaround.js +71 -0
- package/bin/build.js +43 -30
- package/bin/cli.js +10 -4
- package/esp.ts +4 -4
- package/import_translator.mjs +0 -2
- package/libs/worker.tsx +15 -12
- package/modules/lib/curl.ts +5 -3
- package/modules/lib/keyboard_avoid.tsx +1 -1
- package/modules/lib/webview.tsx +5 -4
- package/modules/user/index.tsx +14 -8
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
fs.readdirSync("./modules", { encoding: 'utf8' }).forEach((module) => {
|
|
3
|
+
fs.readdirSync("./modules/" + module, { encoding: 'utf8' }).forEach((task) => {
|
|
4
|
+
const path = "./modules/" + module + "/" + task
|
|
5
|
+
let file = fs.readFileSync(path, { encoding: 'utf8' })
|
|
6
|
+
fs.writeFileSync(path, file.replace("../../assets/worker", "esoftplay/libs/worker"), { encoding: 'utf8' })
|
|
7
|
+
})
|
|
8
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
fs.readdirSync("./modules", { encoding: 'utf8' }).forEach((module) => {
|
|
3
|
+
fs.readdirSync("./modules/" + module, { encoding: 'utf8' }).forEach((task) => {
|
|
4
|
+
console.log(task)
|
|
5
|
+
const path = "./modules/" + module + "/" + task
|
|
6
|
+
let file = fs.readFileSync(path, { encoding: 'utf8' })
|
|
7
|
+
fs.writeFileSync(path, file.replace(/esoftplay\/libs\/worker/g, "../../assets/worker"), { encoding: 'utf8' })
|
|
8
|
+
})
|
|
9
|
+
})
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const { createRunOncePlugin, withAndroidManifest } = require('@expo/config-plugins');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import('@expo/config-plugins').ConfigPlugin} ConfigPlugin
|
|
5
|
+
* @typedef {import('@expo/config-plugins').AndroidManifest} AndroidManifest
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Remove the custom Expo dev client scheme from intent filters, which are set to `autoVerify=true`.
|
|
10
|
+
* The custom scheme `<data android:scheme="exp+<slug>"/>` seems to block verification for these intent filters.
|
|
11
|
+
* This plugin makes sure there is no scheme in the autoVerify intent filters, that starts with `exp+`.
|
|
12
|
+
*
|
|
13
|
+
* @type {ConfigPlugin}
|
|
14
|
+
*/
|
|
15
|
+
const withAndroidVerifiedLinksWorkaround = config =>
|
|
16
|
+
withAndroidManifest(config, config => {
|
|
17
|
+
config.modResults = removeExpoSchemaFromVerifiedIntentFilters(config.modResults);
|
|
18
|
+
return config;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Iterate over all `autoVerify=true` intent filters, and pull out schemes starting with `exp+`.
|
|
23
|
+
*
|
|
24
|
+
* @param {AndroidManifest} androidManifest
|
|
25
|
+
*/
|
|
26
|
+
function removeExpoSchemaFromVerifiedIntentFilters(androidManifest) {
|
|
27
|
+
for (const application of androidManifest.manifest.application || []) {
|
|
28
|
+
for (const activity of application.activity || []) {
|
|
29
|
+
if (activityHasSingleTaskLaunchMode(activity)) {
|
|
30
|
+
for (const intentFilter of activity['intent-filter'] || []) {
|
|
31
|
+
if (intentFilterHasAutoVerification(intentFilter) && intentFilter?.data) {
|
|
32
|
+
intentFilter.data = intentFilterRemoveSchemeFromData(intentFilter, scheme =>
|
|
33
|
+
scheme?.startsWith('exp+')
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return androidManifest;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Determine if the activity should contain the intent filters to clean.
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
function activityHasSingleTaskLaunchMode(activity) {
|
|
50
|
+
return activity?.$?.['android:launchMode'] === 'singleTask';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Determine if the intent filter has `autoVerify=true`.
|
|
55
|
+
*/
|
|
56
|
+
function intentFilterHasAutoVerification(intentFilter) {
|
|
57
|
+
return intentFilter?.$?.['android:autoVerify'] === 'true';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Remove schemes from the intent filter that matches the function.
|
|
62
|
+
*/
|
|
63
|
+
function intentFilterRemoveSchemeFromData(intentFilter, schemeMatcher) {
|
|
64
|
+
return intentFilter?.data?.filter(entry => !schemeMatcher(entry?.$['android:scheme'] || ''));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = createRunOncePlugin(
|
|
68
|
+
withAndroidVerifiedLinksWorkaround,
|
|
69
|
+
'withAndroidVerifiedLinksWorkaround',
|
|
70
|
+
'1.0.0'
|
|
71
|
+
);
|
package/bin/build.js
CHANGED
|
@@ -143,34 +143,40 @@ if (fs.existsSync(packjson)) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
const easconfg = `{
|
|
146
|
-
"cli": {
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
"build": {
|
|
150
|
-
"development": {
|
|
151
|
-
"developmentClient": true,
|
|
152
|
-
"distribution": "internal",
|
|
153
|
-
"ios": {
|
|
154
|
-
"simulator": true
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"preview": {
|
|
158
|
-
"distribution": "internal",
|
|
159
|
-
"ios": {
|
|
160
|
-
"simulator": true
|
|
161
|
-
}
|
|
146
|
+
"cli": {
|
|
147
|
+
"version": ">= 0.52.0"
|
|
162
148
|
},
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
|
|
166
|
-
"
|
|
149
|
+
"build": {
|
|
150
|
+
"development": {
|
|
151
|
+
"developmentClient": true,
|
|
152
|
+
"distribution": "internal",
|
|
153
|
+
"ios": {
|
|
154
|
+
"simulator": true,
|
|
155
|
+
"resourceClass": "m1-medium"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"preview": {
|
|
159
|
+
"distribution": "internal",
|
|
160
|
+
"ios": {
|
|
161
|
+
"simulator": true,
|
|
162
|
+
"resourceClass": "m1-medium"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"preview_build": {
|
|
166
|
+
"distribution": "internal",
|
|
167
|
+
"android": {
|
|
168
|
+
"buildType": "apk"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"production": {
|
|
172
|
+
"ios": {
|
|
173
|
+
"resourceClass": "m1-medium"
|
|
174
|
+
}
|
|
167
175
|
}
|
|
168
176
|
},
|
|
169
|
-
"
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
"production": {}
|
|
173
|
-
}
|
|
177
|
+
"submit": {
|
|
178
|
+
"production": {}
|
|
179
|
+
}
|
|
174
180
|
}`
|
|
175
181
|
|
|
176
182
|
fs.writeFile(easjson, easconfg, (err) => {
|
|
@@ -246,19 +252,21 @@ yarn-error.log\n\
|
|
|
246
252
|
});
|
|
247
253
|
|
|
248
254
|
const AppJS = `
|
|
255
|
+
|
|
249
256
|
import { LibNotification } from 'esoftplay/cache/lib/notification/import';
|
|
250
257
|
import { UserIndex } from 'esoftplay/cache/user/index/import';
|
|
251
258
|
import * as ErrorReport from 'esoftplay/error';
|
|
252
259
|
import { globalIdx } from 'esoftplay/global';
|
|
260
|
+
import Worker from 'esoftplay/libs/worker';
|
|
253
261
|
import * as Notifications from 'expo-notifications';
|
|
254
262
|
import React, { useEffect } from 'react';
|
|
255
|
-
import { enableFreeze, enableScreens } from 'react-native-screens';
|
|
256
|
-
|
|
257
|
-
enableFreeze()
|
|
263
|
+
import { /* enableFreeze, */ enableScreens } from 'react-native-screens';
|
|
264
|
+
|
|
265
|
+
/* enableFreeze() */
|
|
258
266
|
enableScreens()
|
|
259
|
-
|
|
260
267
|
|
|
261
268
|
Notifications.addNotificationResponseReceivedListener(x => LibNotification.onAction(x));
|
|
269
|
+
Notifications.addNotificationReceivedListener(x => LibNotification.onAction(x));
|
|
262
270
|
|
|
263
271
|
export default function App() {
|
|
264
272
|
useEffect(() => {
|
|
@@ -266,7 +274,11 @@ export default function App() {
|
|
|
266
274
|
ErrorReport.getError()
|
|
267
275
|
}, [])
|
|
268
276
|
|
|
269
|
-
return (
|
|
277
|
+
return (
|
|
278
|
+
<Worker.Provider>
|
|
279
|
+
<UserIndex />
|
|
280
|
+
</Worker.Provider>
|
|
281
|
+
)
|
|
270
282
|
}`;
|
|
271
283
|
let expoLib = [
|
|
272
284
|
'@expo/vector-icons',
|
|
@@ -276,6 +288,7 @@ export default function App() {
|
|
|
276
288
|
'@react-navigation/native-stack',
|
|
277
289
|
'@react-navigation/native',
|
|
278
290
|
'@react-navigation/stack',
|
|
291
|
+
'@shopify/flash-list',
|
|
279
292
|
'buffer',
|
|
280
293
|
'expo-application',
|
|
281
294
|
'expo-camera',
|
package/bin/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ var args = process.argv.slice(2);
|
|
|
24
24
|
|
|
25
25
|
// console.log(modpath, "sdofsjdofjsd")
|
|
26
26
|
function execution() {
|
|
27
|
-
const cmd = `watchman -j <<< '["trigger","./",{"name":"esp","expression":["allof",["not",["dirname","node_modules"]],["not",["name","index.d.ts"]]],"command":["node","./node_modules/esoftplay/bin/router.js"],"append_files":true}]' && node ./node_modules/esoftplay/bin/router.js`
|
|
27
|
+
const cmd = `watchman watch-del ./ && watchman watch ./ && watchman -j <<< '["trigger","./",{"name":"esp","expression":["allof",["not",["dirname","node_modules"]],["not",["name","index.d.ts"]]],"command":["node","./node_modules/esoftplay/bin/router.js"],"append_files":true}]' && node ./node_modules/esoftplay/bin/router.js`
|
|
28
28
|
command(cmd)
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -423,7 +423,7 @@ function consoleError(msg) {
|
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
function consoleSucces(msg) {
|
|
426
|
-
console.log("\x1b[32m", msg + "
|
|
426
|
+
console.log("\x1b[32m", msg + " ✔", "\x1b[0m")
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
function checkApp() {
|
|
@@ -669,11 +669,13 @@ function buildPrepare(include = true) {
|
|
|
669
669
|
comm.push(`cp -n ./node_modules/esoftplay/modules/${module}/* ./modules/${module}`)
|
|
670
670
|
}
|
|
671
671
|
});
|
|
672
|
+
comm.push('cp ./node_modules/esoftplay/libs/worker.tsx ./assets/')
|
|
673
|
+
comm.push('node ./node_modules/esoftplay/assets/prepare.mjs')
|
|
672
674
|
consoleSucces("\n\nPLEASE COPY AND EXECUTE THE FOLLOWING COMMAND\n\n" + comm.join('\n') + "\n")
|
|
673
675
|
}
|
|
674
676
|
} else {
|
|
675
677
|
if (fs.existsSync('./assets/esoftplaymodules'))
|
|
676
|
-
command('rm -rf modules && mv ./assets/esoftplaymodules modules')
|
|
678
|
+
command('rm -rf modules && mv ./assets/esoftplaymodules modules && rm -f ./assets/worker.tsx && node ./node_modules/esoftplay/assets/cancel.mjs')
|
|
677
679
|
else
|
|
678
680
|
consoleError('')
|
|
679
681
|
}
|
|
@@ -716,7 +718,9 @@ function build() {
|
|
|
716
718
|
{
|
|
717
719
|
name: "1. Web (for Hosting)",
|
|
718
720
|
cmd: "npx expo export:web",
|
|
719
|
-
pre: () => {
|
|
721
|
+
pre: () => {
|
|
722
|
+
|
|
723
|
+
}
|
|
720
724
|
},
|
|
721
725
|
]
|
|
722
726
|
:
|
|
@@ -826,6 +830,8 @@ function build() {
|
|
|
826
830
|
if (pre) pre()
|
|
827
831
|
consoleSucces("⚙⚙⚙ ... \n" + cmd)
|
|
828
832
|
command(cmd)
|
|
833
|
+
if (fs.existsSync('./build/post.js'))
|
|
834
|
+
command('node ./build/post.js')
|
|
829
835
|
configAvailable(false)
|
|
830
836
|
devClientPos(appjson)
|
|
831
837
|
} else if (d === false) {
|
package/esp.ts
CHANGED
|
@@ -17,7 +17,7 @@ const ignoreWarns = [
|
|
|
17
17
|
const err = console.error;
|
|
18
18
|
console.error = (...arg) => {
|
|
19
19
|
for (let i = 0; i < ignoreWarns.length; i++) {
|
|
20
|
-
if (arg[0]
|
|
20
|
+
if (arg?.[0]?.startsWith?.(ignoreWarns[i])) return;
|
|
21
21
|
}
|
|
22
22
|
err(...arg);
|
|
23
23
|
};
|
|
@@ -25,14 +25,12 @@ console.error = (...arg) => {
|
|
|
25
25
|
const warn = console.warn;
|
|
26
26
|
console.warn = (...arg) => {
|
|
27
27
|
for (let i = 0; i < ignoreWarns.length; i++) {
|
|
28
|
-
if (arg[0]
|
|
28
|
+
if (arg?.[0]?.startsWith?.(ignoreWarns[i])) return;
|
|
29
29
|
}
|
|
30
30
|
warn(...arg);
|
|
31
31
|
};
|
|
32
32
|
LogBox.ignoreLogs(ignoreWarns);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
34
|
let app = require('../../app.json');
|
|
37
35
|
let conf = require('../../config.json');
|
|
38
36
|
let lconf: any
|
|
@@ -41,6 +39,8 @@ try {
|
|
|
41
39
|
} catch (error) {
|
|
42
40
|
|
|
43
41
|
}
|
|
42
|
+
if (conf?.config?.isDebug == 0)
|
|
43
|
+
LogBox.ignoreAllLogs();
|
|
44
44
|
|
|
45
45
|
const esp = {
|
|
46
46
|
mergeDeep(target: any, ...sources: any[]) {
|
package/import_translator.mjs
CHANGED
|
@@ -6,10 +6,8 @@ if (fs.existsSync('./modules')) {
|
|
|
6
6
|
if (!module.startsWith('.')) {
|
|
7
7
|
fs.readdirSync('./modules/' + module).forEach((task) => {
|
|
8
8
|
var dFile = fs.readFileSync('./modules/' + module + '/' + task, { encoding: 'utf8' })
|
|
9
|
-
// if (module == 'artist' && task == 'detail.tsx') {
|
|
10
9
|
dFile = dFile.replace(/esoftplay\/cache\/([a-z0-9_]+\/[a-z0-9_]+).import/g, "esoftplay/cache/$1/import")
|
|
11
10
|
console.log(module + '/' + task)
|
|
12
|
-
// }
|
|
13
11
|
fs.writeFileSync('./modules/' + module + '/' + task, dFile, { encoding: 'utf8' })
|
|
14
12
|
})
|
|
15
13
|
}
|
package/libs/worker.tsx
CHANGED
|
@@ -140,22 +140,25 @@ const Worker = {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
|
-
|
|
143
|
+
Provider(props: any): any {
|
|
144
144
|
if (Platform.OS == 'android')
|
|
145
145
|
if (Platform.Version <= 22) {
|
|
146
|
-
return
|
|
146
|
+
return props.children
|
|
147
147
|
}
|
|
148
148
|
return (
|
|
149
|
-
<View style={{
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
<View style={{ flex: 1 }} >
|
|
150
|
+
<View style={{ height: 0, width: 0 }} >
|
|
151
|
+
<WebView
|
|
152
|
+
ref={_global.WorkerBase}
|
|
153
|
+
style={{ width: 0, height: 0 }}
|
|
154
|
+
javaScriptEnabled={true}
|
|
155
|
+
injectedJavaScript={`\nwindow.ReactNativeWebView.postMessage("BaseWorkerIsReady")\n` + _global.injectedJavaScripts.join('\n') + '\ntrue;'}
|
|
156
|
+
originWhitelist={["*"]}
|
|
157
|
+
source={{ uri: esp.config("protocol") + "://" + esp.config("domain") + esp.config("uri") + "dummyPageToBypassCORS" }}
|
|
158
|
+
onMessage={Worker.onMessage('BaseWorkerIsReady')}
|
|
159
|
+
/>
|
|
160
|
+
</View>
|
|
161
|
+
{props.children}
|
|
159
162
|
</View>
|
|
160
163
|
)
|
|
161
164
|
}
|
package/modules/lib/curl.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
|
7
7
|
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
8
8
|
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
9
9
|
import esp from 'esoftplay/esp';
|
|
10
|
-
|
|
11
10
|
import { reportApiError } from "esoftplay/error";
|
|
12
11
|
import Constants from 'expo-constants';
|
|
13
12
|
|
|
@@ -352,7 +351,7 @@ export default class m {
|
|
|
352
351
|
mode: "cors",
|
|
353
352
|
}
|
|
354
353
|
|
|
355
|
-
|
|
354
|
+
|
|
356
355
|
this.initTimeout(upload ? 120000 : this.timeout)
|
|
357
356
|
if (debug == 1) esp.log(this.url + this.uri, options)
|
|
358
357
|
this.fetchConf = { url: this.url + this.uri, options: options }
|
|
@@ -375,7 +374,10 @@ export default class m {
|
|
|
375
374
|
// }, 100);
|
|
376
375
|
// } else {
|
|
377
376
|
// }
|
|
378
|
-
|
|
377
|
+
if (__DEV__) {
|
|
378
|
+
console.warn(r)
|
|
379
|
+
} else
|
|
380
|
+
LibToastProperty.show("Koneksi internet kamu tidak stabil, silahkan coba lagi")
|
|
379
381
|
this.onFetchFailed(r)
|
|
380
382
|
LibProgress.hide()
|
|
381
383
|
})
|
|
@@ -10,7 +10,7 @@ export interface LibKeyboard_avoidProps {
|
|
|
10
10
|
}
|
|
11
11
|
export default function m(props: LibKeyboard_avoidProps): any {
|
|
12
12
|
return (
|
|
13
|
-
<KeyboardAvoidingView behavior={Platform.OS == 'android' ? 'height' : 'padding'} style={props.style} >
|
|
13
|
+
<KeyboardAvoidingView behavior={Platform.OS == 'android' ? 'height' : 'padding'} style={[{ flex: 1 }, props.style]} >
|
|
14
14
|
{props.children}
|
|
15
15
|
</KeyboardAvoidingView>
|
|
16
16
|
)
|
package/modules/lib/webview.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import React from "react";
|
|
|
6
6
|
import { Animated, Dimensions, Linking, Platform } from "react-native";
|
|
7
7
|
import { WebView } from 'react-native-webview';
|
|
8
8
|
let { width } = Dimensions.get("window");
|
|
9
|
-
const config = esp.config();
|
|
10
9
|
|
|
11
10
|
//modify webview error: https://github.com/facebook/react-native/issues/10865
|
|
12
11
|
|
|
@@ -44,17 +43,18 @@ class ewebview extends LibComponent<LibWebviewProps, LibWebviewState> {
|
|
|
44
43
|
_animatedValue: any;
|
|
45
44
|
webview: any;
|
|
46
45
|
heightMessage: any;
|
|
47
|
-
|
|
46
|
+
|
|
48
47
|
static defaultProps = {
|
|
49
48
|
needAnimate: true,
|
|
50
49
|
AnimationDuration: 500,
|
|
51
50
|
defaultHeight: 100,
|
|
52
51
|
needAutoResetHeight: true
|
|
53
52
|
};
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
constructor(props: LibWebviewProps) {
|
|
56
55
|
super(props);
|
|
57
56
|
this.props = props
|
|
57
|
+
const config = esp.config();
|
|
58
58
|
this.state = {
|
|
59
59
|
height: props.defaultHeight,
|
|
60
60
|
isFinish: false,
|
|
@@ -67,8 +67,9 @@ class ewebview extends LibComponent<LibWebviewProps, LibWebviewState> {
|
|
|
67
67
|
this.resetHeight = this.resetHeight.bind(this)
|
|
68
68
|
this.resetSmallHeight = this.resetSmallHeight.bind(this)
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
72
|
+
const config = esp.config();
|
|
72
73
|
return { source: nextProps.source && nextProps.source.hasOwnProperty("html") ? { html: config.webviewOpen + nextProps.source.html + config.webviewClose } : nextProps.source }
|
|
73
74
|
}
|
|
74
75
|
|
package/modules/user/index.tsx
CHANGED
|
@@ -14,13 +14,14 @@ import Navs from 'esoftplay/cache/navs';
|
|
|
14
14
|
import { UseDeeplink } from 'esoftplay/cache/use/deeplink/import';
|
|
15
15
|
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
16
16
|
import { UserHook } from 'esoftplay/cache/user/hook/import';
|
|
17
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
17
18
|
import { UserLoading } from 'esoftplay/cache/user/loading/import';
|
|
18
19
|
import { UserRoutes } from 'esoftplay/cache/user/routes/import';
|
|
19
|
-
import
|
|
20
|
+
import useGlobalState from 'esoftplay/global';
|
|
20
21
|
import _global from 'esoftplay/_global';
|
|
21
22
|
import * as Font from "expo-font";
|
|
22
23
|
import React, { useEffect, useLayoutEffect } from 'react';
|
|
23
|
-
import { Platform, View } from "react-native";
|
|
24
|
+
import { Platform, Pressable, Text, View } from "react-native";
|
|
24
25
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
25
26
|
|
|
26
27
|
export interface UserIndexProps {
|
|
@@ -49,7 +50,7 @@ function setFonts(): Promise<void> {
|
|
|
49
50
|
function isWorkerReady(onReady: () => void): void {
|
|
50
51
|
// @ts-ignore
|
|
51
52
|
if (_global.WorkerReady < 1) {
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
setTimeout(() => isWorkerReady(onReady), 10)
|
|
54
55
|
} else {
|
|
55
56
|
onReady()
|
|
@@ -57,20 +58,20 @@ function isWorkerReady(onReady: () => void): void {
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
const route = useGlobalState<any>(undefined, { persistKey: 'user_index_routes_initial' })
|
|
61
62
|
export default function m(props: UserIndexProps): any {
|
|
62
63
|
const [loading, setLoading] = useSafeState(true)
|
|
63
64
|
const user = UserClass.state().useSelector(s => s)
|
|
64
65
|
const ready = React.useRef(0)
|
|
65
66
|
UseDeeplink()
|
|
66
67
|
//@ts-ignore
|
|
67
|
-
const initialState = __DEV__ ?
|
|
68
|
+
const initialState = __DEV__ ? route.get() : undefined
|
|
68
69
|
|
|
69
70
|
function handler(currentState: any): void {
|
|
70
71
|
//@ts-ignore
|
|
71
72
|
if (__DEV__) {
|
|
72
73
|
//@ts-ignore
|
|
73
|
-
|
|
74
|
+
route.set(currentState)
|
|
74
75
|
}
|
|
75
76
|
UserRoutes.set(currentState)
|
|
76
77
|
}
|
|
@@ -89,7 +90,7 @@ export default function m(props: UserIndexProps): any {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
if (limitReady == 3) {
|
|
92
|
-
|
|
93
|
+
|
|
93
94
|
isWorkerReady(() => {
|
|
94
95
|
ready.current += 1
|
|
95
96
|
if (ready.current >= limitReady) {
|
|
@@ -128,7 +129,6 @@ export default function m(props: UserIndexProps): any {
|
|
|
128
129
|
return (
|
|
129
130
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
130
131
|
<View style={{ flex: 1 }}>
|
|
131
|
-
<Worker.View />
|
|
132
132
|
{
|
|
133
133
|
loading ?
|
|
134
134
|
<UserLoading />
|
|
@@ -142,6 +142,12 @@ export default function m(props: UserIndexProps): any {
|
|
|
142
142
|
<LibProgress />
|
|
143
143
|
<LibToast />
|
|
144
144
|
<UserHook />
|
|
145
|
+
{
|
|
146
|
+
__DEV__ &&
|
|
147
|
+
<Pressable onPress={() => route.reset()} style={{ position: 'absolute', right: 10, top: LibStyle.height * 0.5, padding: 10, backgroundColor: 'indigo', alignItems: 'center', justifyContent: 'center', borderRadius: 50 }} >
|
|
148
|
+
<LibIcon name='delete-variant' color='white' />
|
|
149
|
+
</Pressable>
|
|
150
|
+
}
|
|
145
151
|
</>
|
|
146
152
|
}
|
|
147
153
|
</View>
|