输入url参数对话框
This commit is contained in:
1 parent
b37c57a710
commit
bb10e639ee
2 files changed
+61
-18
No files matched your search
@@ -172,7 +172,7 @@ class AnalyzeUrl(
|
||||
option.getMethod()?.let {
|
||||
if (it.equals("POST", true)) method = RequestMethod.POST
|
||||
}
|
||||
option.getHeaders()?.forEach { entry ->
|
||||
option.getHeaderMap()?.forEach { entry ->
|
||||
headerMap[entry.key.toString()] = entry.value.toString()
|
||||
}
|
||||
option.getBody()?.let {
|
||||
@@ -558,8 +558,8 @@ class AnalyzeUrl(
|
||||
private var charset: String? = null,
|
||||
private var headers: Any? = null,
|
||||
private var body: Any? = null,
|
||||
private var type: String? = null,
|
||||
private var retry: Int? = null,
|
||||
private var type: String? = null,
|
||||
private var webView: Any? = null,
|
||||
private var webJs: String? = null,
|
||||
private var js: String? = null,
|
||||
@@ -580,6 +580,14 @@ class AnalyzeUrl(
|
||||
return charset
|
||||
}
|
||||
|
||||
fun setRetry(value: String?) {
|
||||
retry = if (value.isNullOrEmpty()) null else value.toIntOrNull()
|
||||
}
|
||||
|
||||
fun getRetry(): Int {
|
||||
return retry ?: 0
|
||||
}
|
||||
|
||||
fun setType(value: String?) {
|
||||
type = if (value.isNullOrBlank()) null else value
|
||||
}
|
||||
@@ -588,14 +596,6 @@ class AnalyzeUrl(
|
||||
return type
|
||||
}
|
||||
|
||||
fun setRetry(value: Int?) {
|
||||
retry = if (value == null || value <= 0) null else value
|
||||
}
|
||||
|
||||
fun getRetry(): Int {
|
||||
return retry ?: 0
|
||||
}
|
||||
|
||||
fun useWebView(): Boolean {
|
||||
return when (webView) {
|
||||
null, "", false, "false" -> false
|
||||
@@ -615,7 +615,7 @@ class AnalyzeUrl(
|
||||
}
|
||||
}
|
||||
|
||||
fun getHeaders(): Map<*, *>? {
|
||||
fun getHeaderMap(): Map<*, *>? {
|
||||
return when (val value = headers) {
|
||||
is Map<*, *> -> value
|
||||
is String -> GSON.fromJsonObject<Map<String, Any>>(value).getOrNull()
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.legado.app.ui.widget
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.AlertDialog
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.TextButton
|
||||
@@ -11,8 +11,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import io.legado.app.R
|
||||
import io.legado.app.model.analyzeRule.AnalyzeUrl
|
||||
import io.legado.app.ui.theme.AppTheme
|
||||
@@ -61,11 +60,27 @@ fun UrlOptionView(urlOption: AnalyzeUrl.UrlOption) {
|
||||
}
|
||||
urlOption.useWebView(useWebView.value)
|
||||
val method = remember {
|
||||
mutableStateOf(urlOption.getMethod() ?: | ||||