[Chat]车聊聊架构升级

This commit is contained in:
renwj
2022-03-09 11:18:30 +08:00
committed by zhongchao
parent b16e7edbd3
commit 9275ed5ff2
178 changed files with 8116 additions and 301 deletions

View File

@@ -0,0 +1,34 @@
package com.mogo.eagle.core.function.call.chat
import android.content.Context
import android.util.Log
import com.mogo.eagle.core.function.api.chat.IMoGoChatProvider
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts
import com.mogo.eagle.core.function.api.chat.biz.ChatParams
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.jetbrains.annotations.TestOnly
object CallerChatManager: CallerBase() {
private val provider by lazy {
getApiInstance(IMoGoChatProvider::class.java, ChatConsts.CHAT_PROVIDER_PATH)?.chat()
}
@TestOnly
@OptIn(ExperimentalCoroutinesApi::class)
fun call(ctx: Context , sn: String) {
val facade = provider ?: return
facade
.call(ChatParams(sn))
.onEach {
Log.e(ChatConsts.TAG, "call state: $it")
}
.launchIn(ctx.lifeCycleScope)
}
fun chat() = provider
}