fix bug of init twice
This commit is contained in:
@@ -31,9 +31,12 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
|
||||
override fun init(context: Context) {
|
||||
mContext = context
|
||||
bizConfigCenter.init(context)
|
||||
traceManager.init(context)
|
||||
MogoLogCatchManager.init(context)
|
||||
}
|
||||
|
||||
override fun initBiz() {
|
||||
bizConfigCenter.init(mContext!!)
|
||||
traceManager.init(mContext!!)
|
||||
MogoLogCatchManager.init(mContext!!)
|
||||
}
|
||||
|
||||
override fun startLogCatch() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zhjt.mogo_core_function_devatools.funcconfig
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -37,7 +36,6 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig> {
|
||||
.registerOnMessageListener(FUNC_CONFIG_TYPE, this)
|
||||
UiThreadHandler.postDelayed({
|
||||
funcConfigNetWorkModel.requestFuncConfig({
|
||||
Log.i("emArrow-0915","config : $it")
|
||||
SPUtils.getInstance("biz_config").put("config", GsonUtils.toJson(it))
|
||||
refreshConfig(it)
|
||||
}, {
|
||||
@@ -55,7 +53,7 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig> {
|
||||
|
||||
override fun onMsgReceived(obj: FuncConfig?) {
|
||||
obj?.let {
|
||||
// refreshConfig(it)
|
||||
refreshConfig(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,11 @@ package com.zhjt.mogo_core_function_devatools.funcconfig.network
|
||||
import android.util.Log
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.network.request
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigConst
|
||||
import com.zhjt.service_biz.FuncConfig
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class FuncConfigNetWorkModel {
|
||||
|
||||
@@ -27,13 +20,16 @@ class FuncConfigNetWorkModel {
|
||||
private var success: ((FuncConfig) -> Unit)? = null
|
||||
private var error: ((String) -> Unit)? = null
|
||||
|
||||
fun requestFuncConfig(onSuccess: ((FuncConfig) -> Unit)? = null, onError: ((String) -> Unit)? = null) {
|
||||
fun requestFuncConfig(
|
||||
onSuccess: ((FuncConfig) -> Unit)? = null,
|
||||
onError: ((String) -> Unit)? = null
|
||||
) {
|
||||
request<BaseResponse<FuncConfig>> {
|
||||
start {
|
||||
if(success == null){
|
||||
if (success == null) {
|
||||
success = onSuccess
|
||||
}
|
||||
if(error == null){
|
||||
if (error == null) {
|
||||
error = onError
|
||||
}
|
||||
}
|
||||
@@ -61,8 +57,7 @@ class FuncConfigNetWorkModel {
|
||||
retryTime += 1
|
||||
requestFuncConfig()
|
||||
} else if (it.message != null) {
|
||||
Log.i("emArrow-0915"," onError : $retryTime")
|
||||
error?.invoke(it.message?:"FuncConfig error msg is null")
|
||||
error?.invoke(it.message ?: "FuncConfig error msg is null")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}
|
||||
SocketBuildConfig.isPrintLog = false;
|
||||
// 初始化DevaTools,开始链路记录
|
||||
CallerDevaToolsManager.INSTANCE.init(this);
|
||||
CallerDevaToolsManager.INSTANCE.init();
|
||||
}
|
||||
|
||||
private void initOverviewDb() {
|
||||
|
||||
@@ -14,6 +14,11 @@ import record_cache.RecordPanelOuterClass
|
||||
*/
|
||||
interface IDevaToolsProvider : IProvider {
|
||||
|
||||
/**
|
||||
* 初始化业务
|
||||
*/
|
||||
fun initBiz()
|
||||
|
||||
/**
|
||||
* 开始抓取日志,默认10min
|
||||
*/
|
||||
|
||||
@@ -21,8 +21,8 @@ object CallerDevaToolsManager {
|
||||
MogoServicePaths.PATH_DEVA_TOOLS
|
||||
)
|
||||
|
||||
fun init(context: Context) {
|
||||
devaToolsProviderApi?.init(context)
|
||||
fun init() {
|
||||
devaToolsProviderApi?.initBiz()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user