optimize plugin load

pull/21/head
fengyuecanzhu 3 years ago
parent 59c4678c47
commit b5a7fa30d7
  1. 3
      app/src/main/assets/updatelog.fy
  2. 3
      app/src/main/java/xyz/fycz/myreader/util/utils/PluginUtils.kt

@ -1,8 +1,9 @@
2022.03.31 2022.04.24
风月读书v2.4.4 风月读书v2.4.4
更新内容: 更新内容:
1、修复软件无法打开的问题(超时时间为5s) 1、修复软件无法打开的问题(超时时间为5s)
2、修复DIY书源重复显示订阅书源的问题 2、修复DIY书源重复显示订阅书源的问题
3、优化动态插件加载
2022.03.29 2022.03.29
风月读书v2.4.3 风月读书v2.4.3

@ -49,6 +49,7 @@ import java.util.*
object PluginUtils { object PluginUtils {
val TAG = PluginUtils.javaClass.simpleName val TAG = PluginUtils.javaClass.simpleName
var hasLoad = false
fun init() { fun init() {
val pluginConfigUrl = val pluginConfigUrl =
@ -94,6 +95,7 @@ object PluginUtils {
} }
private fun loadAppLoader(context: Context, config: PluginConfig?) { private fun loadAppLoader(context: Context, config: PluginConfig?) {
if (hasLoad) return
config?.let { config?.let {
val pluginPath = APPCONST.PLUGIN_DIR_PATH + it.name val pluginPath = APPCONST.PLUGIN_DIR_PATH + it.name
val desFile = File(pluginPath) val desFile = File(pluginPath)
@ -114,6 +116,7 @@ object PluginUtils {
appParam.appInfo = context.applicationInfo appParam.appInfo = context.applicationInfo
onLoad(appParam) onLoad(appParam)
} }
hasLoad = true
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }

Loading…
Cancel
Save