esoftplay 0.0.112-z → 0.0.113
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 +14 -14
- package/modules/lib/document.ts +1 -1
- package/modules/lib/image.tsx +4 -4
- package/modules/lib/infinite.tsx +2 -2
- package/modules/lib/roll.tsx +1 -1
- package/modules/use/curl.ts +1 -1
- package/modules/user/class.ts +1 -1
- package/modules/user/login.tsx +1 -1
- package/package.json +1 -1
package/modules/lib/curl.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { esp, LibCrypt, LibNet_status, LibObject, LibProgress,
|
|
1
|
+
import { esp, LibCrypt, LibNet_status, LibObject, LibProgress, LibUtils, LogStateProperty } from 'esoftplay';
|
|
2
2
|
import { reportApiError } from "esoftplay/error";
|
|
3
3
|
import moment from "esoftplay/moment";
|
|
4
4
|
import Constants from 'expo-constants';
|
|
@@ -24,7 +24,7 @@ export default class ecurl {
|
|
|
24
24
|
cancel: "Tutup"
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
constructor(uri?: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
27
|
+
constructor(uri?: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number) {
|
|
28
28
|
this.header = {}
|
|
29
29
|
this.maxRetry = 2;
|
|
30
30
|
this.setUri = this.setUri.bind(this);
|
|
@@ -49,7 +49,7 @@ export default class ecurl {
|
|
|
49
49
|
if (uri && str.isOnline) {
|
|
50
50
|
this.init(uri, post, onDone, onFailed, debug);
|
|
51
51
|
} else if (!str.isOnline && onFailed) {
|
|
52
|
-
onFailed(this.refineErrorMessage("Failed to access"), false);
|
|
52
|
+
onFailed({ msg: this.refineErrorMessage("Failed to access") }, false);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -135,7 +135,7 @@ export default class ecurl {
|
|
|
135
135
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
protected onFailed(
|
|
138
|
+
protected onFailed(error: any, timeout: boolean): void {
|
|
139
139
|
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -143,9 +143,9 @@ export default class ecurl {
|
|
|
143
143
|
return true
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
public secure(token_uri?: string): (apiKey?: string) => (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
147
|
-
return (apiKey?: string): (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
148
|
-
return async (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
146
|
+
public secure(token_uri?: string): (apiKey?: string) => (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number) => void {
|
|
147
|
+
return (apiKey?: string): (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number) => void => {
|
|
148
|
+
return async (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number) => {
|
|
149
149
|
this.isSecure = true
|
|
150
150
|
await this.setHeader();
|
|
151
151
|
const _apiKey = apiKey || this.apiKey
|
|
@@ -192,12 +192,12 @@ export default class ecurl {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
public withHeader(header: any): (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
195
|
+
public withHeader(header: any): (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number) => void {
|
|
196
196
|
this.header = { ...this.header, ...header }
|
|
197
|
-
return (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
197
|
+
return (uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number) => this.init(uri, post, onDone, onFailed, debug)
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
public upload(uri: string, postKey: string, fileUri: string, mimeType: string, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
200
|
+
public upload(uri: string, postKey: string, fileUri: string, mimeType: string, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number): void {
|
|
201
201
|
postKey = postKey || "image";
|
|
202
202
|
var uName = fileUri.substring(fileUri.lastIndexOf("/") + 1, fileUri.length);
|
|
203
203
|
if (!uName.includes('.')) {
|
|
@@ -341,7 +341,7 @@ export default class ecurl {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
private async init(uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
344
|
+
private async init(uri: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number, upload?: boolean): Promise<void> {
|
|
345
345
|
if (post) {
|
|
346
346
|
if (upload) {
|
|
347
347
|
let fd = new FormData();
|
|
@@ -481,7 +481,7 @@ export default class ecurl {
|
|
|
481
481
|
|
|
482
482
|
|
|
483
483
|
|
|
484
|
-
protected onFetched(resText: string | Object, onDone?: (res: any, msg: string) => void, onFailed?: (
|
|
484
|
+
protected onFetched(resText: string | Object, onDone?: (res: any, msg: string) => void, onFailed?: (error: any, timeout: boolean) => void, debug?: number): void {
|
|
485
485
|
var resJson = typeof resText == 'string' && ((resText.startsWith("{") && resText.endsWith("}")) || (resText.startsWith("[") && resText.endsWith("]"))) ? JSON.parse(resText) : resText
|
|
486
486
|
if (typeof resJson == "object") {
|
|
487
487
|
if (!resJson.status_code || this.onStatusCode(resJson.ok, resJson.status_code, resJson.message, resJson.result)) {
|
|
@@ -489,8 +489,8 @@ export default class ecurl {
|
|
|
489
489
|
if (onDone) onDone(resJson.result, resJson.message)
|
|
490
490
|
this.onDone(resJson.result, resJson.message)
|
|
491
491
|
} else {
|
|
492
|
-
if (onFailed) onFailed(
|
|
493
|
-
this.onFailed(
|
|
492
|
+
if (onFailed) onFailed(resJson, false)
|
|
493
|
+
this.onFailed(resJson, false)
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
} else {
|
package/modules/lib/document.ts
CHANGED
package/modules/lib/image.tsx
CHANGED
|
@@ -221,8 +221,8 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
221
221
|
LibProgress.hide()
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
|
-
(msg:
|
|
225
|
-
console.log(msg, "NOOO")
|
|
224
|
+
(msg: any) => {
|
|
225
|
+
console.log(msg.msg, "NOOO")
|
|
226
226
|
if (x.length - 1 == i)
|
|
227
227
|
LibProgress.hide()
|
|
228
228
|
}, 1)
|
|
@@ -259,9 +259,9 @@ class m extends LibComponent<LibImageProps, LibImageState> {
|
|
|
259
259
|
r(res);
|
|
260
260
|
LibProgress.hide()
|
|
261
261
|
},
|
|
262
|
-
(msg:
|
|
262
|
+
(msg: any) => {
|
|
263
263
|
LibProgress.hide()
|
|
264
|
-
r(msg);
|
|
264
|
+
r(msg.msg);
|
|
265
265
|
}, 1)
|
|
266
266
|
}, 1);
|
|
267
267
|
}
|
package/modules/lib/infinite.tsx
CHANGED
|
@@ -134,12 +134,12 @@ export default class m extends LibComponent<LibInfiniteProps, LibInfiniteState>{
|
|
|
134
134
|
},
|
|
135
135
|
(msg) => {
|
|
136
136
|
if (this.props.isDebug) {
|
|
137
|
-
esp.log(msg)
|
|
137
|
+
esp.log(msg.msg)
|
|
138
138
|
}
|
|
139
139
|
this.page = page
|
|
140
140
|
this.isStop = true
|
|
141
141
|
this.setState({
|
|
142
|
-
error: msg,
|
|
142
|
+
error: msg.msg,
|
|
143
143
|
})
|
|
144
144
|
}, this.props.isDebug
|
|
145
145
|
)
|
package/modules/lib/roll.tsx
CHANGED
package/modules/use/curl.ts
CHANGED
package/modules/user/class.ts
CHANGED
package/modules/user/login.tsx
CHANGED
|
@@ -90,7 +90,7 @@ export default class euserLogin extends LibComponent<UserLoginProps, UserLoginSt
|
|
|
90
90
|
},
|
|
91
91
|
(msg) => {
|
|
92
92
|
// console.log("gagal => " + msg, email)
|
|
93
|
-
this.onFailedLogin(msg)
|
|
93
|
+
this.onFailedLogin(msg.msg)
|
|
94
94
|
this.setState({ isLoading: false, email: "" })
|
|
95
95
|
}, 1
|
|
96
96
|
)
|