pull/433/head
gedoor 5 years ago
parent 7792765e1b
commit 570df89135
  1. 15
      app/src/main/java/io/legado/app/data/entities/RssSource.kt

@ -41,9 +41,14 @@ data class RssSource(
var loadWithBaseUrl: Boolean = false, var loadWithBaseUrl: Boolean = false,
var customOrder: Int = 0 var customOrder: Int = 0
): Parcelable, JsExtensions { ) : Parcelable, JsExtensions {
override fun equals(other: Any?) = if (other is RssSource) other.sourceUrl == sourceUrl else false override fun equals(other: Any?): Boolean {
if (other is RssSource) {
return other.sourceUrl == sourceUrl
}
return false
}
override fun hashCode() = sourceUrl.hashCode() override fun hashCode() = sourceUrl.hashCode()
@ -69,7 +74,11 @@ data class RssSource(
* 执行JS * 执行JS
*/ */
@Throws(Exception::class) @Throws(Exception::class)
private fun evalJS(jsStr: String): Any = AppConst.SCRIPT_ENGINE.eval(jsStr, SimpleBindings().apply { this["java"] = this@RssSource }) private fun evalJS(jsStr: String): Any? {
val bindings = SimpleBindings()
bindings["java"] = this
return AppConst.SCRIPT_ENGINE.eval(jsStr, bindings)
}
fun equal(source: RssSource): Boolean { fun equal(source: RssSource): Boolean {
return equal(sourceUrl, source.sourceUrl) return equal(sourceUrl, source.sourceUrl)

Loading…
Cancel
Save