From 1ceeeca174e757c853c4e685a4638891bfd6b2c2 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 12 Feb 2020 12:12:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 7 ++++--- app/src/main/AndroidManifest.xml | 1 - .../legado/app/model/analyzeRule/AnalyzeRule.kt | 17 +++++++++++------ build.gradle | 2 ++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index eafaac8a2..a1d82937c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -115,6 +115,7 @@ dependencies { implementation 'androidx.viewpager2:viewpager2:1.0.0' implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android:flexbox:1.1.0' + implementation 'com.google.code.gson:gson:2.8.5' //lifecycle def lifecycle_version = '2.2.0' @@ -143,13 +144,12 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" //规则相关 - implementation 'com.google.code.gson:gson:2.8.5' implementation 'org.jsoup:jsoup:1.12.1' implementation 'cn.wanghaomiao:JsoupXpath:2.3.2' implementation 'com.jayway.jsonpath:json-path:2.4.0' - //JS - implementation 'com.github.gedoor:rhino-android:1.3' + //JS rhino + implementation 'io.apisense:rhino-android:1.1.1' //Retrofit implementation 'com.squareup.okhttp3:logging-interceptor:4.1.0' @@ -177,6 +177,7 @@ dependencies { // 转换繁体 implementation 'com.github.houbb:opencc4j:1.4.0' + } apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 375ea0494..6ca7a7d2f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,7 +24,6 @@ android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:theme="@style/AppTheme.Light" - android:requestLegacyExternalStorage="false" tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnusedAttribute"> diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 73618b142..19d4edb50 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -585,12 +585,17 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions { */ @Throws(Exception::class) private fun evalJS(jsStr: String, result: Any?): Any? { - val bindings = SimpleBindings() - bindings["java"] = this - bindings["book"] = book - bindings["result"] = result - bindings["baseUrl"] = baseUrl - return SCRIPT_ENGINE.eval(jsStr, bindings) + try { + val bindings = SimpleBindings() + bindings["java"] = this + bindings["book"] = book + bindings["result"] = result + bindings["baseUrl"] = baseUrl + return SCRIPT_ENGINE.eval(jsStr, bindings) + } catch (e: Exception) { + e.printStackTrace() + throw e + } } /** diff --git a/build.gradle b/build.gradle index be4632b0d..a6c94a0db 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,8 @@ allprojects { google() jcenter() maven { url "https://jitpack.io" } + maven { url 'https://maven.google.com/' } + maven { url 'https://github.com/psiegman/mvn-repo/raw/master/releases' } } }