From 870358cf829c313c0f45ec68c24cf2ec634177b7 Mon Sep 17 00:00:00 2001 From: Knock Date: Tue, 1 Sep 2020 16:27:34 +0800 Subject: [PATCH] add js method --- app/src/main/java/io/legado/app/help/JsExtensions.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index cea6359e3..cafa3dea1 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -27,6 +27,17 @@ interface JsExtensions { } } + fun connect(urlStr: String): Any { + return try { + val analyzeUrl = AnalyzeUrl(urlStr, null, null, null, null, null) + val call = analyzeUrl.getResponse(urlStr) + val response = call.execute() + response + } catch (e: Exception) { + e.localizedMessage + } + } + /** * js实现解码,不能删 */