rebase
This commit is contained in:
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_SERVICE_APIS
|
||||
import com.mogo.module.carchatting.R
|
||||
import com.mogo.module.carchatting.bean.UserInfo
|
||||
import com.mogo.module.carchatting.card.CallChatConstant.Companion.MODULE_NAME
|
||||
import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
|
||||
import com.mogo.module.carchatting.util.*
|
||||
import com.mogo.module.carchatting.view.CallingWindowManager.Companion.callingWindowManager
|
||||
import com.mogo.module.carchatting.view.MapViewManager.Companion.mapViewManager
|
||||
@@ -35,7 +36,6 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
|
||||
IVoiceIntentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG: String = "CallChatCenter"
|
||||
|
||||
val callChatCenter by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
CallChatCenter()
|
||||
@@ -383,6 +383,7 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
|
||||
private fun hideLauncherCallingView() {
|
||||
callWindowHideCallBack()
|
||||
callingWindowManager.hideCallingView()
|
||||
callingWindowManager.hideIncomingView()
|
||||
}
|
||||
|
||||
private fun callWindowShowCallBack() {
|
||||
@@ -407,6 +408,7 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
|
||||
Logger.d(TAG, "answerCall")
|
||||
taskMainLaunch {
|
||||
callingWindowManager.hideIncomingView()
|
||||
showLauncherCallingView()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.carchatting.biz
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.chat.base.BaseResponse
|
||||
import com.mogo.chat.callcenter.*
|
||||
import com.mogo.chat.callcenter.CallController.Companion.callController
|
||||
import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager
|
||||
@@ -15,6 +14,7 @@ import com.mogo.chat.util.CallTimer.Companion.callTimer
|
||||
import com.mogo.chat.util.UserInfoHelper.currentCallType
|
||||
import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo
|
||||
import com.mogo.chat.util.log
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.module.carchatting.R
|
||||
import com.mogo.module.carchatting.bean.EnthusiasmIndex
|
||||
import com.mogo.module.carchatting.bean.Result
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.module.carchatting.biz
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.module.carchatting.bean.UserInfo
|
||||
|
||||
class Test:BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
CallChatCenter.callChatCenter.showIncomingCall(UserInfo("123",123,"","","","","","","",""))
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.mogo.module.carchatting.net
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.chat.base.BaseResponse
|
||||
import com.mogo.chat.exception.ApiException
|
||||
import com.mogo.chat.exception.ApiException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
|
||||
import com.mogo.chat.exception.CallApiException
|
||||
import com.mogo.chat.exception.CommonException.Companion.NETWORK_EXCEPTION
|
||||
import com.mogo.chat.exception.CommonException.Companion.NULL_EXCEPTION
|
||||
import com.mogo.chat.exception.CommonException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import kotlinx.coroutines.*
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
@@ -63,7 +63,7 @@ class Request<T> {
|
||||
if (result.code == 0) {
|
||||
onSuccess?.invoke(result)
|
||||
} else {
|
||||
throw ApiException(result.code, result.msg)
|
||||
throw CallApiException(result.code, result.msg)
|
||||
}
|
||||
} else {
|
||||
throw NULL_REQUEST_DATA_API_EXCEPTION
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.carchatting.net
|
||||
|
||||
import com.mogo.chat.base.BaseResponse
|
||||
import com.mogo.chat.model.bean.TeammateInfo
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.module.carchatting.bean.Result
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.carchatting.net
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.chat.base.BaseResponse
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.debug.DebugConfig.CAR_MACHINE_TYPE_BYD
|
||||
import com.mogo.module.carchatting.R
|
||||
import com.mogo.module.carchatting.bean.UserInfo
|
||||
import com.mogo.module.carchatting.biz.CallChatCenter
|
||||
import com.mogo.module.carchatting.view.VrModeHelper.Companion.vrModeHelper
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget
|
||||
@@ -94,7 +93,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
quitVehicleTeam: () -> Unit,
|
||||
moveToCenter: () -> Unit
|
||||
) {
|
||||
Logger.d(CallChatCenter.TAG, "CallingWindowManager init --->")
|
||||
Logger.d(TAG, "CallingWindowManager init --->")
|
||||
this.mContext = context
|
||||
this.serviceApi = serviceApi
|
||||
this.match = match
|
||||
@@ -106,7 +105,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
Logger.d(CallChatCenter.TAG, "CallingWindowManager initView --->")
|
||||
Logger.d(TAG, "CallingWindowManager initView --->")
|
||||
launcherCallingView = vrModeHelper.getCallingWindowLayoutView(mContext!!)
|
||||
launcherCallingView?.setOnClickListener { }
|
||||
launcherCallingView?.let { view ->
|
||||
@@ -176,27 +175,27 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
|
||||
fun showInitView() {
|
||||
if (DebugConfig.getCarMachineType() != CAR_MACHINE_TYPE_BYD) {
|
||||
Logger.d(CallChatCenter.TAG, "showInitView Mogo车机不执行")
|
||||
Logger.d(TAG, "showInitView Mogo车机不执行")
|
||||
return
|
||||
}
|
||||
if (launcherCallingView == null) {
|
||||
Logger.d(CallChatCenter.TAG, "展示Launcher浮窗 showInitView")
|
||||
Logger.d(TAG, "展示Launcher浮窗 showInitView")
|
||||
initView()
|
||||
showCallingWindow()
|
||||
Logger.d(CallChatCenter.TAG, "添加浮窗成功 showInitView")
|
||||
Logger.d(TAG, "添加浮窗成功 showInitView")
|
||||
}
|
||||
}
|
||||
|
||||
fun showMatchingView() {
|
||||
if (launcherCallingView == null) {
|
||||
Logger.d(CallChatCenter.TAG, "展示Launcher浮窗 showMatchingView")
|
||||
Logger.d(TAG, "展示Launcher浮窗 showMatchingView")
|
||||
initView()
|
||||
matchView?.visibility = View.GONE
|
||||
moduleCarchattingTeamRlView?.visibility = View.GONE
|
||||
callingView?.visibility = View.GONE
|
||||
matchingView?.visibility = View.VISIBLE
|
||||
showCallingWindow()
|
||||
Logger.d(CallChatCenter.TAG, "添加浮窗成功 showMatchingView")
|
||||
Logger.d(TAG, "添加浮窗成功 showMatchingView")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +204,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
hangUpIncomingBack: () -> Unit
|
||||
) {
|
||||
Logger.d(
|
||||
CallChatCenter.TAG,
|
||||
TAG,
|
||||
"展示Launcher来电浮窗 showIncomingView===$isLauncherCallingViewShown"
|
||||
)
|
||||
this.agreeIncomingBack = agreeIncomingBack
|
||||
@@ -253,7 +252,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
params.topMargin = y.toInt()
|
||||
serviceApi?.windowManagerApi?.addView(launcherIncomingView, params, true)
|
||||
isLauncherIncomingViewShown = true
|
||||
Logger.d(CallChatCenter.TAG, "添加浮窗成功 addIncomingView===$isLauncherCallingViewShown")
|
||||
Logger.d(TAG, "添加浮窗成功 addIncomingView===$isLauncherCallingViewShown")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,14 +260,14 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
currentUserInfo: UserInfo?,
|
||||
hangUpCallBack: () -> Unit
|
||||
) {
|
||||
Logger.d(CallChatCenter.TAG, "展示Launcher浮窗 showCallingView===$isLauncherCallingViewShown")
|
||||
Logger.d(TAG, "展示Launcher浮窗 showCallingView===$isLauncherCallingViewShown")
|
||||
if (!isLauncherCallingViewShown) {
|
||||
addCallWindowView(hangUpCallBack) {
|
||||
refreshCallWindowData(currentUserInfo)
|
||||
}
|
||||
} else {
|
||||
Logger.d(
|
||||
CallChatCenter.TAG,
|
||||
TAG,
|
||||
"刷新Launcher浮窗数据 showCallingView===currentUserInfo :$currentUserInfo"
|
||||
)
|
||||
refreshCallWindowData(currentUserInfo)
|
||||
@@ -294,7 +293,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
showCallingWindow()
|
||||
refreshData.invoke()
|
||||
isLauncherCallingViewShown = true
|
||||
Logger.d(CallChatCenter.TAG, "添加浮窗成功 addCallWindowView===$isLauncherCallingViewShown")
|
||||
Logger.d(TAG, "添加浮窗成功 addCallWindowView===$isLauncherCallingViewShown")
|
||||
}
|
||||
|
||||
private fun refreshCallWindowData(currentUserInfo: UserInfo?) {
|
||||
@@ -329,7 +328,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
if (!isLauncherIncomingViewShown) {
|
||||
return
|
||||
}
|
||||
Logger.d(CallChatCenter.TAG, "隐藏Launcher来电浮窗===$isLauncherCallingViewShown")
|
||||
Logger.d(TAG, "隐藏Launcher来电浮窗===$isLauncherCallingViewShown")
|
||||
releaseAudioAndVoice()
|
||||
if (isLauncherIncomingViewShown) {
|
||||
isLauncherIncomingViewShown = false
|
||||
@@ -340,7 +339,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
}
|
||||
|
||||
fun hideCallingView() {
|
||||
Logger.d(CallChatCenter.TAG, "隐藏Launcher浮窗===$isLauncherCallingViewShown")
|
||||
Logger.d(TAG, "隐藏Launcher浮窗===$isLauncherCallingViewShown")
|
||||
if (isLauncherCallingViewShown) {
|
||||
callingTimer?.text = null
|
||||
callingNickName?.text = null
|
||||
@@ -360,13 +359,13 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
}
|
||||
|
||||
fun updateTimer(timeStr: String) {
|
||||
Logger.d(CallChatCenter.TAG, "CallingWindowManager updateView===$timeStr")
|
||||
Logger.d(TAG, "CallingWindowManager updateView===$timeStr")
|
||||
callingTimer?.text = timeStr
|
||||
}
|
||||
|
||||
fun showVehicleTeamView() {
|
||||
Logger.d(
|
||||
CallChatCenter.TAG,
|
||||
TAG,
|
||||
"showVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown"
|
||||
)
|
||||
if (!isLauncherCallingViewShown) {
|
||||
@@ -386,7 +385,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
|
||||
|
||||
fun hideVehicleTeamView() {
|
||||
Logger.d(
|
||||
CallChatCenter.TAG,
|
||||
TAG,
|
||||
"hideVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown"
|
||||
)
|
||||
callingView?.visibility = View.GONE
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.module.carchatting.R
|
||||
import com.mogo.module.carchatting.bean.UserInfo
|
||||
import com.mogo.module.carchatting.biz.CallChatCenter
|
||||
import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter
|
||||
import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
|
||||
import com.mogo.module.carchatting.view.VrModeHelper.Companion.vrModeHelper
|
||||
import com.mogo.module.carchatting.voice.IVoiceCommandListener
|
||||
import com.mogo.module.carchatting.voice.VoiceUtil
|
||||
@@ -89,7 +90,7 @@ class TeamInvitationWindowManager private constructor() {
|
||||
try {
|
||||
job = GlobalScope.launch(Dispatchers.Main) {
|
||||
delay(1000 * 20)
|
||||
Logger.d(CallChatCenter.TAG, "refuseCall()--->executed")
|
||||
Logger.d(TAG, "refuseCall()--->executed")
|
||||
callChatCenter.refuseCall(userInfo!!.sn)
|
||||
hideTeamInvitationView()
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.module.carchatting.R
|
||||
import com.mogo.module.carchatting.bean.EnthusiasmIndex
|
||||
import com.mogo.module.carchatting.bean.UserInfo
|
||||
import com.mogo.module.carchatting.biz.CallChatCenter
|
||||
import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter
|
||||
import com.mogo.module.carchatting.voice.IVoiceCommandListener
|
||||
import com.mogo.module.carchatting.voice.VoiceUtil
|
||||
@@ -52,7 +51,6 @@ class UserDialog : BaseFloatDialog {
|
||||
|
||||
constructor(mogoDriverInfo: MogoDriverInfo, context: Context) : super(context) {
|
||||
driverInfo = mogoDriverInfo
|
||||
Logger.i(CallChatCenter.TAG, "构造函数赋值 driverInfo:$driverInfo")
|
||||
initView()
|
||||
}
|
||||
|
||||
@@ -83,12 +81,10 @@ class UserDialog : BaseFloatDialog {
|
||||
if (moduleCallChatRatingBar!!.visibility == View.VISIBLE) {
|
||||
moduleCallChatRatingBar!!.visibility = View.GONE
|
||||
}
|
||||
Logger.i(CallChatCenter.TAG, "initView driverInfo sn === ${driverInfo?.sn}")
|
||||
val sn = driverInfo?.sn
|
||||
sn?.let {
|
||||
if (it != MoGoAiCloudClientConfig.getInstance().sn) {
|
||||
callChatCenter.updateUserCallStatus { status ->
|
||||
Logger.i(CallChatCenter.TAG, "刷新用户信息打电话状态=== $status")
|
||||
if (status) {
|
||||
moduleCallChatUserCaller?.visibility = View.VISIBLE
|
||||
}
|
||||
@@ -101,7 +97,6 @@ class UserDialog : BaseFloatDialog {
|
||||
}
|
||||
|
||||
private fun refreshUserWindowData() {
|
||||
Logger.i(CallChatCenter.TAG, "refreshUserWindowData")
|
||||
val options: RequestOptions =
|
||||
RequestOptions().circleCrop()
|
||||
.placeholder(R.mipmap.module_carchatting_default_head_img)
|
||||
@@ -126,7 +121,6 @@ class UserDialog : BaseFloatDialog {
|
||||
}
|
||||
|
||||
fun updateUserInfo(mogoDriverInfo: MogoDriverInfo?) {
|
||||
Logger.i(CallChatCenter.TAG, "updateUserInfo 赋值前 mogoDriverInfo: $mogoDriverInfo")
|
||||
mogoDriverInfo?.let {
|
||||
driverInfo?.let { driverInfo ->
|
||||
if (driverInfo.userHead.isNullOrBlank()) {
|
||||
@@ -137,7 +131,6 @@ class UserDialog : BaseFloatDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.i(CallChatCenter.TAG, "updateUserInfo 赋值后 driverInfo : $driverInfo , 准备更新用户信息")
|
||||
refreshUserWindowData()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.carchatting.view
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.module.carchatting.bean.EnthusiasmIndex
|
||||
import com.mogo.module.carchatting.biz.CallChatCenter
|
||||
import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo
|
||||
|
||||
@@ -26,7 +27,7 @@ class UserWindowManager private constructor() {
|
||||
mogoDriverInfo: MogoDriverInfo,
|
||||
userWindowListener: ((Boolean) -> Unit)
|
||||
) {
|
||||
Logger.d(CallChatCenter.TAG, "展示用户信息浮窗===mogoDriverInfo : $mogoDriverInfo")
|
||||
Logger.d(TAG, "展示用户信息浮窗===mogoDriverInfo : $mogoDriverInfo")
|
||||
this.userWindowListener = userWindowListener
|
||||
val context = ContextHolderUtil.getContext()
|
||||
context?.let {
|
||||
@@ -34,22 +35,22 @@ class UserWindowManager private constructor() {
|
||||
userDialog = UserDialog(mogoDriverInfo, it)
|
||||
userDialog!!.show()
|
||||
userDialog!!.setOnDismissListener {
|
||||
Logger.d(CallChatCenter.TAG, "主动隐藏用户信息浮窗===")
|
||||
Logger.d(TAG, "主动隐藏用户信息浮窗===")
|
||||
userDialog = null
|
||||
this.userWindowListener?.invoke(false)
|
||||
this.userWindowListener = null
|
||||
}
|
||||
this.userWindowListener?.invoke(true)
|
||||
Logger.d(CallChatCenter.TAG, "添加用户信息浮窗成功===")
|
||||
Logger.d(TAG, "添加用户信息浮窗成功===")
|
||||
} else {
|
||||
Logger.d(CallChatCenter.TAG, "刷新用户信息浮窗数据===mogoDriverInfo :$mogoDriverInfo")
|
||||
Logger.d(TAG, "刷新用户信息浮窗数据===mogoDriverInfo :$mogoDriverInfo")
|
||||
updateUserInfo(mogoDriverInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateUserEnthusiasmIndex(enthusiasmIndex: EnthusiasmIndex) {
|
||||
Logger.d(CallChatCenter.TAG, "刷新用户热心指数=== $enthusiasmIndex")
|
||||
Logger.d(TAG, "刷新用户热心指数=== $enthusiasmIndex")
|
||||
userDialog?.let {
|
||||
if(it.isShowing){
|
||||
userDialog?.updateUserEnthusiasmIndex(enthusiasmIndex)
|
||||
@@ -58,7 +59,7 @@ class UserWindowManager private constructor() {
|
||||
}
|
||||
|
||||
fun updateUserInfo(mogoDriverInfo: MogoDriverInfo) {
|
||||
Logger.d(CallChatCenter.TAG, "刷新用户信息=== $mogoDriverInfo")
|
||||
Logger.d(TAG, "刷新用户信息=== $mogoDriverInfo")
|
||||
userDialog?.let {
|
||||
if(it.isShowing){
|
||||
userDialog?.updateUserInfo(mogoDriverInfo)
|
||||
@@ -67,7 +68,7 @@ class UserWindowManager private constructor() {
|
||||
}
|
||||
|
||||
fun hideUserView() {
|
||||
Logger.d(CallChatCenter.TAG, "隐藏用户信息浮窗===")
|
||||
Logger.d(TAG, "隐藏用户信息浮窗===")
|
||||
userDialog?.dismiss()
|
||||
userWindowListener?.invoke(false)
|
||||
userWindowListener = null
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.module.carchatting.view
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.chat.base.BaseResponse
|
||||
import com.mogo.chat.model.bean.TeammateInfo
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.module.carchatting.net.Repository
|
||||
import com.mogo.module.carchatting.net.request
|
||||
|
||||
|
||||
Reference in New Issue
Block a user