esoftplay 0.0.115-b → 0.0.115-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/modules/lib/curl.ts +10 -0
- package/modules/lib/version.tsx +8 -9
- package/modules/user/index.tsx +10 -4
- package/package.json +1 -1
package/modules/lib/curl.ts
CHANGED
|
@@ -9,6 +9,7 @@ export default class ecurl {
|
|
|
9
9
|
signal = this.controller.signal
|
|
10
10
|
timeout = 30000;
|
|
11
11
|
maxRetry = 3;
|
|
12
|
+
resStatus?: number = undefined
|
|
12
13
|
timeoutContext: any = null;
|
|
13
14
|
isDebug = esp.config("isDebug");
|
|
14
15
|
post: any;
|
|
@@ -276,6 +277,7 @@ export default class ecurl {
|
|
|
276
277
|
fetch(this.url + this.uri, options).then(async (res) => {
|
|
277
278
|
this.cancelTimeout()
|
|
278
279
|
var resText = await res.text()
|
|
280
|
+
this.resStatus = res.status
|
|
279
281
|
var resJson = (resText.startsWith("{") || resText.startsWith("[")) ? JSON.parse(resText) : null
|
|
280
282
|
if (resJson) {
|
|
281
283
|
if (onDone) onDone(resJson, false)
|
|
@@ -347,6 +349,7 @@ export default class ecurl {
|
|
|
347
349
|
|
|
348
350
|
fetch(this.url + this.uri, options).then(async (res) => {
|
|
349
351
|
this.cancelTimeout()
|
|
352
|
+
this.resStatus = res.status
|
|
350
353
|
let resText = await res.text()
|
|
351
354
|
this.onFetched(resText, onDone, onFailed, debug)
|
|
352
355
|
}).catch((r) => {
|
|
@@ -407,7 +410,14 @@ export default class ecurl {
|
|
|
407
410
|
private onError(msg: string): void {
|
|
408
411
|
esp.log("\x1b[31m", msg)
|
|
409
412
|
esp.log("\x1b[0m")
|
|
413
|
+
this.fetchConf.options["status_code"] = this.resStatus
|
|
410
414
|
delete this.fetchConf.options.cancelToken
|
|
415
|
+
delete this.fetchConf.options.signal
|
|
416
|
+
delete this.fetchConf.options.cache
|
|
417
|
+
delete this.fetchConf.options.Pragma
|
|
418
|
+
delete this.fetchConf.options.Expires
|
|
419
|
+
delete this.fetchConf.options.mode
|
|
420
|
+
delete this.fetchConf.options["Cache-Control"]
|
|
411
421
|
reportApiError(this.fetchConf, msg)
|
|
412
422
|
LibProgress.hide()
|
|
413
423
|
}
|
package/modules/lib/version.tsx
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { esp, LibComponent, LibCurl, LibDialog, LibIcon, LibNavigation, LibStyle, LibTextstyle, LibUtils } from 'esoftplay';
|
|
2
|
+
import { esp, LibComponent, LibCurl, LibDialog, LibIcon, LibNavigation, LibStyle, LibTextstyle } from 'esoftplay';
|
|
5
3
|
import Constants from 'expo-constants';
|
|
6
4
|
import React from 'react';
|
|
7
|
-
import { BackHandler, Linking, Platform, TouchableOpacity
|
|
5
|
+
import { BackHandler, ImageBackground, Linking, Platform, TouchableOpacity } from 'react-native';
|
|
8
6
|
export interface LibVersionProps {
|
|
9
7
|
|
|
10
8
|
}
|
|
@@ -42,36 +40,37 @@ export default class m extends LibComponent<LibVersionProps, LibVersionState> {
|
|
|
42
40
|
|
|
43
41
|
static onDone(res: any, msg: string): void {
|
|
44
42
|
const { title, version, android, ios } = res
|
|
45
|
-
|
|
43
|
+
console.log(res)
|
|
46
44
|
function isAvailableNewVersion(newVersion: string): boolean {
|
|
47
45
|
let oldVersion = m.appVersion()
|
|
48
46
|
return newVersion > oldVersion
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
if (isAvailableNewVersion(version)) {
|
|
50
|
+
console.log("IS AVAILABLE", version)
|
|
52
51
|
LibNavigation.backToRoot()
|
|
53
52
|
LibNavigation.replace("lib/version", { res, msg: msg == 'success' ? 'Update to a new version now' : msg })
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
}
|
|
57
56
|
static check(): void {
|
|
58
|
-
new LibCurl("public_version", null, m.onDone)
|
|
57
|
+
new LibCurl("public_version?syafiq=1", null, m.onDone)
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
render(): any {
|
|
62
61
|
const { res: { title, version, android, ios }, msg } = LibNavigation.getArgsAll(this.props)
|
|
63
62
|
const link = Platform.OS == 'ios' ? ios : android
|
|
64
63
|
return (
|
|
65
|
-
<
|
|
64
|
+
<ImageBackground source={esp.assets("splash.png")} blurRadius={100} style={{ flex: 1, justifyContent: 'center', alignItems: 'center', borderStartColor: 'white', paddingHorizontal: 17 }} >
|
|
66
65
|
<LibIcon.SimpleLineIcons name="info" size={60} />
|
|
67
66
|
<LibTextstyle textStyle="headline" text={title || 'A new version is available'} style={{ textAlign: 'center', marginTop: 10 }} />
|
|
68
|
-
<LibTextstyle textStyle="callout" text={
|
|
67
|
+
<LibTextstyle textStyle="callout" text={msg} style={{ textAlign: 'center', marginTop: 10, color: '#333' }} />
|
|
69
68
|
<TouchableOpacity
|
|
70
69
|
onPress={() => { Linking.canOpenURL(link) && Linking.openURL(link) }}
|
|
71
70
|
style={{ marginTop: 20, borderRadius: 10, paddingHorizontal: 17, paddingVertical: 10, backgroundColor: LibStyle.colorPrimary }} >
|
|
72
71
|
<LibTextstyle textStyle="body" text="Update Sekarang" />
|
|
73
72
|
</TouchableOpacity>
|
|
74
|
-
</
|
|
73
|
+
</ImageBackground>
|
|
75
74
|
)
|
|
76
75
|
}
|
|
77
76
|
}
|
package/modules/user/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { ChattingFirebase, esp, LibDialog, LibImage, LibNet_status, LibProgress, LibStyle, LibToast, LibUpdaterProperty, LibVersion, LibWorker, LibWorkloop, LibWorkview, UseDeeplink, useGlobalReturn, useGlobalState, 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
|
-
import { View } from "react-native";
|
|
7
|
+
import { Platform, View } from "react-native";
|
|
8
8
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
9
9
|
import Navs from "../../cache/navs";
|
|
10
10
|
|
|
@@ -56,24 +56,30 @@ export default function m(props: UserIndexProps): any {
|
|
|
56
56
|
// const timeout = setTimeout(() => {
|
|
57
57
|
// setLoading(false)
|
|
58
58
|
// }, 15 * 1000);
|
|
59
|
+
let limitReady = 3
|
|
60
|
+
if (Platform.OS == 'android')
|
|
61
|
+
if (Platform.Version <= 22) {
|
|
62
|
+
limitReady = 2
|
|
63
|
+
}
|
|
64
|
+
|
|
59
65
|
if (worker == 1 && !workerReady.current) {
|
|
60
66
|
ready.current += 1
|
|
61
67
|
workerReady.current = true
|
|
62
|
-
if (ready.current >=
|
|
68
|
+
if (ready.current >= limitReady) {
|
|
63
69
|
setLoading(false)
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
(async () => {
|
|
67
73
|
await setFonts()
|
|
68
74
|
ready.current += 1
|
|
69
|
-
if (ready.current >=
|
|
75
|
+
if (ready.current >= limitReady) {
|
|
70
76
|
setLoading(false)
|
|
71
77
|
}
|
|
72
78
|
})()
|
|
73
79
|
|
|
74
80
|
UserClass.isLogin(async () => {
|
|
75
81
|
ready.current += 1
|
|
76
|
-
if (ready.current >=
|
|
82
|
+
if (ready.current >= limitReady) {
|
|
77
83
|
setLoading(false)
|
|
78
84
|
}
|
|
79
85
|
})
|