diff --git a/ZD_README/README_VersionHistory.md b/ZD_README/README_VersionHistory.md index 56f59fab4a..aa6e59dedd 100644 --- a/ZD_README/README_VersionHistory.md +++ b/ZD_README/README_VersionHistory.md @@ -57,9 +57,6 @@ mogoservice : "com.mogo.service:mogo-service:${MOGO_COMMONS_VER mogoserviceapi : "com.mogo.service:mogo-service-api:${MOGO_COMMONS_VERSION}", moduleapps : "com.mogo.module:module-apps:${MOGO_COMMONS_VERSION}", moduleextensions : "com.mogo.module:module-extensions:${MOGO_COMMONS_VERSION}", -chat : "com.mogo.module.carchatout:module-chat:${MOGO_COMMONS_VERSION}", -callchat : "com.mogo.module.carchatout:module-carchatting:${MOGO_COMMONS_VERSION}", -callchatprovider : "com.mogo.module.carchatout:module-carchatting-provider:${MOGO_COMMONS_VERSION}", // V2X moduleV2x : "com.mogo.module:module-v2x:${MOGO_COMMONS_VERSION}", diff --git a/app/build.gradle b/app/build.gradle index a0c72dcba9..cd627761b2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -220,7 +220,7 @@ repositories { } aspectjx { - include "com.mogo.chat" + include "com.mogo.eagle.core.function.chat" } diff --git a/build.gradle b/build.gradle index 8da9516e51..7091777dfd 100644 --- a/build.gradle +++ b/build.gradle @@ -115,3 +115,20 @@ afterEvaluate { } } } + +subprojects.each { + Class kotlinCompile = null + try { + kotlinCompile = Class.forName("org.jetbrains.kotlin.gradle.tasks.KotlinCompile") + } catch (Throwable t) { + t.printStackTrace() + } + if (kotlinCompile != null) { + it.tasks.withType(kotlinCompile).configureEach { + kotlinOptions { + jvmTarget = '1.8' + freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"] + } + } + } +} \ No newline at end of file diff --git a/config.gradle b/config.gradle index 6a3e76a787..f99a5852dc 100644 --- a/config.gradle +++ b/config.gradle @@ -127,6 +127,7 @@ ext { // androidx-lifecycle-process androidxlifecycleprocess : "androidx.lifecycle:lifecycle-process:2.4.0", + androidxlifecycleservice : "androidx.lifecycle:lifecycle-service:2.4.0", // rxjava2 with room roomRxjava : 'androidx.room:room-rxjava2:2.2.3', circleimageview : "de.hdodenhof:circleimageview:3.0.1", diff --git a/core/function-impl/mogo-core-function-chat/.gitignore b/core/function-impl/mogo-core-function-chat/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/build.gradle b/core/function-impl/mogo-core-function-chat/build.gradle new file mode 100644 index 0000000000..b016d5a2a4 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/build.gradle @@ -0,0 +1,82 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'kotlin-android-extensions' + id 'kotlin-kapt' + id 'com.alibaba.arouter' +} +android { + compileSdkVersion rootProject.ext.android.compileSdkVersion + defaultConfig { + minSdkVersion rootProject.ext.android.minSdkVersion + targetSdkVersion rootProject.ext.android.targetSdkVersion + versionCode Integer.valueOf(VERSION_CODE) + versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles 'consumer-rules.pro' + //ARouter apt 参数 + kapt { + useBuildCache = false + arguments { + arg("AROUTER_MODULE_NAME", project.getName()) + } + } + + ndk { + abiFilters "armeabi-v7a", "arm64-v8a" + } + } + + sourceSets { + main { + jniLibs.srcDirs = ['libs'] + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation rootProject.ext.dependencies.androidxccorektx + implementation rootProject.ext.dependencies.androidxappcompat + implementation rootProject.ext.dependencies.arouter + implementation rootProject.ext.dependencies.rxandroid + compileOnly rootProject.ext.dependencies.aspectj + kapt rootProject.ext.dependencies.aroutercompiler + implementation rootProject.ext.dependencies.mogowebsocket + implementation rootProject.ext.dependencies.circleimageview + implementation rootProject.ext.dependencies.androidxconstraintlayout + implementation rootProject.ext.dependencies.androidxrecyclerview + + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { + implementation rootProject.ext.dependencies.modulecommon + implementation rootProject.ext.dependencies.moduleservice + implementation rootProject.ext.dependencies.mogo_core_data + implementation rootProject.ext.dependencies.mogo_core_utils + implementation rootProject.ext.dependencies.mogo_core_function_api + implementation rootProject.ext.dependencies.mogo_core_function_call + implementation rootProject.ext.dependencies.mogo_core_res + } else { + implementation project(':modules:mogo-module-common') + implementation project(':modules:mogo-module-service') + implementation project(':core:mogo-core-data') + implementation project(':core:mogo-core-utils') + implementation project(':core:mogo-core-function-api') + implementation project(':core:mogo-core-function-call') + implementation project(':core:mogo-core-res') + } +} + +apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/core/function-impl/mogo-core-function-chat/consumer-rules.pro b/core/function-impl/mogo-core-function-chat/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/core/function-impl/mogo-core-function-chat/gradle.properties b/core/function-impl/mogo-core-function-chat/gradle.properties new file mode 100644 index 0000000000..63866596d3 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/gradle.properties @@ -0,0 +1,3 @@ +GROUP=com.mogo.eagle.core.function.impl +POM_ARTIFACT_ID=v2x +VERSION_CODE=1 diff --git a/core/function-impl/mogo-core-function-chat/libs/arm64-v8a/libgmesdk.so b/core/function-impl/mogo-core-function-chat/libs/arm64-v8a/libgmesdk.so new file mode 100644 index 0000000000..b65f686af8 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/libs/arm64-v8a/libgmesdk.so differ diff --git a/core/function-impl/mogo-core-function-chat/libs/armeabi-v7a/libgmecodec.so b/core/function-impl/mogo-core-function-chat/libs/armeabi-v7a/libgmecodec.so new file mode 100644 index 0000000000..ef0012b4fd Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/libs/armeabi-v7a/libgmecodec.so differ diff --git a/core/function-impl/mogo-core-function-chat/libs/armeabi-v7a/libgmesdk.so b/core/function-impl/mogo-core-function-chat/libs/armeabi-v7a/libgmesdk.so new file mode 100644 index 0000000000..9bdb9f2e54 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/libs/armeabi-v7a/libgmesdk.so differ diff --git a/core/function-impl/mogo-core-function-chat/libs/gmesdk.jar b/core/function-impl/mogo-core-function-chat/libs/gmesdk.jar new file mode 100644 index 0000000000..ddafacefb7 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/libs/gmesdk.jar differ diff --git a/core/function-impl/mogo-core-function-chat/proguard-rules.pro b/core/function-impl/mogo-core-function-chat/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-chat/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..cd75fea39d --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/MoGoChatProvider.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/MoGoChatProvider.kt new file mode 100644 index 0000000000..ca37017785 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/MoGoChatProvider.kt @@ -0,0 +1,37 @@ +package com.mogo.eagle.core.function.chat + +import android.content.Context +import com.alibaba.android.arouter.facade.annotation.Route +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.IMoGoChatFacade +import com.mogo.eagle.core.function.chat.facade.MoGoChatFacade +import com.mogo.eagle.core.function.chat.facade.ui.CallChatWindowManager +import kotlinx.coroutines.ExperimentalCoroutinesApi + +@Route(path = ChatConsts.CHAT_PROVIDER_PATH) +class MoGoChatProvider: IMoGoChatProvider { + + private val facade by lazy { + MoGoChatFacade + } + + private val chatWindowManager by lazy { + CallChatWindowManager() + } + + override val functionName = "MoGoChatProvider" + + @OptIn(ExperimentalCoroutinesApi::class) + override fun init(context: Context?) { + facade.init(context) + chatWindowManager.init() + } + + override fun onDestroy() { + facade.onDestroy() + chatWindowManager.destroy() + } + + override fun chat(): IMoGoChatFacade = facade +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/MoGoChatFacade.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/MoGoChatFacade.kt new file mode 100644 index 0000000000..3a249b884c --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/MoGoChatFacade.kt @@ -0,0 +1,1140 @@ +package com.mogo.eagle.core.function.chat.facade + +import android.content.Context +import android.os.Handler +import android.os.Looper +import android.text.TextUtils +import com.google.gson.Gson +import com.mogo.eagle.core.function.chat.facade.gme.GMEApi +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.data.chat.UserInfo +import com.mogo.eagle.core.data.chat.socket.Message +import com.mogo.eagle.core.data.chat.socket.TeammateInfo +import com.mogo.eagle.core.function.api.chat.biz.* +import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_DEFAULT +import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VEHICLE_TEAM +import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE +import com.mogo.eagle.core.function.api.chat.biz.IMType.* +import com.mogo.eagle.core.function.chat.facade.analytics.ChatAnalyticsFacade +import com.mogo.eagle.core.function.chat.facade.audio.AudioFocusFacade +import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi +import com.mogo.eagle.core.function.chat.facade.consts.PUSH_MSG_AGREE_ENTER +import com.mogo.eagle.core.function.chat.facade.consts.PUSH_MSG_CREATE_ROOM +import com.mogo.eagle.core.function.chat.facade.consts.PUSH_MSG_DENY_ENTER +import com.mogo.eagle.core.function.chat.facade.consts.PUSH_MSG_HANG_UP +import com.mogo.eagle.core.function.chat.facade.gme.GmeState +import com.mogo.eagle.core.function.chat.facade.gme.GmeState.EnterRoomFail +import com.mogo.eagle.core.function.chat.facade.gme.GmeState.EnterRoomSuccess +import com.mogo.eagle.core.function.chat.facade.gme.GmeState.ExitRoomSuccess +import com.mogo.eagle.core.function.chat.facade.gme.GmeState.InitFail +import com.mogo.eagle.core.function.chat.facade.gme.GmeState.InitSuccess +import com.mogo.eagle.core.function.chat.facade.gme.GmeState.UserChangeInRoom +import com.mogo.eagle.core.function.chat.facade.media.MedialControlFacade +import com.mogo.eagle.core.function.chat.facade.net.ChatServiceModel +import com.mogo.eagle.core.function.chat.facade.net.bean.CallRequestParam +import com.mogo.eagle.core.function.chat.facade.net.bean.ConnectStatusParam +import com.mogo.eagle.core.function.chat.facade.socket.SocketConnectManager +import com.mogo.eagle.core.function.chat.facade.utils.log +import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade +import com.mogo.eagle.core.utilcode.kotlin.safeCancel +import com.mogo.eagle.core.utilcode.util.Utils +import kotlinx.coroutines.* +import kotlinx.coroutines.android.asCoroutineDispatcher +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.channels.Channel.Factory.RENDEZVOUS +import kotlinx.coroutines.flow.* +import kotlinx.coroutines.selects.select +import java.lang.ref.WeakReference +import java.util.concurrent.TimeUnit.SECONDS +import java.util.concurrent.atomic.AtomicBoolean +import java.util.concurrent.atomic.AtomicInteger +import java.util.concurrent.atomic.AtomicReference +import kotlin.properties.Delegates + +object MoGoChatFacade: IMoGoChatFacade { + + /** + * 是否初始化的标记 + */ + private val hasInit by lazy { AtomicBoolean(false) } + + private var contextHolder: WeakReference? = null + + /** + * SocketClient实例 + */ + private val client by lazy { + SocketConnectManager.instance() + } + + /** + * 车聊相关后台接口 + */ + private val serverApi by lazy { + ChatServiceModel() + } + + /** + * 负责处理长链接下行数据的管道 + */ + @ExperimentalCoroutinesApi + private var channel4SocketMsg : Channel = Channel(RENDEZVOUS) + @Synchronized + get() { + return if (field.isClosedForSend || field.isClosedForReceive) { + field = Channel(RENDEZVOUS) + field + } else { + field + } + } + + /** + * 负责处理GmeSdk的各种消息类型 + */ + @ExperimentalCoroutinesApi + private var channel4GmeState: Channel = Channel(RENDEZVOUS) + @Synchronized + get() { + return if (field.isClosedForReceive || field.isClosedForSend) { + field = Channel(RENDEZVOUS) + field + } else { + field + } + } + + private var onInComingCallback: WeakReference? = null + + private var onCallingInterrupt: WeakReference? = null + + private var roomId by Delegates.observable(0) { _, _, newValue -> + SocketConnectManager.setRoomId(newValue) + } + + private val openId by lazy { + AtomicReference() + } + + private val scopeIndex by lazy { + AtomicInteger(0) + } + + private var mainScope: CoroutineScope = acquireScope() + @Synchronized + get() { + if (field.isActive) { + return field + } + val scope = acquireScope() + field = scope + return field + } + + private fun acquireScope(): CoroutineScope { + return CoroutineScope(Handler(Looper.getMainLooper()).asCoroutineDispatcher("chat-service") + SupervisorJob() + CoroutineName("chat-service-${scopeIndex.getAndIncrement()}")) + } + + private var callStatus by Delegates.observable(INIT_CALL) { _, _, newValue -> + log(ChatConsts.TAG, "call-status: ${newValue.toText()}") + } + + @ExperimentalCoroutinesApi + private val gmeCallback: ((state: GmeState) -> Unit) = { state -> + mainScope.launch { + channel4GmeState.send(state) + } + } + + private var callType by Delegates.observable(CALL_TYPE_DEFAULT) { _, oldValue, newValue -> + log(ChatConsts.TAG, "call type change: oldValue: $oldValue - newValue: $newValue") + } + + private val sender by lazy { AtomicReference(null) } + private val receiver by lazy { AtomicReference(null) } + private val mySelf by lazy { AtomicReference(null) } + + @ExperimentalCoroutinesApi + internal fun init(context: Context?) { + BridgeApi.init(context) + context?.let { + contextHolder = WeakReference(it) + } + if (hasInit.compareAndSet(false, true)) { + initSocketService() + voice().register() + } + } + + private fun context(): Context = contextHolder?.get() ?: Utils.getApp() + + @ExperimentalCoroutinesApi + private fun initSocketService() { + log(ChatConsts.TAG, "-- initSocketService --") + SocketConnectManager.setOnMsgReceiveCb { + handleMessage(it) + } + SocketConnectManager.init() + } + + @ExperimentalCoroutinesApi + private fun handleMessage(msg: String) { + mainScope.launch { + log(ChatConsts.TAG, "长链下行消息: $msg") + val map = Gson().fromJson>(msg, Map::class.java) + val temp = map ?: return@launch + val msgType = temp["msgType"] + if (msgType != null && msgType is Double) { + when(val t = msgType.toInt()) { + 0 -> { + val openId = (temp["localUserId"] as? Double ?: return@launch).toInt().toString() + log(ChatConsts.TAG, "handleMessage --- openId:$openId") + //初始化房间 + GMEApi.init(context(), openId = openId, cb = gmeCallback) + } + else -> + log(ChatConsts.TAG, "handleMessage --- $t") + } + } else { + val message = withContext(Dispatchers.Default) { Gson().fromJson(msg, Message::class.java) } ?: return@launch + if (message.type.toCallType() == CALL_TYPE_VOICE && message.snSender == MoGoAiCloudClientConfig.getInstance().sn) { + return@launch + } + when(message.status) { + PUSH_MSG_AGREE_ENTER -> { + //接收者接受通话请求 + when(message.type.toCallType()) { + CALL_TYPE_VOICE -> { + if (GMEApi.isRoomEntered() && callType == CALL_TYPE_VEHICLE_TEAM) { + log(ChatConsts.TAG, "收到来电进房消息,此时正在车队通话。需要挂断电话") + try { + serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, message.snSender, message.roomId, PUSH_MSG_HANG_UP, message.type)) + } catch (t : Throwable) { + t.printStackTrace() + } + return@launch + } + callType = message.type.toCallType() + channel4SocketMsg.send(message) + } + CALL_TYPE_VEHICLE_TEAM -> { + if (callStatus.isReadyCalling()) { + try { + serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, message.snSender, message.roomId, PUSH_MSG_HANG_UP, message.type)) + } catch (t : Throwable) { + t.printStackTrace() + } + return@launch + } + callType = message.type.toCallType() + channel4SocketMsg.send(message) + } + else -> log(ChatConsts.TAG, "-- 接收者同意通话,但是呼叫类型不对: ${message.type}") + } + } + PUSH_MSG_DENY_ENTER -> { + //接收者拒绝通话请求 + when(message.type.toCallType()) { + CALL_TYPE_VOICE -> { + if (GMEApi.isRoomEntered() && callType == CALL_TYPE_VEHICLE_TEAM) { + log(ChatConsts.TAG, "已经进房,收到被拒绝消息,则不处理(为兼容车队需求),否则会引发退房操作") + return@launch + } + if (callStatus == READY_TO_CALL_RECEIVER && message.snReceiver == MoGoAiCloudClientConfig.getInstance().sn) { + //如果当前是来电状态,并且收到拒绝消息,说明呼叫方呼出又挂断 + log(ChatConsts.TAG, "呼叫方呼出后,又挂断") + onCallingInterrupt?.get()?.invoke(false, message.toUser()) + return@launch + } + callType = message.type.toCallType() + channel4SocketMsg.send(message) + } + CALL_TYPE_VEHICLE_TEAM -> { + if (callStatus == READY_TO_CALL_RECEIVER && message.snReceiver == MoGoAiCloudClientConfig.getInstance().sn) { + //如果当前是来电状态,并且收到拒绝消息,说明呼叫方呼出又挂断 + onCallingInterrupt?.get()?.invoke(true, message.toUser()) + callStatus = INIT_CALL + return@launch + } + callType = message.type.toCallType() + channel4SocketMsg.send(message) + } + else -> log(ChatConsts.TAG, "-- 接收者拒绝,但是呼叫类型不对: ${message.type}") + } + } + PUSH_MSG_HANG_UP -> { + callType = message.type.toCallType() + channel4SocketMsg.send(message) + } + PUSH_MSG_CREATE_ROOM -> { + //来电 + when(message.type.toCallType()) { + CALL_TYPE_VOICE, CALL_TYPE_VEHICLE_TEAM -> { + if (callStatus.isCalling()) { + //如果正在通话, 直接拒接 + try { + serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, message.snSender, message.roomId, PUSH_MSG_DENY_ENTER, message.type)) + } catch (t: Throwable) { + t.printStackTrace() + } + return@launch + } + val user = message.toUser() + onInComingCallback?.get()?.also { + it.invoke(callType.isTeam(), user) + callType = message.type.toCallType() + callStatus = READY_TO_CALL_RECEIVER + roomId = message.roomId + channel4SocketMsg.send(message) + } + } + else -> log(ChatConsts.TAG, "-- 收到来电,但是呼叫类型不对: ${message.type}") + } + } + } + } + } + } + + override fun onInComingCall(cb: (isTeam: Boolean, user: UserInfo) -> Unit) { + this.onInComingCallback = WeakReference(cb) + } + + override fun onCallingInterrupt(cb: (isTeam: Boolean, user: UserInfo) -> Unit) { + this.onCallingInterrupt = WeakReference(cb) + } + + @OptIn(ExperimentalCoroutinesApi::class) + override fun call(params: ChatParams): Flow { + return channelFlow { + send(CallState.Init) + if (callStatus != INIT_CALL) { + send(CallState.Error(CallState.CODE_CALL_STATE_ERROR, "[Call] - ${"呼叫状态不匹配,当前状态:${callStatus.toText()}"}")) + return@channelFlow + } + callStatus = READY_TO_CALL_SENDER + if (TextUtils.isEmpty(params.sn)) { + send(CallState.Error(CallState.CODE_CALL_PARAMS_INCOMPLETE, "[Call] - ${"请求参数缺少sn参数, 当前参数$params"}")) + return@channelFlow + } + if (GMEApi.isRoomEntered()) { + send(CallState.Error(CallState.CODE_USER_IN_ROOM, "[Call] - 当前用户已经进入房间了")) + return@channelFlow + } + if (params.sn == MoGoAiCloudClientConfig.getInstance().sn) { + send(CallState.Error(CallState.CODE_CALL_MYSELF, "[Call] - 不能呼叫自己")) + return@channelFlow + } + if (!client.isOpen) { + send(CallState.Error(CallState.CODE_CALL_SOCKET_DISCONNECT, "[Call] - 长链接已断开")) + return@channelFlow + } + val isOnline = try { + serverApi.isOnline(params.sn) + } catch (t: Throwable) { + false + } + if (!isOnline) { + send(CallState.Error(CallState.CODE_ANSWER_OFFLINE, "[Call] - 接收方不在线")) + return@channelFlow + } + if (mySelf.get() == null || mySelf.get().isIncomplete()) { + try { + val pair = serverApi.queryUserInfo(MoGoAiCloudClientConfig.getInstance().sn) + if (pair == null || pair.first != null || pair.second == null) { + send(CallState.Error(CallState.CODE_CALLER_USER_INFO_FAIL, "[Call] - 获取用户信息失败 - ${pair?.first?.msg}")) + return@channelFlow + } + mySelf.set(pair.second) + } catch (t: Throwable) { + send(CallState.Error(CallState.CODE_CALLER_USER_INFO_FAIL, t.message ?: "[Call] - 获取用户信息失败-未知异常")) + return@channelFlow + } + } + sender.set(mySelf.get()) + // 获取房间信息 + try { + val response = serverApi.requestRoomInfo(CallRequestParam().also { + it.snReceiver = params.sn + it.snSender = sender.get().sn + it.nickName = sender.get().name + it.headImgUrl = sender.get().icon + it.carInfo = sender.get().brand + it.type = CALL_TYPE_VOICE.type + }) + if (response.code != 0 && response.code != 200) { + send(CallState.Error(CallState.CODE_ROOM_INFO_FAIL, "[Call] - ${response.msg}", mutableMapOf().also { + it["code"] = response.code.toString() + it["msg"] = response.msg + })) + return@channelFlow + } + val roomInfo = response.result + if (roomInfo.roomId <= 0) { + send(CallState.Error(CallState.CODE_ROOM_INFO_FAIL, "[Call] - 服务端返回的房间ID不合法:roomId: ${roomInfo.roomId}")) + return@channelFlow + } + roomId = roomInfo.roomId + } catch (ex: Throwable) { + send(CallState.Error(CallState.CODE_ROOM_INFO_FAIL, "[Call] - 房间数据请求异常:$ex")) + return@channelFlow + } + //获取房间数据成功,等着对方响应 + client.startHeartBeat() + val teamMembers = AtomicReference>() + val d1 = mainScope.async { + val members = mutableListOf() + while (!channel4GmeState.isClosedForReceive) { + when(val state = channel4GmeState.receive()) { + is InitFail -> { + send(CallState.Error(CallState.CODE_GME_INIT_FAIL, "[Call] - GmeSdk初始化失败,Code: ${state.code}")) + return@async + } + is InitSuccess -> { + openId.set(state.openId) + continue + } + is EnterRoomFail -> { + send(CallState.Error(CallState.CODE_ENTER_ROOM_FAIL, "[Call] - 进入房间失败:code -> ${state.code} :: msg -> ${state.msg}")) + return@async + } + EnterRoomSuccess -> { + members += openId.get() + realEnterRoom() + callStatus = CALLING_SENDER + send(CallState.EnterRoomSuccess) + } + ExitRoomSuccess -> { + realExitRoom() + send(CallState.ExitRoomSuccess) + return@async + } + is UserChangeInRoom -> { + log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}") + if (!state.isEnter && state.left.isEmpty()) { + exitRoom() + continue + } + val newL = state.left + val subs = newL.subtract(members) + members.clear() + members += newL + val isMySelf = subs.isEmpty() || subs.contains(openId.get()) + if (state.isEnter) { + send(CallState.RoomMemberUpdate(isMySelf, true, teamMembers.get())) + } else { + send(CallState.RoomMemberUpdate(isMySelf, false, teamMembers.get())) + if (!callType.isTeam()) { + exitRoom() + } + } + } + } + } + } + val d2 = mainScope.async { + while (!channel4SocketMsg.isClosedForReceive) { + val msg = channel4SocketMsg.receive() + when(msg.status) { + PUSH_MSG_AGREE_ENTER -> { + //接收方同意进房 + log(ChatConsts.TAG, "[Call] - [Agree] - roomId: $roomId-msg: $msg") + if (roomId == msg.roomId) { + if (callType == CALL_TYPE_VOICE) { + send(CallState.AgreeCall(false, msg)) + enterRoom() + } else { + //接受车队邀请 + send(CallState.AgreeCall(true, msg)) + if (!GMEApi.isRoomEntered()) { + enterRoom() + } + } + } + } + PUSH_MSG_DENY_ENTER -> { + //接收方拒绝进房 + log(ChatConsts.TAG, "[Call] - [Refuse] - roomId: $roomId-msg: $msg") + if (roomId == msg.roomId) { + teamMembers.set(msg.teamMember ?: emptyList()) + if (callType == CALL_TYPE_VOICE) { + //拒绝通话邀请 + send(CallState.RefuseCall(false, msg)) + return@async + } + if (callType == CALL_TYPE_VEHICLE_TEAM) { + send(CallState.RefuseCall(true, msg)) + } + } + } + + PUSH_MSG_HANG_UP -> { + log(ChatConsts.TAG, "[Call] - [hangUp] - roomId: $roomId-msg: $msg") + teamMembers.set(msg.teamMember ?: emptyList()) + if (callType == CALL_TYPE_VOICE) { + send(CallState.HangUp(false, msg)) + exitRoom() + } else { + //车除成员有挂断的情况 + send(CallState.HangUp(true, msg)) + } + } + } + } + } + val state = select { + d1.onAwait { 1 } + d2.onAwait { 2 } + } + when(state) { + 1 -> { + d2.safeCancel() + } + 2 -> { + d1.safeCancel() + } + } + }.catch { + log(ChatConsts.TAG, "unknow exption:$it") + emit(CallState.Error(CallState.CODE_UNKNOWN_ERROR, "[Call] - ${it.message ?: "未知异常"}")) + }.onCompletion { + resetState() + } + } + + private fun enableAudio() { + GMEApi.enableAudio() + } + + private fun disableAudio() { + GMEApi.disableAudio() + } + + /** + * 进入房间 + * @param roomId: 服务端分配的房间id + */ + private fun enterRoom() { + if (GMEApi.isRoomEntered()) { + return + } + GMEApi.enterRoom(roomId.toString()) + } + + /** + * 退房执行的动作 + * @param duration: 超时时长 + * @param unit: 时间单位 + * @param block: 超时后执行的行为 + */ + private fun exitRoom() { + if (!GMEApi.isRoomEntered()) { + return + } + GMEApi.exitRoom() + } + + @ExperimentalCoroutinesApi + private fun realExitRoom() { + disableAudio() + resetState() + } + + private fun realEnterRoom() { + enableAudio() + } + + override fun canCall(): Boolean = client.isOpen && callStatus.isInit() + + override fun canAnswer(): Boolean = client.isOpen && callStatus == READY_TO_CALL_RECEIVER + + @OptIn(ExperimentalCoroutinesApi::class) + override fun answer(sn: String): Flow { + return channelFlow { + send(AnswerState.Init) + if (callStatus != READY_TO_CALL_RECEIVER) { + send(AnswerState.Error(AnswerState.CODE_ANSWER_STATE_ERROR, "[Answer] - 应答状态错误 -> 当前状态:${callStatus.toText()}")) + return@channelFlow + } + val mySn = MoGoAiCloudClientConfig.getInstance().sn + if (TextUtils.isEmpty(mySn)) { + send(AnswerState.Error(AnswerState.CODE_ANSWER_PARAMS_INCOMPLETE, "[Answer] - 当前用户/应答方- sn参数不存在")) + return@channelFlow + } + if (!client.isOpen) { + send(AnswerState.Error(AnswerState.CODE_ANSWER_SOCKET_DISCONNECT, "[Answer] - 当前车机长链接断开")) + return@channelFlow + } + if (mySelf.get() == null || mySelf.get().isIncomplete()) { + try { + val pair = serverApi.queryUserInfo(MoGoAiCloudClientConfig.getInstance().sn) + if (pair == null || pair.first != null || pair.second == null) { + send(AnswerState.Error(AnswerState.CODE_CALLER_USER_INFO_FAIL, "[Answer] - 获取应答方用户信息失败")) + return@channelFlow + } + mySelf.set(pair.second) + } catch (t: Throwable) { + send(AnswerState.Error(AnswerState.CODE_CALLER_USER_INFO_FAIL, t.message ?: "[Answer] - 获取用户信息失败-未知异常")) + return@channelFlow + } + } + //告之服务器给发送方下发接收通话消息 + try { + val location = BridgeApi.locationClient()?.lastKnowLocation + val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VOICE.type).also { + it.nickName = mySelf.get().name + it.headImgUrl = mySelf.get().icon + it.carInfo = mySelf.get().brand + it.cardIdAge = mySelf.get().age + it.cardIdSex = mySelf.get().sex + it.cityName = mySelf.get().city + it.lat = location?.latitude ?: 0.0 + it.lon = location?.longitude ?: 0.0 + }) + if (response.code != 0 && response.code != 200) { + send(AnswerState.Error(AnswerState.CODE_ANSWER_API_REQ_FAIL, "[Answer] - ${response.msg}", mutableMapOf().also { + it["code"] = response.code.toString() + it["msg"] = response.msg + })) + return@channelFlow + } + } catch (t: Throwable) { + send(AnswerState.Error(AnswerState.CODE_ANSWER_API_REQ_FAIL, "[Answer] - ${t.message ?: "同步应答状态接口异常:$t"}")) + return@channelFlow + } + val teamMembers = AtomicReference>() + client.startHeartBeat() + enterRoom() + //成功 + val d1 = mainScope.async { + while (!channel4SocketMsg.isClosedForReceive) { + val msg = channel4SocketMsg.receive() + when(msg.status) { + PUSH_MSG_HANG_UP -> { + log(ChatConsts.TAG, "[Answer] - [hangUp] - msg -> $msg") + if (callType == CALL_TYPE_VOICE) { + send(AnswerState.HangUp(false, msg)) + exitRoom() + } else { + //车除成员有挂断的情况 + send(AnswerState.HangUp(true, msg)) + teamMembers.set(msg.teamMember ?: emptyList()) + } + } + PUSH_MSG_AGREE_ENTER -> { + log(ChatConsts.TAG, "[Answer] - [Agree] - msg -> $msg") + if (callType.isTeam()) { + //接受车队邀请 + log(ChatConsts.TAG, "[Answer] - [Agree] - [Team] - msg -> $msg") + send(AnswerState.AcceptTeamInvite(msg)) + teamMembers.set(msg.teamMember) + } + } + PUSH_MSG_DENY_ENTER -> { + log(ChatConsts.TAG, "[Answer] - [hangUp] - msg -> $msg") + if (callType.isTeam()) { + log(ChatConsts.TAG, "[Answer] - [hangUp] - [Team] - msg -> $msg") + send(AnswerState.RefuseTeamInvite(msg)) + teamMembers.set(msg.teamMember) + } + } + } + } + } + val d2 = mainScope.async { + val members = mutableListOf() + while (!channel4GmeState.isClosedForReceive) { + when(val state = channel4GmeState.receive()) { + is InitFail -> { + send(AnswerState.Error(AnswerState.CODE_GME_INIT_FAIL, "[Answer] - GmeSdk初始化失败")) + return@async + } + is InitSuccess -> { + openId.set(state.openId) + continue + } + is EnterRoomSuccess -> { + members += openId.get() + callStatus = CALLING_RECEIVER + realEnterRoom() + send(AnswerState.EnterRoomSuccess) + } + is EnterRoomFail -> { + send(AnswerState.Error(AnswerState.CODE_ANSWER_EXIT_ROOM_FAIL, "[Answer] - 应答者退房失败: code : ${state.code} - msg : ${state.msg}")) + return@async + } + ExitRoomSuccess -> { + send(AnswerState.ExitRoomSuccess) + realExitRoom() + return@async + } + is UserChangeInRoom -> { + log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}") + if (!state.isEnter && state.left.isEmpty()) { + exitRoom() + continue + } + val newL = state.left + val subs = newL.subtract(members) + members.clear() + members += newL + val isMySelf = subs.isEmpty() || subs.contains(openId.get()) + if (state.isEnter) { + send(AnswerState.RoomMemberUpdate(isMySelf, true, teamMembers.get())) + } else { + send(AnswerState.RoomMemberUpdate(isMySelf, false, teamMembers.get())) + if (!callType.isTeam()) { + exitRoom() + } + } + } + } + } + } + val state = select { + d1.onAwait { 1 } + d2.onAwait { 2 } + } + when (state) { + 1 -> { + d2.safeCancel() + } + 2 -> { + d1.safeCancel() + } + } + }.catch { + log(ChatConsts.TAG, "unknow exption:$it") + emit(AnswerState.Error(AnswerState.CODE_UNKNOWN_ERROR, it.message ?: "未知异常")) + }.onCompletion { + resetState() + } + } + + @OptIn(ExperimentalCoroutinesApi::class) + override fun handUp(sn: String): Flow { + return flow { + emit(HangUpState.Init) + if (!callStatus.isCalling()) { + emit(HangUpState.Error(HangUpState.CODE_HANG_UP_STATE_ERROR, "[HangUp] - 当前通话状态不匹配")) + return@flow + } + if (!GMEApi.isRoomEntered()) { + emit(HangUpState.Error(HangUpState.CODE_HANG_UP_NOT_IN_ROOM, "[HangUp] - 当前用户尚未进入房间")) + return@flow + } + try { + val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_HANG_UP, callType.type)) + val code = response.code + if (code != 0 && code != 200) { + emit(HangUpState.Error(HangUpState.CODE_HANG_UP_API_ERROR, response.msg, mutableMapOf().also { + it["code"] = code.toString() + it["msg"] = response.msg + })) + return@flow + } + emit(HangUpState.Success) + exitRoom() + } catch (t: Throwable) { + emit(HangUpState.Error(HangUpState.CODE_HANG_UP_API_ERROR, "[HangUp] - ${t.message ?: "接口请求异常"}")) + } + }.catch { + emit(HangUpState.Error(HangUpState.CODE_UNKNOWN_ERROR, "[HangUp] - ${it.message ?: "未知错误"}")) + } + } + + @OptIn(ExperimentalCoroutinesApi::class) + override fun refuse(sn: String): Flow { + return flow { + emit(RefuseState.Init) + if (!callStatus.isReadyCalling()) { + emit(RefuseState.Error(RefuseState.CODE_REFUSE_STATE_ERROR, "[Refuse] - 当前不是来电状态或者呼出状态,不能执行拒绝操作")) + return@flow + } + try { + val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, 0, PUSH_MSG_DENY_ENTER, callType.type)) + val code = response.code + if (code != 0 && code != 200) { + emit(RefuseState.Error(RefuseState.CODE_REFUSE_API_ERROR, response.msg, mutableMapOf().also { + it["code"] = code.toString() + it["msg"] = response.msg + })) + return@flow + } + emit(RefuseState.Success) + } catch (t: Throwable) { + emit(RefuseState.Error(RefuseState.CODE_REFUSE_API_ERROR, "[Refuse] - ${t.message ?: "接口请求异常"}")) + } + }.catch { + emit(RefuseState.Error(RefuseState.CODE_UNKNOWN_ERROR, "[Refuse] - ${it.message ?: "未知错误"}")) + } + } + + @OptIn(ExperimentalCoroutinesApi::class) + override fun inviteJoinVehicleTeam(sn: String): Flow { + return channelFlow { + send(InviteState.Init) + if (callStatus.isCalling() && GMEApi.isRoomEntered() && !callType.isTeam()) { + send(InviteState.Error(InviteState.CODE_INVITE_STATE_ERROR, "[InviteTeam] - 当前正在语音通话")) + return@channelFlow + } + val mySn = MoGoAiCloudClientConfig.getInstance().sn + if (TextUtils.isEmpty(mySn)){ + send(InviteState.Error(InviteState.CODE_INVITE_SN_NOT_IN, "[InviteTeam] - 当前车机sn不存在")) + return@channelFlow + } + if (mySn == sn) { + send(InviteState.Error(InviteState.CODE_INVITE_TO_MYSELF, "[InviteTeam] - 不能邀请自己")) + return@channelFlow + } + val isOnline = try { + serverApi.isOnline(sn) + } catch (t: Throwable) { + false + } + if (!isOnline) { + send(InviteState.Error(InviteState.CODE_INVITEE_OFFLINE, "[InviteTeam] - 被邀请方不在线")) + return@channelFlow + } + if (mySelf.get() == null || mySelf.get().isIncomplete()) { + try { + val pair = serverApi.queryUserInfo(mySn) + if (pair == null || pair.first != null || pair.second == null) { + send(InviteState.Error(InviteState.CODE_INVITE_USR_REQ_ERROR, "[InviteTeam] - 当前车机请求用户信息失败: msg-> ${pair?.first}")) + return@channelFlow + } + mySelf.set(pair.second) + } catch (t: Throwable) { + send(InviteState.Error(InviteState.CODE_INVITE_USR_REQ_ERROR, "[InviteTeam] - ${t.message ?: "请求用户信息接口失败 - 未知异常"}")) + return@channelFlow + } + } + val response = serverApi.inviteJoinVehicleTeam(CallRequestParam().also { + val user = mySelf.get() + val location = BridgeApi.locationClient()?.lastKnowLocation + it.snSender = mySn + it.snReceiver = sn + it.nickName = user.name + it.headImgUrl = user.icon + it.carInfo = user.brand + it.lat = location?.latitude ?: 0.0 + it.lon = location?.longitude ?: 0.0 + }) + val code = response.code + if (code != 0 && code != 200) { + send(InviteState.Error(InviteState.CODE_INVITE_API_ERROR, response.msg, mutableMapOf().also { + it["code"] = code.toString() + it["msg"] = response.msg + })) + return@channelFlow + } + if (GMEApi.isRoomEntered() && callStatus.isCalling()) { + send(InviteState.EnterRoomSuccess) + } + val teamMembers = AtomicReference>() + val d1 = mainScope.async { + while (!channel4SocketMsg.isClosedForReceive) { + val msg = channel4SocketMsg.receive() + when(msg.status) { + PUSH_MSG_AGREE_ENTER -> { + if (msg.type.toCallType().isTeam()) { + teamMembers.set(msg.teamMember ?: emptyList()) + if (!GMEApi.isRoomEntered()) { + enterRoom() + } + } + } + PUSH_MSG_DENY_ENTER -> { + if (msg.type.toCallType().isTeam()) { + teamMembers.set(msg.teamMember ?: emptyList()) + send(InviteState.Refused) + } + } + } + } + } + val d2 = mainScope.async { + val members = mutableListOf() + while (!channel4GmeState.isClosedForReceive) { + if (!callType.isTeam()) { + delay(SECONDS.toMillis(1)) + continue + } + when(val state = channel4GmeState.receive()) { + is InitFail -> { + send(InviteState.Error(InviteState.CODE_GME_INIT_FAIL, "[InviteTeam] - GmeSdk初始化失败,Code: ${state.code}")) + return@async + } + is InitSuccess -> { + openId.set(state.openId) + continue + } + is EnterRoomFail -> { + send(InviteState.Error(InviteState.CODE_ENTER_ROOM_FAIL, "[InviteTeam] - 进入房间失败:code -> ${state.code} :: msg -> ${state.msg}")) + return@async + } + EnterRoomSuccess -> { + members += openId.get() + callStatus = CALLING_SENDER + send(InviteState.EnterRoomSuccess) + } + ExitRoomSuccess -> { + realExitRoom() + send(InviteState.ExitRoomSuccess) + return@async + } + is UserChangeInRoom -> { + log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}") + if (!state.isEnter && state.left.isEmpty()) { + exitRoom() + continue + } + val newL = state.left + val subs = newL.subtract(members) + members.clear() + members += newL + val isMySelf = subs.isEmpty() || subs.contains(openId.get()) + if (state.isEnter) { + send(InviteState.RoomMemberUpdate(isMySelf, true, teamMembers.get())) + } else { + send(InviteState.RoomMemberUpdate(isMySelf, false, teamMembers.get())) + } + } + } + } + } + val state = select { + d1.onAwait { 1 } + d2.onAwait { 2 } + } + when(state) { + 1 -> { + d2.safeCancel() + } + 2 -> { + d1.safeCancel() + } + } + }.catch { + emit(InviteState.Error(InviteState.CODE_UNKNOWN_ERROR, it.message ?: "未知错误")) + } + } + + @OptIn(ExperimentalCoroutinesApi::class) + override fun joinVehicleTeam(sn: String): Flow { + return channelFlow { + send(JoinState.Init) + if (callStatus != READY_TO_CALL_RECEIVER) { + send(JoinState.Error(JoinState.CODE_INVITE_STATE_ERROR, "[JoinTeam]-当前车机不是来电状态: status -> ${callStatus.toText()}")) + return@channelFlow + } + val mySn = MoGoAiCloudClientConfig.getInstance().sn + if (TextUtils.isEmpty(mySn)){ + send(JoinState.Error(JoinState.CODE_JOIN_SN_NOT_IN, "[JoinTeam] - 当前车机sn不存在")) + return@channelFlow + } + if (mySn == sn) { + send(JoinState.Error(JoinState.CODE_JOIN_TO_MYSELF, "[JoinTeam] - 不能自己加入自己")) + return@channelFlow + } + if (!client.isOpen) { + send(JoinState.Error(JoinState.CODE_INVITE_STATE_SOCKET_DISCONNECT, "[JoinTeam] - 当前车机长链接断开")) + return@channelFlow + } + if (mySelf.get() == null || mySelf.get().isIncomplete()) { + try { + val pair = serverApi.queryUserInfo(MoGoAiCloudClientConfig.getInstance().sn) + if (pair == null || pair.first != null || pair.second == null) { + send(JoinState.Error(JoinState.CODE_CALLER_USER_INFO_FAIL, "[JoinTeam] - 获取呼叫方用户信息失败")) + return@channelFlow + } + mySelf.set(pair.second) + } catch (t: Throwable) { + send(JoinState.Error(JoinState.CODE_CALLER_USER_INFO_FAIL, "[JoinTeam] - ${t.message ?: "获取呼叫方用户信息失败 - 未知异常"}")) + return@channelFlow + } + + } + //告之服务器给发送方下发接收通话消息 + try { + val location = BridgeApi.locationClient()?.lastKnowLocation + val response = serverApi.requestConnectStatus(ConnectStatusParam(MoGoAiCloudClientConfig.getInstance().sn, sn, roomId, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VEHICLE_TEAM.type).also { + it.nickName = mySelf.get().name + it.headImgUrl = mySelf.get().icon + it.carInfo = mySelf.get().brand + it.cardIdAge = mySelf.get().age + it.cardIdSex = mySelf.get().sex + it.cityName = mySelf.get().city + it.lat = location?.latitude ?: 0.0 + it.lon = location?.longitude ?: 0.0 + }) + if (response.code != 0 && response.code != 200) { + send(JoinState.Error(AnswerState.CODE_ANSWER_API_REQ_FAIL, "[JoinTeam] - ${response.msg}", mutableMapOf().also { + it["code"] = response.code.toString() + it["msg"] = response.msg + })) + return@channelFlow + } + } catch (t: Throwable) { + send(JoinState.Error(AnswerState.CODE_ANSWER_API_REQ_FAIL, "[JoinTeam] - ${t.message ?: "同步应答状态接口异常:$t"}")) + return@channelFlow + } + //成功 + val teamMembers = AtomicReference>() + enterRoom() + client.startHeartBeat() + val d1 = mainScope.async { + while (!channel4SocketMsg.isClosedForReceive) { + val msg = channel4SocketMsg.receive() + if (!callType.isTeam()) { + delay(SECONDS.toMillis(1)) + continue + } + when(msg.status) { + PUSH_MSG_HANG_UP -> { + log(ChatConsts.TAG, "[JoinTeam] - [hangUp] - msg -> $msg") + teamMembers.set(msg.teamMember ?: emptyList()) + } + PUSH_MSG_AGREE_ENTER -> { + log(ChatConsts.TAG, "[JoinTeam] - [Agree] - msg -> $msg") + teamMembers.set(msg.teamMember ?: emptyList()) + } + PUSH_MSG_DENY_ENTER -> { + log(ChatConsts.TAG, "[JoinTeam] - [Deny] - msg -> $msg") + teamMembers.set(msg.teamMember ?: emptyList()) + } + } + } + } + + val d2 = mainScope.async { + val members = mutableListOf() + while (!channel4GmeState.isClosedForReceive) { + if (!callType.isTeam()) { + delay(SECONDS.toMillis(1)) + continue + } + when(val state = channel4GmeState.receive()) { + is InitFail -> { + send(JoinState.Error(JoinState.CODE_GME_INIT_FAIL, "[JoinTeam] - GmeSdk初始化失败")) + return@async + } + is InitSuccess -> { + openId.set(state.openId) + continue + } + is EnterRoomSuccess -> { + members += openId.get() + callStatus = CALLING_RECEIVER + realEnterRoom() + send(JoinState.EnterRoomSuccess) + } + is EnterRoomFail -> { + send(JoinState.Error(JoinState.CODE_ENTER_ROOM_FAIL, "[JoinTeam] - 进入房间失败:code: ${state.code} - msg: ${state.msg}")) + return@async + } + ExitRoomSuccess -> { + realExitRoom() + send(JoinState.ExitRoomSuccess) + return@async + } + is UserChangeInRoom -> { + log(ChatConsts.TAG, "openIds: ${state.left.joinToString(",")}") + if (!state.isEnter && state.left.isEmpty()) { + exitRoom() + continue + } + val newL = state.left + val subs = newL.subtract(members) + members.clear() + members += newL + val isMySelf = subs.isEmpty() || subs.contains(openId.get()) + if (state.isEnter) { + send(JoinState.RoomMemberUpdate(isMySelf, true, teamMembers.get())) + } else { + send(JoinState.RoomMemberUpdate(isMySelf, false, teamMembers.get())) + } + } + } + } + } + val state = select { + d1.onAwait { 1 } + d2.onAwait { 2 } + } + when(state) { + 1 -> { + d2.safeCancel() + } + 2 -> { + d1.safeCancel() + } + } + }.catch { + emit(JoinState.Error(JoinState.CODE_UNKNOWN_ERROR, it.message ?: "未知错误")) + } + } + + @ExperimentalCoroutinesApi + private fun resetState() { + callStatus = INIT_CALL + callType = CALL_TYPE_DEFAULT + try { + client.stopHeartBeat() + } catch (t: Throwable) { + log(ChatConsts.TAG, "$t") + } + channel4GmeState.safeCancel() + channel4SocketMsg.safeCancel() + sender.set(null) + receiver.set(null) + roomId = 0 + } + + override fun muteVoice(mute: Boolean) { + GMEApi.muteVoice(mute) + } + + override fun audioFocus(): IMoGoAudioFocusFacade = AudioFocusFacade + + override fun voice(): IMoGoVoiceControlFacade = VoiceControlFacade + + override fun media(): IMoGoMediaFacade = MedialControlFacade + + override fun analytics(): IMoGoAnalyticsFacade = ChatAnalyticsFacade + + fun onDestroy() { + if (!hasInit.get()) { + return + } + hasInit.set(false) + voice().unRegister() + GMEApi.unInit() + mainScope.safeCancel() + SocketConnectManager.destroy() + } +} + +private fun Int.toCallType(): IMCallType { + return when(this) { + 0 -> CALL_TYPE_VOICE + 3 -> CALL_TYPE_VEHICLE_TEAM + else -> CALL_TYPE_DEFAULT + } +} + +private fun Message.toUser(): UserInfo = UserInfo().also { + it.sn = this.snSender + it.name = this.nickName + it.icon = this.headImgUrl + it.age = this.cardIdAge + it.brand = this.carInfo + it.city = this.cityName + it.sex = this.cardIdSex + it.lat = this.lat + it.lon = this.lon +} + +typealias OnInComingCallback = (isTeam: Boolean, user: UserInfo) -> Unit + +typealias OnCallingInterrupt = (isTeam: Boolean, user: UserInfo) -> Unit diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/analytics/ChatAnalyticsEvents.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/analytics/ChatAnalyticsEvents.kt new file mode 100644 index 0000000000..7a02105507 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/analytics/ChatAnalyticsEvents.kt @@ -0,0 +1,17 @@ +package com.mogo.eagle.core.function.chat.facade.analytics + + +object ChatAnalyticsEvents { + + const val INVOKE_TRACK_REQUEST_CALL_SHOW = "carchat_requestcall_card_show" + const val INVOKE_TRACK_REQUEST_CALL = "carchat_cardetail_click" + const val INVOKE_TRACK_REFUSE = "carchat_refuse_card_show" + const val INVOKE_TRACK_CHATTING = "carchat_phoneing_card_show" + const val INVOKE_TRACK_MATCH_SHOW = "carchat_carphonecall_match_show" + const val INVOKE_TRACK_MATCH_FAIL_CLOSE_CLICK = "carchat_match_fail_close_click" + + const val MATCH_TYPE_MANUAL = 1 + const val MATCH_TYPE_VOICE = 2 + +} + diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/analytics/ChatAnalyticsFacade.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/analytics/ChatAnalyticsFacade.kt new file mode 100644 index 0000000000..33aae26880 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/analytics/ChatAnalyticsFacade.kt @@ -0,0 +1,11 @@ +package com.mogo.eagle.core.function.chat.facade.analytics + +import com.mogo.eagle.core.function.api.chat.biz.IMoGoAnalyticsFacade +import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi + +object ChatAnalyticsFacade: IMoGoAnalyticsFacade { + + override fun track(eventType: String, data: Map?) { + BridgeApi.analytics()?.track(eventType, data) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/BaseAspectj.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/BaseAspectj.kt new file mode 100644 index 0000000000..032eefd2eb --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/BaseAspectj.kt @@ -0,0 +1,73 @@ +package com.mogo.eagle.core.function.chat.facade.aop + +import android.os.Looper +import android.util.Log +import com.mogo.commons.debug.DebugConfig +import org.aspectj.lang.ProceedingJoinPoint +import org.aspectj.lang.reflect.CodeSignature +import org.aspectj.lang.reflect.MethodSignature + +open class BaseAspectj { + + companion object { + @Volatile + private var enable: Boolean = DebugConfig.isDebug() + } + + fun enterMethod(joinPoint: ProceedingJoinPoint) { + if (!enable) return + + val signature = joinPoint.signature as CodeSignature + val cls = signature.declaringType + val methodName = signature.name + val parameterNames = signature.parameterNames + val parameterValues = joinPoint.args + + val builder = StringBuilder("\u21E2 ") + builder.append(methodName).append('(') + parameterValues.forEachIndexed { index, _ -> + if (index > 0) { + builder.append(",") + } + builder.append(parameterNames[index]).append('=') + builder.append(parameterValues[index]) + } + builder.append(')') + + if (Looper.myLooper() != Looper.getMainLooper()) { + builder.append("[Thread:\"").append(Thread.currentThread().name).append("\"]") + } + Log.i(asTag(cls), builder.toString()) + } + + fun exitMethod(joinPoint: ProceedingJoinPoint, result: Any?, lengthMill: Long) { + if (!enable) return + + val signature = joinPoint.signature + val cls = signature.declaringType + val methodName = signature.name + val hasReturnType = signature is MethodSignature + && signature.returnType != Void.TYPE + + val builder = StringBuilder("\u21E0 ") + .append(methodName) + .append("[") + .append(lengthMill) + .append("ms]") + + if (hasReturnType) { + builder.append(" = ") + builder.append(result.let { + result.toString() + }) + } + Log.i(asTag(cls), builder.toString()) + } + + private fun asTag(cls: Class<*>): String { + if (cls.isAnonymousClass) { + return asTag(cls.enclosingClass!!) + } + return cls.simpleName + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/DebugLog.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/DebugLog.kt new file mode 100644 index 0000000000..85dbbbb6d7 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/DebugLog.kt @@ -0,0 +1,5 @@ +package com.mogo.eagle.core.function.chat.facade.aop + +@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR) +@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) +annotation class DebugLog \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/LogAspectj.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/LogAspectj.kt new file mode 100644 index 0000000000..6b75cc9d7a --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/aop/LogAspectj.kt @@ -0,0 +1,42 @@ +package com.mogo.eagle.core.function.chat.facade.aop + +import org.aspectj.lang.ProceedingJoinPoint +import org.aspectj.lang.annotation.Around +import org.aspectj.lang.annotation.Aspect +import org.aspectj.lang.annotation.Pointcut +import java.util.concurrent.TimeUnit + +@Aspect +class LogAspectj : BaseAspectj() { + + + @Pointcut("within(@com.mogo.eagle.core.function.chat.facade.aop.DebugLog *)") + fun withinAnnotatedClass() { + } + + @Pointcut("execution(!synthetic * *(..))&& withinAnnotatedClass()") + fun methodInsideAnnotatedType() { + } + + @Pointcut("execution(!synthetic *.new(..))&& withinAnnotatedClass()") + fun constructorInsideAnnotatedType() { + } + + @Pointcut("execution(@com.mogo.eagle.core.function.chat.facade.aop.DebugLog * *(..))|| methodInsideAnnotatedType()") + fun method() { + } + + @Pointcut("execution(@com.mogo.eagle.core.function.chat.facade.aop.DebugLog *.new(..))|| constructorInsideAnnotatedType()") + fun constructor() { + } + + @Around("method() || constructor()") + fun logExecute(joinPoint: ProceedingJoinPoint) { + enterMethod(joinPoint) + val startNanos = System.nanoTime() + val result = joinPoint.proceed() + val stopNanos = System.nanoTime() + val lengthMill = TimeUnit.NANOSECONDS.toMillis(stopNanos - startNanos) + exitMethod(joinPoint, result, lengthMill) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/audio/AudioFocusFacade.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/audio/AudioFocusFacade.kt new file mode 100644 index 0000000000..68e8cb5573 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/audio/AudioFocusFacade.kt @@ -0,0 +1,115 @@ +package com.mogo.eagle.core.function.chat.facade.audio + +import android.content.Context +import android.media.AudioAttributes +import android.media.AudioFocusRequest +import android.media.AudioManager +import android.media.AudioManager.OnAudioFocusChangeListener +import android.os.Build +import android.os.Handler +import android.os.Looper +import com.mogo.eagle.core.function.api.chat.biz.ChatConsts +import com.mogo.eagle.core.function.api.chat.biz.IMoGoAudioFocusFacade +import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi +import com.mogo.eagle.core.function.chat.facade.utils.log +import kotlinx.coroutines.* +import kotlinx.coroutines.android.asCoroutineDispatcher +import java.util.concurrent.TimeUnit.SECONDS +import java.util.concurrent.atomic.AtomicReference + +object AudioFocusFacade: IMoGoAudioFocusFacade { + + + private val audioListener: MyAudioFocusChangeListener by lazy { + MyAudioFocusChangeListener() + } + + private val audioManager: AudioManager by lazy { + BridgeApi.context().getSystemService(Context.AUDIO_SERVICE) as AudioManager + } + + private var audioFocusRequest: Any? = null + + private val scope by lazy { + CoroutineScope(Handler(Looper.getMainLooper()).asCoroutineDispatcher() + SupervisorJob()) + } + + private val focusJob by lazy { AtomicReference() } + + @Volatile + private var hasAudioFocus = false + + override fun requireAudioFocus(onGetFocus: () -> Unit) { + log(ChatConsts.TAG, "requireDuck===$hasAudioFocus") + scope.launch { + if (!hasAudioFocus) { + while (true) { + try { + val res = audioManager.let { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { + it.requestAudioFocus(audioListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT) + } else { + val audioFocusRequest = + AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT) + .setAcceptsDelayedFocusGain(true) + .setAudioAttributes( + AudioAttributes.Builder() + .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) + .build()) + .setOnAudioFocusChangeListener(audioListener).build() + this@AudioFocusFacade.audioFocusRequest = audioFocusRequest + it.requestAudioFocus(audioFocusRequest) + } + } + if (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { + hasAudioFocus = true + onGetFocus.invoke() + break + } + } catch (e: Exception) { + e.printStackTrace() + } finally { + delay(SECONDS.toMillis(1)) + } + } + } else { + onGetFocus.invoke() + } + }.also { focusJob.set(it) } + } + + override fun releaseAudioFocus() { + log(ChatConsts.TAG, "releaseDuck===$hasAudioFocus") + focusJob.get()?.takeIf { it.isActive }?.cancel() + scope.launch { + if (hasAudioFocus) { + hasAudioFocus = false + try { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { + audioManager.abandonAudioFocus(audioListener) + } else { + (audioFocusRequest as? AudioFocusRequest)?.also { + audioManager.abandonAudioFocusRequest(it) + } + } + } catch (e: Exception) { + e.printStackTrace() + } + } + } + } + + private class MyAudioFocusChangeListener : OnAudioFocusChangeListener { + override fun onAudioFocusChange(focusChange: Int) { + log(ChatConsts.TAG, "onAudioFocusChange: $focusChange") + when (focusChange) { + AudioManager.AUDIOFOCUS_GAIN -> { + hasAudioFocus = true + } + AudioManager.AUDIOFOCUS_LOSS, + AudioManager.AUDIOFOCUS_LOSS_TRANSIENT, + AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> hasAudioFocus = false + } + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/bridge/BridgeApi.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/bridge/BridgeApi.kt new file mode 100644 index 0000000000..14e2a87d78 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/bridge/BridgeApi.kt @@ -0,0 +1,35 @@ +package com.mogo.eagle.core.function.chat.facade.bridge + +import android.content.Context +import com.mogo.eagle.core.utilcode.util.Utils +import com.mogo.module.common.MogoApisHandler +import java.lang.ref.WeakReference + +internal object BridgeApi { + + private var contextHolder: WeakReference? = null + + private val apis by lazy { + MogoApisHandler.getInstance().apis + } + + internal fun init(context: Context?) { + context?.let { + contextHolder = WeakReference(context) + } + } + + internal fun context(): Context = contextHolder?.get() ?: Utils.getApp() + + internal fun locationClient() = apis?.mapServiceApi?.getSingletonLocationClient(context()) + + internal fun intentManager() = apis?.intentManagerApi + + internal fun statusManager() = apis?.statusManagerApi + + internal fun analytics() = apis?.analyticsApi + + internal fun topViewManager() = apis?.topViewManager + + internal fun floatViewManager() = apis?.windowManagerApi +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/consts/Consts.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/consts/Consts.kt new file mode 100644 index 0000000000..aa3480e8fa --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/consts/Consts.kt @@ -0,0 +1,79 @@ +package com.mogo.eagle.core.function.chat.facade.consts + +import com.mogo.commons.debug.DebugConfig + +//WebSocket发送数据相关 +const val SOCKET_HAND_SHAKE = 0 +const val SOCKET_HEART_BEAT = 1 + +// 与相关接口复用 +/** + * 服务端下发消息状态为0存在三种场景: + * 1.语音聊天创建房间成功,给拨打方发送创建房间消息。 + * 2.有匹配过的车机,表示愿意聊天,如果有人匹配不到,会给有愿意聊天的用户发来打电话邀请 + * 3.接收车队邀请消息 + */ +const val PUSH_MSG_CREATE_ROOM = 0 + +/** + * 服务端下发消息状态为1存在三种场景: + * 1.语音聊天对方同意,下发同意消息 + * 2.匹配成功消息 + * 3.车队邀请对方同意,下发同意消息 + */ +const val PUSH_MSG_AGREE_ENTER = 1 + +/** + * 服务端下发消息状态为2存在三种场景: + * 1.语音邀请被拒绝 + * 2.被动匹配接收到来电邀请,被拒绝 + * 3.车队邀请被拒绝 + */ +const val PUSH_MSG_DENY_ENTER = 2 + +/** + * 服务端下发消息状态为3存在两种场景: + * 1.语音和匹配接收到消息下发,挂断电话 + * 2.车队接收到消息下发,如果消息中有队员,则接收到队员退房消息,若无队员,则挂断车队电话 + */ +const val PUSH_MSG_HANG_UP = 3 + + +class ChatHttp { + + companion object { + + private const val DEV_BASE_URL_OWNER = "http://dzt-show.zhidaohulian.com/" + private const val DEV_CONFIG_URL = "http://dzt-test.zhidaohulian.com/" + private const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaohulian.com/" + + private const val SOCKET_SERVER = "ws://62.234.196.121:4001/ws" + private const val DEV_SOCKET_SERVER = "ws://dzt-test.zhidaohulian.com/ws" + + fun getBaseUrl(): String { + return when (DebugConfig.getNetMode()) { + DebugConfig.NET_MODE_DEV, DebugConfig.NET_MODE_QA, DebugConfig.NET_MODE_DEMO -> DEV_BASE_URL_OWNER + DebugConfig.NET_MODE_RELEASE -> RELEASE_BASE_URL_OWNER + else -> RELEASE_BASE_URL_OWNER + } + } + + fun getSocketServer(): String { + return when (DebugConfig.getNetMode()) { + DebugConfig.NET_MODE_DEV, DebugConfig.NET_MODE_QA, DebugConfig.NET_MODE_DEMO -> DEV_SOCKET_SERVER + DebugConfig.NET_MODE_RELEASE -> SOCKET_SERVER + else -> SOCKET_SERVER + } + } + + fun getConfig(): String { + return when (DebugConfig.getNetMode()) { + DebugConfig.NET_MODE_DEV, DebugConfig.NET_MODE_QA, DebugConfig.NET_MODE_DEMO -> DEV_CONFIG_URL + DebugConfig.NET_MODE_RELEASE -> RELEASE_BASE_URL_OWNER + else -> RELEASE_BASE_URL_OWNER + } + } + } +} + + diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/gme/Gme.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/gme/Gme.kt new file mode 100644 index 0000000000..bac856ea26 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/gme/Gme.kt @@ -0,0 +1,236 @@ +package com.mogo.eagle.core.function.chat.facade.gme + +import android.content.Context +import android.content.Intent +import android.os.Handler +import android.text.TextUtils +import android.util.Log +import com.gme.TMG.ITMGContext +import com.gme.av.sdk.AVError +import com.gme.av.sig.AuthBuffer +import com.mogo.commons.debug.DebugConfig +import com.mogo.eagle.core.function.api.chat.biz.ChatConsts +import com.mogo.eagle.core.function.chat.facade.utils.log +import com.mogo.eagle.core.utilcode.util.BuildConfig +import com.mogo.eagle.core.utilcode.util.Utils +import java.lang.ref.WeakReference +import java.util.concurrent.atomic.AtomicBoolean + +internal object GMEApi { + + //GME相关信息 + private const val ROOM_TYPE = 1 + private const val SDKID = "1400280276" + private const val SDKKEY = "I0USylN9YQq0CAiq" + + private var openId: String? = null + + private val hasInit by lazy { + AtomicBoolean(false) + } + + private val Intent.result: Int + get() = getIntExtra("result" , -1) + + private val Intent.errorInfo: String + get() = getStringExtra("error_info") ?: "" + + private val Intent.eventId: Int + get() = getIntExtra("event_id", 0) + + private val Intent.users: Array + get() = getStringArrayExtra("user_list") ?: emptyArray() + + private var cb: ((state: GmeState) -> Unit)? = null + + private var ctx: WeakReference? = null + + private val tmgCtx by lazy { + ITMGContext.GetInstance(ctx?.get()?: Utils.getApp()) + } + + private val delegate = object : ITMGContext.ITMGDelegate() { + + override fun OnEvent(type: ITMGContext.ITMG_MAIN_EVENT_TYPE?, data: Intent?) { + super.OnEvent(type, data) + type ?: return + data ?: return + if (type == ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ENTER_ROOM) { + val code = data.result + if (code == AVError.AV_OK) { + cb?.invoke(GmeState.EnterRoomSuccess) + } else { + cb?.invoke(GmeState.EnterRoomFail(code, data.errorInfo)) + } + } + if (type == ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_EXIT_ROOM) { + cb?.invoke(GmeState.ExitRoomSuccess) + } + if (type == ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_USER_UPDATE) { + val eventId = data.eventId + val users = data.users + log(ChatConsts.TAG, "RoomMembersUpdate: ${users.joinToString(",")}") + if (users.isEmpty()) { + log(ChatConsts.TAG, "没人了,准备退房") + cb?.invoke(GmeState.UserChangeInRoom(isEnter = false, emptyArray())) + return + } + val filtered = users.filter { + log(ChatConsts.TAG, "成员进房====$it===ownId:$openId") + it.toInt() > 99999 + }.toTypedArray() + if (filtered.isEmpty()) { + log(ChatConsts.TAG, "成员为空,无操作") + return + } + if (eventId == ITMGContext.ITMG_EVENT_ID_USER_ENTER) { + log(ChatConsts.TAG, "成员进房==去掉99999====$filtered") + cb?.invoke(GmeState.UserChangeInRoom(isEnter = true, filtered)) + } + if (eventId == ITMGContext.ITMG_EVENT_ID_USER_EXIT) { + cb?.invoke(GmeState.UserChangeInRoom(isEnter = false, filtered)) + } + } + } + } + + fun enableAudio() { + Log.d(ChatConsts.TAG, "-- enable audio --- 1 ---") + if (!hasInit.get()) { + return + } + Log.d(ChatConsts.TAG, "-- enable audio --- 2 ---") + val audioCtrl = tmgCtx.GetAudioCtrl() + //开启麦克 + audioCtrl?.EnableMic(true) + //开启扬声器 + audioCtrl?.EnableSpeaker(true) + //设置扬声器音量 + audioCtrl?.SetSpeakerVolume(200) + //解除麦克风静音 + audioCtrl?.SetMicVolume(100) + } + + fun disableAudio() { + Log.d(ChatConsts.TAG, "-- disable audio --- 1 ---") + if (!hasInit.get()) { + return + } + Log.d(ChatConsts.TAG, "-- disable audio --- 2 ---") + val audioCtrl = tmgCtx.GetAudioCtrl() + audioCtrl?.EnableSpeaker(false) + //开启麦克 + audioCtrl?.EnableMic(false) + } + + fun init(ctx: Context, openId: String, cb: ((s: GmeState) -> Unit)? = null) { + if (hasInit.get()) { + log(ChatConsts.TAG, "Error: GmeApi has initialized.") + return + } + hasInit.set(true) + try { + this.ctx = WeakReference(ctx) + this.cb = cb + tmgCtx.SetTMGDelegate(delegate) + + tmgCtx.SetLogLevel(ITMGContext.ITMG_LOG_LEVEL_INFO, ITMGContext.ITMG_LOG_LEVEL_VERBOSE) + + + this.openId = openId + val ret = tmgCtx.Init(SDKID, openId) + if (ret == AVError.AV_OK) { + GmePoller.start() + cb?.invoke(GmeState.InitSuccess(openId)) + } else { + cb?.invoke(GmeState.InitFail(ret)) + } + } catch (t: Throwable) { + log(ChatConsts.TAG, "GMEAPI - error: $t") + } + } + + fun enterRoom(roomId: String) { + if (tmgCtx.IsRoomEntered()) { + return + } + tmgCtx.EnterRoom(roomId, ROOM_TYPE, createAuthBuffer(roomId)) + } + + fun exitRoom() { + if (!tmgCtx.IsRoomEntered()) { + return + } + tmgCtx.ExitRoom() + } + + fun isRoomEntered() = tmgCtx.IsRoomEntered() + + fun unInit() { + if (!hasInit.get()) { + return + } + hasInit.set(false) + cb = null + tmgCtx.SetTMGDelegate(null) + GmePoller.stop() + tmgCtx.Uninit() + } + + private fun createAuthBuffer(roomId: String?): ByteArray? { + return if (TextUtils.isEmpty(roomId)) { + AuthBuffer.getInstance().genAuthBuffer(SDKID.toInt(), "0", openId, SDKKEY) + } else { + AuthBuffer.getInstance().genAuthBuffer(SDKID.toInt(), roomId, openId, SDKKEY) + } + } + + fun muteVoice(mute: Boolean) { + if (!isRoomEntered()) { + return + } + if (mute) { + tmgCtx.GetAudioCtrl()?.SetMicVolume(0) + } else { + tmgCtx.GetAudioCtrl()?.SetMicVolume(100) + } + } +} + +sealed class GmeState { + + class InitSuccess(val openId: String): GmeState() + + class InitFail(val code: Int): GmeState() + + object EnterRoomSuccess: GmeState() + + class EnterRoomFail(val code: Int, val msg: String): GmeState() + + class UserChangeInRoom(val isEnter: Boolean, val left: Array): GmeState() + + object ExitRoomSuccess: GmeState() +} + + +internal object GmePoller { + + private val handler by lazy { Handler() } + + private val poll: Runnable = object : Runnable { + override fun run() { + if (ITMGContext.GetInstance(null) != null) { + ITMGContext.GetInstance(null).Poll() + } + handler.postDelayed(this, 30) + } + } + + internal fun start() { + handler.postDelayed(poll, 30) + } + + internal fun stop() { + handler.removeCallbacks(poll) + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/media/MedialControlFacade.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/media/MedialControlFacade.kt new file mode 100644 index 0000000000..0d09802484 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/media/MedialControlFacade.kt @@ -0,0 +1,61 @@ +package com.mogo.eagle.core.function.chat.facade.media + +import android.content.Context +import android.media.AudioAttributes +import android.media.MediaPlayer +import android.os.Build +import com.mogo.eagle.core.function.api.chat.biz.ChatConsts +import com.mogo.eagle.core.function.api.chat.biz.IMoGoMediaFacade +import com.mogo.eagle.core.function.chat.facade.utils.log +import java.lang.ref.WeakReference +import java.util.concurrent.atomic.AtomicReference + +internal object MedialControlFacade : IMoGoMediaFacade { + + private val player by lazy { + AtomicReference>() + } + + override fun play(context: Context, audioSources: Int, isLoop: Boolean, channel: Int) { + val player = player.get()?.get() ?: MediaPlayer().also { player.set(WeakReference(it)) } + resetStatus(player) + val file = context.resources.openRawResourceFd(audioSources) + player.apply { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { + setAudioStreamType(channel) + } else { + setAudioAttributes(AudioAttributes.Builder().setLegacyStreamType(channel).build()) + } + setDataSource(file.fileDescriptor, file.startOffset, file.length) + file.close() + isLooping = isLoop + prepareAsync() + setOnPreparedListener { player -> + log(ChatConsts.TAG,"real play 准备播放音频====") + player.start() + } + setOnCompletionListener { player -> + log(ChatConsts.TAG,"播放完成====") + player.reset() + } + } + } + + override fun release() { + val player = this.player.get()?.get() ?: return + log(ChatConsts.TAG,"release 释放音频播放====") + player.run { + resetStatus(this) + release() + } + } + + private fun resetStatus(player: MediaPlayer) { + player.run { + if (isPlaying) { + stop() + } + reset() + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/ChatServiceModel.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/ChatServiceModel.kt new file mode 100644 index 0000000000..e1ffcaef0e --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/ChatServiceModel.kt @@ -0,0 +1,156 @@ +package com.mogo.eagle.core.function.chat.facade.net + +import com.alibaba.android.arouter.launcher.ARouter +import com.google.gson.Gson +import com.google.gson.JsonElement +import com.google.gson.JsonObject +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.data.BaseResponse +import com.mogo.eagle.core.data.chat.UserInfo +import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.function.api.chat.biz.ChatConsts +import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE +import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi +import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp +import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp.Companion.getConfig +import com.mogo.eagle.core.function.chat.facade.net.bean.* +import com.mogo.eagle.core.function.chat.facade.utils.log +import com.mogo.service.IMogoServiceApis +import retrofit2.http.* +import java.lang.IllegalStateException + + +internal class ChatServiceModel { + + suspend fun isOnline(sn: String): Boolean { + val map = hashMapOf() + map["sn"] = sn + return apiCall { + getNetWorkApi()?.isOnLine(map) ?: throw IllegalStateException("apis is null.") + }.takeIf { it.code == 0 || it.code == 200 }?.let { + val result = it.result + return@let result.carOnLine == 1 && result.onLine == 1 + } ?: false + } + + suspend fun queryUserInfo(sn: String): Pair? { + val sns = arrayListOf(sn) + val requestData = SnArrayRequestBody().also { it.sns = sns } + return apiCall { + getNetWorkApi(getConfig())?.queryUserInfoBySnS(requestData) ?: throw IllegalStateException("apis is null.") + }.let { itx -> + if (itx.code != 0 && itx.code != 200) { + return@let Pair(Error(itx.code, itx.msg), null) + } + val result = UserInfo() + val json = itx.result + val array = json.getAsJsonArray("info") + if (array == null || array.size() == 0) { + return Pair(null, null) + } + val first = array[0] as? JsonObject ?: return@let null + val userInfo = first.getAsJsonObject("carAndUserInfoRedisVo") + val location = first.getAsJsonObject("realTimeLocationVo") + if (userInfo == null) { + return@let Pair(null, null) + } + result.sn = userInfo.get("sn")?.takeIf { !it.isJsonNull }?.asString ?: sn + result.name = userInfo.get("userNickName")?.takeIf { !it.isJsonNull }?.asString ?: "小蘑菇" + result.icon = userInfo.get("headImgUrl")?.takeIf { !it.isJsonNull }?.asString + result.sex = userInfo.get("cardIdSex")?.takeIf { !it.isJsonNull }?.asString ?: "未设置" + result.age = userInfo.get("cardIdAge")?.takeIf { !it.isJsonNull }?.asString + result.brand = userInfo.get("lastBrandName")?.takeIf { !it.isJsonNull }?.asString + result.city = userInfo.get("lastActiveCity")?.takeIf { !it.isJsonNull }?.asString + if (location != null) { + result.lat = location.get("lat")?.takeIf { !it.isJsonNull }?.asDouble ?: 0.0 + result.lon = location.get("lon")?.takeIf { !it.isJsonNull }?.asDouble ?: 0.0 + } + return@let Pair(null, result) + } + } + + suspend fun requestConnectStatus(params: ConnectStatusParam): BaseResponse { + val map = hashMapOf() + val sn = MoGoAiCloudClientConfig.getInstance().sn + val location = BridgeApi.locationClient()?.lastKnowLocation + if (location != null) { + params.lon = location.longitude + params.lat = location.latitude + } + log(ChatConsts.TAG, "connectStatusParam:$params") + map["sn"] = MoGoAiCloudClientConfig.getInstance().sn + map["data"] = Gson().toJson(params) + return if (params.type == CALL_TYPE_VOICE.type) { + apiCall { + getNetWorkApi()?.requestConnectStatus(sn, map) ?: throw IllegalStateException("apis is null.") + } + } else { + apiCall { + getNetWorkApi()?.requestVehicleTeamConnectStatus(map) ?: throw IllegalStateException("apis is null.") + } + } + } + + suspend fun inviteJoinVehicleTeam(param: CallRequestParam): BaseResponse { + val map = hashMapOf() + log(ChatConsts.TAG, "inviteJoinVehicleTeam paras: $param") + map["sn"] = MoGoAiCloudClientConfig.getInstance().sn + map["data"] = Gson().toJson(param) + return apiCall { + getNetWorkApi()?.inviteJoinVehicleTeam(map) ?: throw IllegalStateException("apis is null.") + } + } + + suspend fun requestRoomInfo(param: CallRequestParam): BaseResponse { + val map = hashMapOf() + val location = BridgeApi.locationClient()?.lastKnowLocation + if (location != null) { + param.lat = location.latitude + param.lon = location.longitude + } + log(ChatConsts.TAG, "roomParam:$param") + map["data"] = Gson().toJson(param) + return apiCall { + getNetWorkApi()?.requestRoomInfo(map) ?: throw IllegalStateException("apis is null.") + } + } + + private suspend fun apiCall(call: suspend () -> BaseResponse): BaseResponse { + return call.invoke() + } + + private fun getNetWorkApi(baseUrl: String = ChatHttp.getBaseUrl()): HttpApi? { + val serviceApi: IMogoServiceApis? = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation() as? IMogoServiceApis + return serviceApi?.networkApi?.createNoCallAdapter(HttpApi::class.java, baseUrl) + } +} + +internal interface HttpApi { + + @FormUrlEncoded + @POST("/yycp-chat-service/car/voiceRoom/no/operate/v1") + suspend fun requestConnectStatus(@Query("sn") sn: String, @FieldMap connectStatus: Map): BaseResponse + + //邀请加入车队 + @FormUrlEncoded + @POST("/yycp-chat-service/car/chat/no/inviteJoinTeam/v1") + suspend fun inviteJoinVehicleTeam(@FieldMap inviteVehicleTeam: Map): BaseResponse + + //车队状态同步 + @FormUrlEncoded + @POST("/yycp-chat-service/car/chat/no/operateTeamRoom/v1") + suspend fun requestVehicleTeamConnectStatus(@FieldMap connectStatus: Map): BaseResponse + + //查询用户是否在线 + @FormUrlEncoded + @POST("/yycp-chat-service/car/queryOnLineBySn/v1") + suspend fun isOnLine(@FieldMap onLine: Map): BaseResponse + + @POST("/yycp-realtimeLocations/realTimeLocationServer/queryRsAncCarAndUserInfoBySns") + suspend fun queryUserInfoBySnS(@Body body: SnArrayRequestBody): BaseResponse + + //语音房间信息,原路径dataService + @FormUrlEncoded + @POST("/yycp-chat-service/car/sender/no/createRoom/v1") + suspend fun requestRoomInfo(@FieldMap roomInfo: Map): BaseResponse +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/CallRequestParam.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/CallRequestParam.kt new file mode 100644 index 0000000000..e16a5ec083 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/CallRequestParam.kt @@ -0,0 +1,50 @@ +package com.mogo.eagle.core.function.chat.facade.net.bean + +import androidx.annotation.Keep +import com.google.gson.annotations.Expose +import com.google.gson.annotations.SerializedName +import com.mogo.eagle.core.function.api.chat.biz.IMCallType +import com.mogo.eagle.core.function.api.chat.biz.IMCallType.CALL_TYPE_VOICE + +@Keep class CallRequestParam { + /** + * 发送者sn + */ + var snSender: String = "" + + /** + * 接收者sn + */ + var snReceiver: String = "" + + /** + * 发送者用户名 + */ + var nickName:String? = null + + /** + * 发送者头像链接 + */ + var headImgUrl:String? = null + + /** + * 发送者车辆信息 + */ + var carInfo:String? = null + + /** + * 发送者经度 + */ + var lon:Double = 0.0 + + /** + * 发送者纬度 + */ + var lat: Double = 0.0 + + /** + * 呼叫类型 + */ + var type = CALL_TYPE_VOICE.type + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/ConnectStatusParam.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/ConnectStatusParam.kt new file mode 100644 index 0000000000..fd9676cc86 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/ConnectStatusParam.kt @@ -0,0 +1,24 @@ +package com.mogo.eagle.core.function.chat.facade.net.bean + +class ConnectStatusParam (var snSender: String, var snReceiver: String, var roomId: Int, var status: Int, var type: Int) { + + var lat: Double? = null//发送方的纬度 + + var lon: Double? = null//发送方的经度 + + var nickName: String? = null//发送方的昵称 + + var headImgUrl: String? = null//发送方的用户头像 + + var carInfo: String? = null//发送方的车辆信息 + + var cardIdAge: String? = null //发送方年龄 + + var cardIdSex: String? = null//发送发性别 + + var cityName: String? = null//发送方城市 + + override fun toString(): String { + return "ConnectStatusParam(snSender='$snSender', snReceiver='$snReceiver', roomId=$roomId, status=$status, type=$type, lat=$lat, lon=$lon, nickName=$nickName, headImgUrl=$headImgUrl, carInfo=$carInfo, cardIdAge=$cardIdAge, cardIdSex=$cardIdSex, cityName=$cityName)" + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/Error.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/Error.kt new file mode 100644 index 0000000000..a84cd9d2f8 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/Error.kt @@ -0,0 +1,3 @@ +package com.mogo.eagle.core.function.chat.facade.net.bean + +data class Error(val code: Int, val msg: String) diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/OnLineStatus.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/OnLineStatus.kt new file mode 100644 index 0000000000..c294ae9e90 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/OnLineStatus.kt @@ -0,0 +1,11 @@ +package com.mogo.eagle.core.function.chat.facade.net.bean + + +/** + * carOnLine:ACC ON状态 1:在线 2:不在线 + * onLine:是否隐身 1:在线 2:隐身 + */ +internal class OnLineStatus { + var carOnLine: Int = -1 + var onLine: Int = -1 +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/RoomInfo.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/RoomInfo.kt new file mode 100644 index 0000000000..94ad79e381 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/RoomInfo.kt @@ -0,0 +1,8 @@ +package com.mogo.eagle.core.function.chat.facade.net.bean + +import androidx.annotation.Keep + +@Keep class RoomInfo { + + var roomId:Int = -1 +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/SnArrayRequestBody.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/SnArrayRequestBody.kt new file mode 100644 index 0000000000..be8d5f08ac --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/net/bean/SnArrayRequestBody.kt @@ -0,0 +1,8 @@ +package com.mogo.eagle.core.function.chat.facade.net.bean + +import androidx.annotation.Keep + +@Keep +internal class SnArrayRequestBody { + var sns: List? = null +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/socket/SocketConnectManager.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/socket/SocketConnectManager.kt new file mode 100644 index 0000000000..6eac99fc9d --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/socket/SocketConnectManager.kt @@ -0,0 +1,97 @@ +package com.mogo.eagle.core.function.chat.facade.socket + +import com.google.gson.Gson +import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.eagle.core.data.chat.socket.HeartBeat +import com.mogo.eagle.core.function.api.chat.biz.ChatConsts +import com.mogo.eagle.core.function.chat.facade.consts.ChatHttp +import com.mogo.eagle.core.function.chat.facade.consts.SOCKET_HAND_SHAKE +import com.mogo.eagle.core.function.chat.facade.consts.SOCKET_HEART_BEAT +import com.mogo.eagle.core.function.chat.facade.utils.log +import com.mogo.websocket.ISocketMsgCallBack +import com.mogo.websocket.ISocketMsgSetting +import com.mogo.websocket.SocketClient +import java.util.concurrent.atomic.AtomicInteger + +/** + * 长链接管理类 + */ +internal object SocketConnectManager { + + private val client by lazy { + SocketClient() + } + + private var msgCallback: ((msg: String) -> Unit)? = null + + private val roomId by lazy { + AtomicInteger(0) + } + + fun init() { + //开启长连服务 + client.initSocketServer(ChatHttp.getSocketServer()) + client.getMessageSettings(socketMsgSetting) + client.addISocketMsgCallBack(socketMsgCallBack) + client.startConnect() + } + + fun setOnMsgReceiveCb(cb: ((msg: String) -> Unit)) { + msgCallback = cb + } + + fun setRoomId(roomId: Int) { + this.roomId.set(roomId) + } + + private val socketMsgSetting: ISocketMsgSetting = object : ISocketMsgSetting { + override fun getHandShakeMsg(): String { + log(ChatConsts.TAG, "getHandShakeMsg") + val socketMsg = HeartBeat(SOCKET_HAND_SHAKE, MoGoAiCloudClientConfig.getInstance().sn) + return Gson().toJson(socketMsg) + } + + override fun getHeartBeatMsg(): String { + log(ChatConsts.TAG, "getHeartBeatMsg") + val socketMsg = HeartBeat(SOCKET_HEART_BEAT, MoGoAiCloudClientConfig.getInstance().sn, roomId.get()) + return Gson().toJson(socketMsg) + } + } + + private val socketMsgCallBack: ISocketMsgCallBack = object : ISocketMsgCallBack { + override fun onConnectOpen() { + log(ChatConsts.TAG, "onConnectOpen ---> ") + } + + override fun handleError(e: Exception) { + log(ChatConsts.TAG, "handleError ---> msg: ${e.message}") + client.stopHeartBeat() + } + + override fun onConnectClose() { + log(ChatConsts.TAG, "onConnectClose ---> stop web socket thread ,and ready to reconnect") + client.stop() + log(ChatConsts.TAG, "onConnectClose ---> stop Heart Beat") + client.stopHeartBeat() + log(ChatConsts.TAG, "ready to reconnect") + client.reConnect() + } + + override fun handleMessage(message: String) { + log(ChatConsts.TAG, "handleMessage ---> $message") + msgCallback?.invoke(message) + } + } + + fun instance() = client + + fun destroy() { + try { + client.stopHeartBeat() + client.disConnect() + client.stop() + } catch (t: Throwable) { + log(ChatConsts.TAG, "IMService -- destroy -- ex: $t") + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/ui/CallChatWindowManager.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/ui/CallChatWindowManager.kt new file mode 100644 index 0000000000..f9db3ded23 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/ui/CallChatWindowManager.kt @@ -0,0 +1,606 @@ +package com.mogo.eagle.core.function.chat.facade.ui + +import android.content.Context +import android.media.AudioManager +import android.view.LayoutInflater +import android.view.View +import android.widget.FrameLayout +import android.widget.ImageView +import android.widget.TextView +import androidx.core.view.ViewCompat +import androidx.lifecycle.Lifecycle.Event.ON_CREATE +import androidx.lifecycle.Lifecycle.Event.ON_DESTROY +import com.bumptech.glide.request.RequestOptions +import com.mogo.eagle.core.data.chat.UserInfo +import com.mogo.eagle.core.function.api.chat.biz.AnswerState +import com.mogo.eagle.core.function.api.chat.biz.AnswerState.EnterRoomSuccess +import com.mogo.eagle.core.function.api.chat.biz.AnswerState.Error +import com.mogo.eagle.core.function.api.chat.biz.AnswerState.ExitRoomSuccess +import com.mogo.eagle.core.function.api.chat.biz.AnswerState.RoomMemberUpdate +import com.mogo.eagle.core.function.api.chat.biz.ChatConsts +import com.mogo.eagle.core.function.api.chat.biz.HangUpState +import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade.IMoGoVoiceCallback +import com.mogo.eagle.core.function.api.chat.biz.RefuseState +import com.mogo.eagle.core.function.chat.R +import com.mogo.eagle.core.function.chat.facade.MoGoChatFacade +import com.mogo.eagle.core.function.chat.facade.OnCallingInterrupt +import com.mogo.eagle.core.function.chat.facade.OnInComingCallback +import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi +import com.mogo.eagle.core.function.chat.facade.utils.log +import com.mogo.eagle.core.function.chat.facade.voice.VoiceControlFacade.REQUEST_CLOUD_VOICE_CALL +import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope +import com.mogo.eagle.core.utilcode.kotlin.observe +import com.mogo.eagle.core.utilcode.kotlin.onClick +import com.mogo.eagle.core.utilcode.kotlin.safeCancel +import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform +import com.mogo.eagle.core.utilcode.mogo.glide.GlideRoundedCornersTransform.CornerType.LEFT +import kotlinx.coroutines.* +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.channels.Channel.Factory.RENDEZVOUS +import kotlinx.coroutines.flow.* +import kotlinx.coroutines.selects.select +import java.util.concurrent.atomic.AtomicReference +import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp +import com.mogo.eagle.core.utilcode.util.ToastUtils +import java.text.SimpleDateFormat +import java.util.* + +internal class CallChatWindowManager { + + companion object { + const val TAG = "TeamChatWindowManager" + + const val DEFAULT_MAX_DIALING_TIME = 30 * 1000L + } + + private val facade by lazy { + MoGoChatFacade + } + + private val context by lazy { + BridgeApi.context() + } + + private val scope by lazy { + BridgeApi.context().lifeCycleScope + } + + private var hasAnswered = false + + private var hasRefused = false + + private var hasHangUpped = false + + @OptIn(ExperimentalCoroutinesApi::class) + private var interrupt = Channel(RENDEZVOUS) + @Synchronized + get() = if (field.isClosedForReceive || field.isClosedForSend) { + field = Channel(RENDEZVOUS) + field + } else field + + + @OptIn(ExperimentalCoroutinesApi::class) + private var exitRoom = Channel(RENDEZVOUS) + @Synchronized + get() = if (field.isClosedForReceive || field.isClosedForSend) { + field = Channel(RENDEZVOUS) + field + } else field + + @OptIn(ExperimentalCoroutinesApi::class) + private var callerEnter = Channel(RENDEZVOUS) + @Synchronized + get() = if (field.isClosedForReceive || field.isClosedForSend) { + field = Channel(RENDEZVOUS) + field + } else field + + @OptIn(ExperimentalCoroutinesApi::class) + private var refused = Channel(RENDEZVOUS) + @Synchronized + get() = if (field.isClosedForReceive || field.isClosedForSend) { + field = Channel(RENDEZVOUS) + field + } else field + + + private val onInComingCall = object : OnInComingCallback { + override fun invoke(isTeam: Boolean, user: UserInfo) { + if (isTeam) { + log(TAG, "车队邀请,不做处理....") + } else { + showInComingView(user) + } + } + } + + private val onCallInterrupt = object : OnCallingInterrupt { + override fun invoke(isTeam: Boolean, user: UserInfo) { + if (isTeam) { + log(TAG, "车队邀请拒绝,不做处理....") + } else { + onCallInterrupt() + } + } + } + + fun init() { + facade.let { + it.onInComingCall(onInComingCall) + it.onCallingInterrupt(onCallInterrupt) + } + } + + @OptIn(ExperimentalCoroutinesApi::class) + private fun showInComingView(user: UserInfo) { + val context = BridgeApi.context() + scope.launchWhenResumed { + var incomingView = LayoutInflater.from(context) + .inflate(R.layout.module_car_chatting_launcher_incoming_hawk_eye_view, null) + incomingView.isClickable = true + var answer = incomingView.findViewById(R.id.module_carchatting_incoming_answer) + var refuse = incomingView.findViewById(R.id.module_carchatting_incoming_hangUp) + val dismissJob = AtomicReference() + var timer: Job? = null + var ring: Job? = null + launch { + speak(REQUEST_CLOUD_VOICE_CALL) + calling() + }.also { ring = it } + answer.onClick { + timer = resetInComingTimer(timer, user, incomingView) + if (hasAnswered) { + ToastUtils.showShort("正在处理, 请稍候...") + return@onClick + } + doAnswer(user, incomingView) + } + refuse.onClick { + timer = resetInComingTimer(timer, user, incomingView) + if (hasRefused) { + ToastUtils.showShort("正在处理, 请稍候...") + return@onClick + } + doRefuse(user) + } + incomingView.observe(arrayOf(ON_CREATE, ON_DESTROY)) { itx -> + if (itx == ON_CREATE) { + timer = inComingTimer(user, incomingView) + launch(Dispatchers.Main) { + val d1 = async { + log(TAG, "监听对方呼出,又挂断状态...") + var interrupted = interrupt.receive() + while (!interrupted) { + interrupted = interrupt.receive() + } + log(TAG, "收到对方呼出又挂断状态...") + } + val d2 = async { + log(TAG, "监听拒绝状态...") + var isRefuse = refused.receive() + while (!isRefuse) { + isRefuse = refused.receive() + } + log(TAG, "收到拒绝状态, 隐藏来电界面") + } + val state = select { + d1.onAwait { 1 } + d2.onAwait { 2 } + } + when (state) { + 1 -> { + log(TAG, "由于对方呼出又挂断,导致来电界面隐藏") + d2.safeCancel() + } + 2 -> { + log(TAG, "由于自己主动拒接,导致来电界面隐藏") + d1.safeCancel() + } + } + hide(incomingView) + releaseAudioAndVoice() + }.also { dismissJob.set(it) } + } + if (itx == ON_DESTROY) { + ring?.safeCancel() + timer?.safeCancel() + hasAnswered = false + hasRefused = false + refused.safeCancel() + interrupt.safeCancel() + dismissJob.get()?.safeCancel() + incomingView = null + answer = null + refuse = null + } + } + show(incomingView, getInComingLayoutParams(context)) + } + } + + private suspend fun speak(text: String) = suspendCancellableCoroutine { + val voiceCallback = object : IMoGoVoiceCallback { + override fun onSpeakEnd() { + it.resumeWith(Result.success(Unit)) + } + } + val voiceCtl = facade.voice() + it.invokeOnCancellation { + voiceCtl.stopTTS(context, text) + } + voiceCtl.speak(context, text, voiceCallback) + } + + private suspend fun calling() = suspendCancellableCoroutine { + it.invokeOnCancellation { + releaseAudioAndVoice() + } + playAudioCall { + it.resumeWith(Result.success(Unit)) + } + } + + + private fun getInComingLayoutParams(context: Context): FrameLayout.LayoutParams { + return FrameLayout.LayoutParams( + context.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_width).toInt(), + context.resources.getDimension(R.dimen.module_call_chat_state_incoming_hawk_eye_height).toInt()) + .also { + val x = context.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_x) + val y = context.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_y) + it.leftMargin = x.toInt() + it.topMargin = y.toInt() + } + } + + /** + * 重新开始计时 + */ + private fun CoroutineScope.resetInComingTimer(old: Job?, user: UserInfo, incomingView: View): Job { + old?.safeCancel() + return inComingTimer(user, incomingView) + } + + private fun CoroutineScope.inComingTimer(user: UserInfo, incomingView: View) = launch { + log(TAG, "延迟30s消失计时开始...") + delay(DEFAULT_MAX_DIALING_TIME) + log(TAG, "延迟30s消失计时结束...") + doRefuse(user, false) + hide(incomingView) + releaseAudioAndVoice() + } + + private fun showCallingView(user: UserInfo) { + val context = BridgeApi.context() + scope.launchWhenResumed { + var callingView = LayoutInflater.from(context) + .inflate(R.layout.module_car_chatting_launcher_calling_hawk_eye_view, null) + callingView.isClickable = true + var calling= callingView.findViewById(R.id.module_carchatting_rl_call_view) + var head = callingView.findViewById(R.id.module_carchatting_call_head) + var hangUp = callingView.findViewById(R.id.module_carchatting_call_hangUp) + var name = callingView.findViewById(R.id.module_carchatting_call_nickname) + var timer = callingView.findViewById(R.id.module_carchatting_call_time) + calling.visibility = View.VISIBLE + name.text = "云平台" + timer.text = context.resources.getString(R.string.module_car_chat_matching_wait) + GlideApp.with(context).load(user.icon) + .apply( + RequestOptions.bitmapTransform( + GlideRoundedCornersTransform( + 20f, + LEFT + ) + ) + ) + .placeholder(R.mipmap.module_carchatting_hawk_eye_default_head_img) + .into(head) + hangUp.onClick { + if (hasHangUpped) { + ToastUtils.showShort("正在处理,请稍候...") + return@onClick + } + doHangUp(user, callingView) + } + callingView.observe(arrayOf(ON_CREATE, ON_DESTROY)) { + var job: Job? = null + if (it == ON_CREATE) { + launch(Dispatchers.Main) { + val d1 = async { + log(ChatConsts.TAG, "等着新用户进来...") + var isNewUserEnter = callerEnter.receive() + while (!isNewUserEnter) { + isNewUserEnter = callerEnter.receive() + } + //新用户进来了 + log(ChatConsts.TAG, "新用户进来了...") + callingTimer() + .collect { + timer.text = parseTime(it) + } + } + val d2 = async { + log(ChatConsts.TAG, "等着退房通知...") + var exit = exitRoom.receive() + while (!exit) { + exit = exitRoom.receive() + } + } + val state = select { + d1.onAwait { 1 } + d2.onAwait { 2 } + } + when (state) { + 1 -> { + log(TAG, "通话中, 计时任务结束了(不般不会发生)...") + } + 2 -> { + log(TAG, "收到退房通知,可以移除通话状态的界面了...") + d1.safeCancel() + } + } + if (hasHangUpped) { + ToastUtils.showShort("已挂断") + } + hide(callingView) + facade.audioFocus().releaseAudioFocus() + }.also { job = it } + } + if (it == ON_DESTROY) { + job?.safeCancel() + callerEnter.safeCancel() + exitRoom.safeCancel() + hasHangUpped = false + callingView = null + calling = null + head = null + hangUp = null + name = null + timer = null + } + } + show(callingView, getCallingLayoutParams(context)) + } + } + + private fun getCallingLayoutParams(context: Context): FrameLayout.LayoutParams { + return FrameLayout.LayoutParams( + context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_width).toInt(), + context.resources.getDimension(R.dimen.module_call_chat_state_hawk_eye_height).toInt() + ) + .also { + it.leftMargin = context.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_x).toInt() + it.topMargin = context.resources.getDimension(R.dimen.module_call_chat_state_location_hawk_eye_y).toInt() + } + } + + private fun parseTime(time: Long): String { + val date = Date(time) + val formatter = SimpleDateFormat("HH:mm:ss", Locale.CHINA) + formatter.timeZone = TimeZone.getTimeZone("GMT+00:00") + return formatter.format(date) + } + + private fun show(view: View, params: FrameLayout.LayoutParams) { + BridgeApi.floatViewManager()?.addView(view, params, true) + } + + private fun hide(view: View) { + if (!ViewCompat.isAttachedToWindow(view)) { + return + } + BridgeApi.floatViewManager()?.removeView(view) + } + + private fun playAudioCall(onPlay:(() -> Unit)? = null) { + facade.also { + it.audioFocus().requireAudioFocus { + it.media().play(context, R.raw.call, true, AudioManager.STREAM_RING) + onPlay?.invoke() + } + } + } + + private fun releaseAudioAndVoice() { + facade.also { + it.media().release() + } + } + + private fun onNewUserEnterRoom() { + scope.launch { + callerEnter.send(true) + } + } + + private fun onCallInterrupt() { + scope.launch { + interrupt.send(true) + } + } + + private fun doAnswer(user: UserInfo, incommingView: View) { + answer( + user, + onEnter = { + releaseAudioAndVoice() + hide(incommingView) + showCallingView(user) + }, + onNewEnter = { + onNewUserEnterRoom() + }, + onExit = { + exitRoom() + }, + onError = { code, msg, extra -> + log(TAG, "-- 应答失败 --: code:: $code; msg:: $msg; extra:: $extra") + when (code) { + AnswerState.CODE_ANSWER_SOCKET_DISCONNECT -> { + ToastUtils.showShort("连接已断开") + } + else -> { + ToastUtils.showShort("应答失败") + } + } + doRefuse(user, false) + releaseAudioAndVoice() + hide(incommingView) + facade.audioFocus().releaseAudioFocus() + } + ) + } + + /** + * @param user: 来电用户信息 + * @param onEnter: 当前用户进房成功通知 + * @param onExit: 当前用户退房通知(当前用户主动挂断或对方挂断) + */ + @OptIn(ExperimentalCoroutinesApi::class) + private fun answer(user: UserInfo, onEnter: () -> Unit, onNewEnter: () -> Unit, onExit: () -> Unit, onError: (code: Int, msg: String, extra: Map? ) -> Unit) { + facade.also { itx -> + if (hasAnswered) { + return + } + hasAnswered = true + itx.answer(user.sn) + .onEach { + when(it) { + is EnterRoomSuccess -> { + onEnter.invoke() + } + is RoomMemberUpdate -> { + if (!it.isMySelf && it.isEnter) { + onNewEnter.invoke() + } + } + is ExitRoomSuccess -> { + onExit.invoke() + } + is Error -> { + hasAnswered = false + onError.invoke(it.code, it.msg, it.extra) + } + else -> { + log(ChatConsts.TAG, "[Answer][Other]-> $it") + } + } + } + .launchIn(scope) + } + } + + private fun doRefuse(user: UserInfo, notify: Boolean = true) { + refuse(user, + onSuccess = { + if (notify) { + ToastUtils.showShort("已拒接") + onRefuseOK() + } + }, + onError = { code, msg, extra -> + log(TAG, "-- 拒绝失败 --: code:: $code; msg:: $msg; extra:: $extra") + ToastUtils.showShort("拒绝异常") + }) + } + + @OptIn(ExperimentalCoroutinesApi::class) + private fun refuse(user: UserInfo, onSuccess: () -> Unit, onError: (code: Int, msg: String, extra: Map?) -> Unit){ + facade.also { + if (hasRefused) { + return + } + hasRefused = true + it.refuse(user.sn) + .onEach { itx -> + when(itx) { + is RefuseState.Success -> { + onSuccess.invoke() + } + is RefuseState.Error -> { + hasRefused = false + onError.invoke(itx.code, itx.msg, itx.extra) + } + else -> { + log(ChatConsts.TAG, "[Refuse][Other]-> $it") + } + } + } + .launchIn(scope) + } + } + + private fun doHangUp(user: UserInfo, callingView: View) { + hangUp( + user, + onSuccess = { + log(TAG, "挂断接口请求成功,等着退房...") + }, + onError = { code, msg, extra -> + log(TAG, "挂断异常:code: $code; msg: $msg, ; extra: $extra") + ToastUtils.showShort("挂断异常") + }) + + } + + private fun exitRoom() { + scope.launch { + exitRoom.send(true) + } + } + + private fun onRefuseOK() { + scope.launch { + refused.send(true) + } + } + + @OptIn(InternalCoroutinesApi::class) + private fun callingTimer(): Flow { + return flow { + var counter = 1 + while (true) { + delay(1000) + emit(1000L * (counter ++)) + } + } + } + + @OptIn(ExperimentalCoroutinesApi::class) + private fun hangUp(user: UserInfo, onSuccess: () -> Unit, onError:(code: Int, msg: String, extra: Map?) -> Unit) { + facade.also { + if (hasHangUpped) { + return + } + hasHangUpped = true + it.handUp(user.sn) + .onEach { itx -> + when(itx) { + HangUpState.Success -> { + onSuccess.invoke() + } + is HangUpState.Error -> { + hasHangUpped = false + log(TAG, "-- 挂断失败 --: code:: ${itx.code}; msg:: ${itx.msg}; extra:: ${itx.extra}") + onError.invoke(itx.code, itx.msg, itx.extra) + } + else -> { + log(ChatConsts.TAG, "[HangUp][Other]-> $it") + } + } + } + .launchIn(scope) + } + } + + fun destroy() { + hasAnswered = false + hasHangUpped = false + hasRefused = false + interrupt.safeCancel() + refused.safeCancel() + exitRoom.safeCancel() + callerEnter.safeCancel() + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/utils/LogUtil.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/utils/LogUtil.kt new file mode 100644 index 0000000000..e32ad7d1e0 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/utils/LogUtil.kt @@ -0,0 +1,9 @@ +@file:JvmName("LogUtil") + +package com.mogo.eagle.core.function.chat.facade.utils + +import com.mogo.eagle.core.function.chat.facade.aop.DebugLog + + +@DebugLog +fun log(tag: String, msg: String) {} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/voice/VoiceControlFacade.kt b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/voice/VoiceControlFacade.kt new file mode 100644 index 0000000000..31797c30b6 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/java/com/mogo/eagle/core/function/chat/facade/voice/VoiceControlFacade.kt @@ -0,0 +1,232 @@ +package com.mogo.eagle.core.function.chat.facade.voice + +import android.content.Context +import android.content.Intent +import com.mogo.commons.AbsMogoApplication +import com.mogo.commons.voice.AIAssist +import com.mogo.commons.voice.IMogoVoiceCmdCallBack +import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade +import com.mogo.eagle.core.function.api.chat.biz.IMoGoVoiceControlFacade.IMoGoVoiceCallback +import com.mogo.eagle.core.function.chat.facade.bridge.BridgeApi +import com.mogo.eagle.core.function.chat.facade.utils.log +import com.mogo.service.intent.IMogoIntentListener +import java.lang.ref.WeakReference +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.atomic.AtomicBoolean + +object VoiceControlFacade: IMoGoVoiceControlFacade, IMogoVoiceCmdCallBack, IMogoIntentListener { + + private const val TAG = "VoiceControl" + + //WakeUp Command (Intent) + private const val VOICE_INTENT_CANCEL_CALL_COMMAND = "com.zhidao.commin.cancel" //取消呼叫,取消通话 + private const val VOICE_INTENT_REFUSE_CALL = "com.ileja.phone.incoming.reject" //挂断 + + //unWakeUp Command + private const val VOICE_REGISTER_INVITE_JOIN_TEAM = "CMD_CAR_CHAT_INVITE_JOIN_TEAM" + private val customInviteJoinTeamArray: Array = arrayOf("邀请加入车队") + private const val VOICE_REGISTER_JOIN_TEAM = "CMD_CAR_CHAT_JOIN_TEAM" + private val customJoinTeamArray: Array = arrayOf("加入", "加入车队") + private const val VOICE_REGISTER_REFUSE_JOIN_TEAM = "CMD_CAR_CHAT_REFUSE_JOIN_TEAM" + private val customRefuseJoinTeamArray: Array = arrayOf("拒绝", "拒绝加入车队") + private const val VOICE_REGISTER_CANCEL_CALL = "CMD_CAR_CHAT_CANCEL_CALL" + private val customCancelCallArray: Array = arrayOf("取消通话", "取消呼叫", "挂断") + + private const val VOICE_INTENT_ANSWER_CALL = "com.ileja.phone.incoming.accept" //接听 + + internal const val REQUEST_CLOUD_VOICE_CALL = "云平台请求跟你进行语音通话" + private val requestCallYArray: Array = arrayOf("接听") + private val requestCallNArray: Array = arrayOf("挂断") + + private val hasRegister by lazy { AtomicBoolean(false) } + + private val listeners by lazy { + CopyOnWriteArrayList>() + } + + private var onCmdAgree: WeakReference? = null + + private var onSpeechFinish: WeakReference? = null + + private val intentManager by lazy { + BridgeApi.intentManager() + } + + override fun speak(context: Context, content: String, listener: IMoGoVoiceCallback) { + listeners += WeakReference(listener) + AIAssist.getInstance(context).speakTTSVoice(content, this) + } + + override fun onCmdSelected(cmd: String?) { + super.onCmdSelected(cmd) + cmd?.let { itx -> + listeners + .filter { + it.get() != null + } + .forEach { + when (itx) { + VOICE_REGISTER_CANCEL_CALL -> { + log(TAG, "语音免唤醒 取消打电话") + it.get()?.onVoiceCancelCall() + } + VOICE_REGISTER_INVITE_JOIN_TEAM -> { + log(TAG, "语音免唤醒 邀請加入车队") + it.get()?.onVoiceInviteJoinTeam() + } + VOICE_REGISTER_JOIN_TEAM -> { + log(TAG, "语音免唤醒 加入车队") + it.get()?.onVoiceJoinTeam() + } + VOICE_REGISTER_REFUSE_JOIN_TEAM -> { + log(TAG, "语音免唤醒 拒绝加入车队") + it.get()?.onVoiceRefuseJoinTeam() + } + VOICE_INTENT_ANSWER_CALL -> { + log(TAG, "语音免唤醒 接收电话邀请") + it.get()?.onVoiceAnswerCall() + } + VOICE_INTENT_REFUSE_CALL -> { + log(TAG, "语音免唤醒 来电拒接") + it.get()?.onVoiceRefuseCall() + } + } + } + } + } + + override fun onSpeakEnd(speakText: String?) { + super.onSpeakEnd(speakText) + listeners + .filter { + it.get() != null + } + .forEach { + it.get()?.onSpeakEnd() + } + } + + override fun onSpeakError(speakText: String?, errorMsg: String?) { + super.onSpeakError(speakText, errorMsg) + listeners + .filter { + it.get() != null + } + .forEach { + it.get()?.onSpeakEnd() + } + } + + override fun register() { + if (hasRegister.get()) { + return + } + hasRegister.set(true) + AIAssist.getInstance(BridgeApi.context()).registerUnWakeupCommand(VOICE_REGISTER_CANCEL_CALL, customCancelCallArray, this) + intentManager?.also { + it.registerIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this) + it.registerIntentListener(VOICE_INTENT_REFUSE_CALL, this) + } + } + + override fun registerInviteJoinTeam(context: Context, listener: IMoGoVoiceCallback) { + log(TAG, "registerInviteJoinTeam") + listeners += WeakReference(listener) + AIAssist.getInstance(context) + .registerUnWakeupCommand(VOICE_REGISTER_INVITE_JOIN_TEAM, customInviteJoinTeamArray, this) + } + + override fun registerJoinTeam(context: Context, listener: IMoGoVoiceCallback) { + log(TAG, "registerJoinTeam") + listeners += WeakReference(listener) + AIAssist.getInstance(context) + .registerUnWakeupCommand(VOICE_REGISTER_JOIN_TEAM, customJoinTeamArray, this) + AIAssist.getInstance(context) + .registerUnWakeupCommand(VOICE_REGISTER_REFUSE_JOIN_TEAM, customRefuseJoinTeamArray, this) + } + + override fun unRegisterInviteJoinTeam(context: Context) { + AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_INVITE_JOIN_TEAM) + } + + override fun unRegisterJoinTeam(context: Context) { + AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_JOIN_TEAM) + AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_REFUSE_JOIN_TEAM) + } + + override fun registerIntentInComingCall(listener: IMoGoVoiceCallback) { + listeners += WeakReference(listener) + intentManager?.registerIntentListener(VOICE_INTENT_ANSWER_CALL, this) + intentManager?.registerIntentListener(VOICE_INTENT_REFUSE_CALL, this) + } + + override fun unRegisterIntentInComingCall(context: Context) { + intentManager?.unregisterIntentListener(VOICE_INTENT_ANSWER_CALL, this) + intentManager?.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this) + } + + override fun speakAndRegisterCall(onCmdAgree: (Boolean) -> Unit, onSpeakFinish: () -> Unit, listener: IMoGoVoiceCallback) { + this.onCmdAgree = WeakReference(onCmdAgree) + this.onSpeechFinish = WeakReference(onSpeakFinish) + listeners += WeakReference(listener) + + AIAssist.getInstance(AbsMogoApplication.getApp().applicationContext).speakQAndACmd(REQUEST_CLOUD_VOICE_CALL, + requestCallYArray, requestCallNArray, object : IMogoVoiceCmdCallBack { + + override fun onCmdAction(speakText: String?) { + super.onCmdAction(speakText) + log(TAG, "onCmdAction ---> ") + this@VoiceControlFacade.onCmdAgree?.get()?.invoke(true) + } + + override fun onCmdCancel(speakText: String?) { + super.onCmdCancel(speakText) + log(TAG, "onCmdCancel ---> ") + this@VoiceControlFacade.onCmdAgree?.get()?.invoke(false) + } + + override fun onSpeakEnd(speakText: String?) { + super.onSpeakEnd(speakText) + log(TAG, "onSpeakEnd ---> ") + this@VoiceControlFacade.onSpeechFinish?.get()?.invoke() + } + }) + } + + override fun stopTTS(context: Context, text: String) { + AIAssist.getInstance(context).stopSpeakTts(text) + } + + override fun unRegister() { + if (!hasRegister.get()) { + return + } + hasRegister.set(false) + listeners.clear() + AIAssist.getInstance(BridgeApi.context()).unregisterUnWakeupCommand(VOICE_REGISTER_CANCEL_CALL, this) + intentManager?.also { + it.unregisterIntentListener(VOICE_INTENT_CANCEL_CALL_COMMAND, this) + it.unregisterIntentListener(VOICE_INTENT_REFUSE_CALL, this) + } + } + + override fun onIntentReceived(cmd: String?, intent: Intent?) { + val command = cmd ?: return + log(TAG, "handleOnIntentCmd: cmd -> $command") + when (command) { + VOICE_INTENT_CANCEL_CALL_COMMAND, VOICE_INTENT_REFUSE_CALL -> { + log(TAG, "语音唤醒 取消打电话") + listeners + .filter { + it.get() != null + } + .forEach { + it.get()?.onVoiceCancelCall() + } + } + } + } +} + +typealias onCmdAgree = ((Boolean) -> Unit) +typealias onSpeedFinish = (() -> Unit) \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_launcher_calling_bg.9.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_launcher_calling_bg.9.png new file mode 100644 index 0000000000..96ddb81326 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_launcher_calling_bg.9.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment.png new file mode 100644 index 0000000000..950d184e38 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_normal.png new file mode 100644 index 0000000000..12ae03bfed Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_pressed.png new file mode 100644 index 0000000000..f81ff730e4 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_close_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_x.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_x.png new file mode 100644 index 0000000000..f7530c5024 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_fragment_x.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_head_default.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_head_default.png new file mode 100644 index 0000000000..eacbf33bf8 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_head_default.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png new file mode 100644 index 0000000000..6f301e97ab Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png new file mode 100644 index 0000000000..6f5411a704 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png new file mode 100644 index 0000000000..ee7fbb5dfe Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png new file mode 100644 index 0000000000..0b1873ee8f Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_head_default.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_head_default.png new file mode 100644 index 0000000000..4a891e57e5 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_head_default.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_normal.png new file mode 100644 index 0000000000..acf19225e1 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_pressed.png new file mode 100644 index 0000000000..d13ff23373 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_join_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_normal.png new file mode 100644 index 0000000000..f7530c5024 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_pressed.png new file mode 100644 index 0000000000..950d184e38 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_invitation_refuse_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_quit_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_quit_normal.png new file mode 100644 index 0000000000..0bd4b588e1 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_quit_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_quit_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_quit_pressed.png new file mode 100644 index 0000000000..8954c0a15e Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-hdpi/module_carchatting_team_quit_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_launcher_calling_bg.9.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_launcher_calling_bg.9.png new file mode 100644 index 0000000000..fa35eccafd Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_launcher_calling_bg.9.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment.png new file mode 100644 index 0000000000..b04650a030 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_normal.png new file mode 100644 index 0000000000..12ae03bfed Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_pressed.png new file mode 100644 index 0000000000..f81ff730e4 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_close_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_x.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_x.png new file mode 100644 index 0000000000..f274a5fa76 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_fragment_x.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_head_default.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_head_default.png new file mode 100644 index 0000000000..53051d4e9e Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_head_default.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_normal.png new file mode 100644 index 0000000000..cf3e4aa222 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_pressed.png new file mode 100644 index 0000000000..b5a28f5583 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_join_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_normal.png new file mode 100644 index 0000000000..f274a5fa76 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_pressed.png new file mode 100644 index 0000000000..b04650a030 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_invitation_refuse_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_quit_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_quit_normal.png new file mode 100644 index 0000000000..f22c026f58 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_quit_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_quit_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_quit_pressed.png new file mode 100644 index 0000000000..a1f1234504 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-mdpi/module_carchatting_team_quit_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_launcher_calling_bg.9.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_launcher_calling_bg.9.png new file mode 100644 index 0000000000..96ddb81326 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_launcher_calling_bg.9.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_launcher_hawk_eye_calling_bg.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_launcher_hawk_eye_calling_bg.png new file mode 100644 index 0000000000..2357cb985b Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_launcher_hawk_eye_calling_bg.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_bg.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_bg.png new file mode 100644 index 0000000000..c2c244c134 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_bg.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_head_default.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_head_default.png new file mode 100644 index 0000000000..eacbf33bf8 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_head_default.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png new file mode 100644 index 0000000000..6f301e97ab Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png new file mode 100644 index 0000000000..6f5411a704 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_join_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png new file mode 100644 index 0000000000..ee7fbb5dfe Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_normal.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png new file mode 100644 index 0000000000..0b1873ee8f Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable-xhdpi/module_carchatting_team_invitation_hawk_eye_refuse_pressed.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue.xml new file mode 100644 index 0000000000..be1941fa09 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue_normal.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue_normal.xml new file mode 100644 index 0000000000..e8d86c9442 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue_normal.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue_pressed.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue_pressed.xml new file mode 100644 index 0000000000..c55995839e --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_shape_gradient_blue_pressed.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg.xml new file mode 100644 index 0000000000..83ee0bdebb --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg_normal.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg_normal.xml new file mode 100644 index 0000000000..b9765da6bb --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg_normal.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg_pressed.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg_pressed.xml new file mode 100644 index 0000000000..21bf8c6e8e --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_callchatting_user_pop_call_bg_pressed.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_aicloud_incoming.png b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_aicloud_incoming.png new file mode 100644 index 0000000000..a6aef500e9 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_aicloud_incoming.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_fragment_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_fragment_bg.xml new file mode 100644 index 0000000000..1965671b5d --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_fragment_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_fragment_close.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_fragment_close.xml new file mode 100644 index 0000000000..b369d3a308 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_fragment_close.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_bg.xml new file mode 100644 index 0000000000..28a3d7870b --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_header_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_header_bg.xml new file mode 100644 index 0000000000..ef8a4f7ea6 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_header_bg.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_join.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_join.xml new file mode 100644 index 0000000000..a38fdde074 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_join.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_refuse.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_refuse.xml new file mode 100644 index 0000000000..f934359daf --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_hawk_eye_refuse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_join.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_join.xml new file mode 100644 index 0000000000..12f805d13f --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_join.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_refuse.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_refuse.xml new file mode 100644 index 0000000000..2981370f58 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_refuse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_title_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_title_bg.xml new file mode 100644 index 0000000000..0bd680b478 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_invitation_title_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_quit.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_quit.xml new file mode 100644 index 0000000000..286dfde9e6 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_quit.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_bg.xml new file mode 100644 index 0000000000..c1e6217fbe --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_follower_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_follower_bg.xml new file mode 100644 index 0000000000..e1f1abd61e --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_follower_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_leader_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_leader_bg.xml new file mode 100644 index 0000000000..72421b5d37 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_team_teammate_leader_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_vr_calling_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_vr_calling_bg.xml new file mode 100644 index 0000000000..2b00cf2b11 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_vr_calling_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_vr_team_num_bg.xml b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_vr_team_num_bg.xml new file mode 100644 index 0000000000..ca94787528 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/drawable/module_carchatting_vr_team_num_bg.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_fragment_team_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_fragment_team_view.xml new file mode 100644 index 0000000000..6dff11c8fb --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_fragment_team_view.xml @@ -0,0 +1,42 @@ + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml new file mode 100644 index 0000000000..71ade7e3ea --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_hawk_eye_view.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_view.xml new file mode 100644 index 0000000000..f2029d834a --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_calling_view.xml @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_incoming_hawk_eye_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_incoming_hawk_eye_view.xml new file mode 100644 index 0000000000..799bc5faec --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_incoming_hawk_eye_view.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_team_invitation_hawk_eye_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_team_invitation_hawk_eye_view.xml new file mode 100644 index 0000000000..3e68b3ab98 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_team_invitation_hawk_eye_view.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_team_invitation_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_team_invitation_view.xml new file mode 100644 index 0000000000..48c915f342 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_team_invitation_view.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_teammate_item.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_teammate_item.xml new file mode 100644 index 0000000000..f58bf9d3d5 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_teammate_item.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_user_view.xml b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_user_view.xml new file mode 100644 index 0000000000..1de23819e8 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/layout/module_car_chatting_launcher_user_view.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_match.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_match.png new file mode 100644 index 0000000000..08bcfd78a0 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_match.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_caller.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_caller.png new file mode 100644 index 0000000000..cd5fb91de2 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_caller.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_close.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_close.png new file mode 100644 index 0000000000..aa5d44c24d Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_close.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_join_team.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_join_team.png new file mode 100644 index 0000000000..fc4b862902 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_callchatting_user_join_team.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_caller.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_caller.png new file mode 100644 index 0000000000..0f16300e2e Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_caller.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_default_head_img.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_default_head_img.png new file mode 100644 index 0000000000..97e9ddda74 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_default_head_img.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_launcher_calling_hangup.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_launcher_calling_hangup.png new file mode 100644 index 0000000000..41e7375716 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_launcher_calling_hangup.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_user_cover_bg.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_user_cover_bg.png new file mode 100644 index 0000000000..89153623c3 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-hdpi/module_carchatting_user_cover_bg.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_match.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_match.png new file mode 100644 index 0000000000..08bcfd78a0 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_match.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_caller.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_caller.png new file mode 100644 index 0000000000..a15e56ada7 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_caller.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_close.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_close.png new file mode 100644 index 0000000000..a74b6c7341 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_close.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_join_team.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_join_team.png new file mode 100644 index 0000000000..b49d9f707f Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_callchatting_user_join_team.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_caller.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_caller.png new file mode 100644 index 0000000000..c3cb5f4aaa Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_caller.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_default_head_img.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_default_head_img.png new file mode 100644 index 0000000000..88cd08b75a Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_default_head_img.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_launcher_calling_hangup.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_launcher_calling_hangup.png new file mode 100644 index 0000000000..0fe0ca3fd5 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_launcher_calling_hangup.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_user_cover_bg.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_user_cover_bg.png new file mode 100644 index 0000000000..ab7640f350 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-ldpi/module_carchatting_user_cover_bg.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-mdpi-1920x720/module_callchatting_match.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-mdpi-1920x720/module_callchatting_match.png new file mode 100644 index 0000000000..08bcfd78a0 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-mdpi-1920x720/module_callchatting_match.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_answer.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_answer.png new file mode 100644 index 0000000000..ab8a1f46ef Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_answer.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_hangup.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_hangup.png new file mode 100644 index 0000000000..3bc95a36d5 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_launcher_incoming_hangup.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_caller.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_caller.png new file mode 100644 index 0000000000..cd5fb91de2 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_caller.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_close.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_close.png new file mode 100644 index 0000000000..aa5d44c24d Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_close.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_join_team.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_join_team.png new file mode 100644 index 0000000000..fc4b862902 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_callchatting_user_join_team.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_caller.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_caller.png new file mode 100644 index 0000000000..0f16300e2e Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_caller.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_default_head_img.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_default_head_img.png new file mode 100644 index 0000000000..97e9ddda74 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_default_head_img.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_hawk_eye_default_head_img.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_hawk_eye_default_head_img.png new file mode 100644 index 0000000000..c86d55182a Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_hawk_eye_default_head_img.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_launcher_calling_hangup.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_launcher_calling_hangup.png new file mode 100644 index 0000000000..41e7375716 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_launcher_calling_hangup.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_user_cover_bg.png b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_user_cover_bg.png new file mode 100644 index 0000000000..89153623c3 Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/mipmap-xhdpi/module_carchatting_user_cover_bg.png differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/raw/call.mp3 b/core/function-impl/mogo-core-function-chat/src/main/res/raw/call.mp3 new file mode 100644 index 0000000000..b98f3bdc4b Binary files /dev/null and b/core/function-impl/mogo-core-function-chat/src/main/res/raw/call.mp3 differ diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values-hdpi/dimens.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values-hdpi/dimens.xml new file mode 100644 index 0000000000..295f403713 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values-hdpi/dimens.xml @@ -0,0 +1,116 @@ + + + 872px + 1067px + 776px + 22px + 600px + 140px + 300px + 100px + + 1370px + 30px + 740px + 854px + + 290px + + 355px + 37px + 32px + 39px + 25px + 80px + 72px + 38px + 30px + 30px + 37px + 27px + 26px + 18px + 18px + 10px + 23px + 6px + 82px + 100px + + 82.5px + 150px + 30px + 159px + 8px + 16px + 40px + 15px + 90px + 50px + 70px + 10px + 56px + 30px + + + 48px + 48px + -12px + -122px + 36px + 22px + 22px + 32px + 26px + 22px + 22px + 79.8px + 79.8px + 28.4px + 25px + + + 27.5px + 50px + 36px + 80.8px + 80.8px + 24px + + 14px + 32px + 164px + 98px + 98px + 30px + 34px + 98px + 46px + 26px + + + 230px + 30px + 61px + 18px + 210px + 20px + 822px + 182px + 148px + 148px + 120px + 46px + 30px + 60px + 25px + 30px + 60px + 32px + 98px + 63px + 98px + 36px + 42px + + diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values-ldpi/dimens.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values-ldpi/dimens.xml new file mode 100644 index 0000000000..8c085f2cba --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values-ldpi/dimens.xml @@ -0,0 +1,102 @@ + + + + + 478px + 560px + 338px + 82px + 1543px + 0px + 411px + 474px + 161px + + 338px + 260px + 82px + 27px + 23px + 27px + 25px + 60px + 54px + 28px + 22px + 22px + 18px + 14px + 6px + 18px + 44px + + 45.8px + 83.3px + 16.6px + 88.3px + 5px + 10px + 22px + 10px + 56px + 30px + 39px + 30px + 13px + 17px + + + 26.4px + 26.4px + -6.6px + -66px + 19.8px + 13px + 14.6px + 18px + 14px + 11px + 14.6px + 43.4px + 43.4px + 16.5px + 25px + + + 10px + 28px + 20px + 44px + 44px + 14px + + 8px + 14px + 86px + 56px + 56px + 12.4px + 18px + 54px + 26px + 15px + + + 138px + 21px + 18px + 122px + 82px + 82px + 66px + 26px + 12px + 30px + 14px + 12px + 30px + 18px + 54px + 54px + 20px + diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values-mdpi-1920x720/dimens.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values-mdpi-1920x720/dimens.xml new file mode 100644 index 0000000000..54f7a54824 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values-mdpi-1920x720/dimens.xml @@ -0,0 +1,99 @@ + + + + + 467px + 573px + 338px + 82px + 1543px + 0px + 347px + 374px + 310px + + 422px + 260px + 87px + 27px + 23px + 27px + 25px + 60px + 54px + 28px + 22px + 22px + 24px + 17px + 15px + 23px + 58px + + 55px + 97px + 13px + 75px + 9px + 9px + 23px + 10px + 60px + 20px + 45px + 13px + 17px + + + 48px + 48px + -12px + -120px + 19.8px + 13px + 16px + 18px + 14px + 13px + 16px + 43.4px + 43.4px + 16px + + + 10px + 28px + 20px + 44px + 44px + 14px + + 8px + 14px + 86px + 56px + 56px + 12.4px + 18px + 54px + 26px + 15px + + + 21px + 18px + 122px + 82px + 82px + 66px + 26px + 12px + 9px + 14px + 12px + 9px + 18px + 54px + 54px + 20px + diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values-mdpi/dimens.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values-mdpi/dimens.xml new file mode 100644 index 0000000000..b757d39120 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values-mdpi/dimens.xml @@ -0,0 +1,102 @@ + + + + + 467px + 573px + 338px + 82px + 1543px + 0px + 411px + 474px + 161px + + 338px + 260px + 82px + 27px + 23px + 27px + 25px + 60px + 54px + 28px + 22px + 22px + 18px + 14px + 6px + 18px + 44px + + 45.8px + 83.3px + 16.6px + 88.3px + 5px + 10px + 22px + 10px + 56px + 30px + 39px + 30px + 13px + 17px + + + 26.4px + 26.4px + -6.6px + -66px + 19.8px + 13px + 14.6px + 18px + 14px + 11px + 14.6px + 43.4px + 43.4px + 16.5px + 25px + + + 10px + 28px + 20px + 44px + 44px + 14px + + 8px + 14px + 86px + 56px + 56px + 12.4px + 18px + 54px + 26px + 15px + + + 138px + 21px + 18px + 122px + 82px + 82px + 66px + 26px + 12px + 30px + 14px + 12px + 30px + 18px + 54px + 54px + 20px + diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values-xhdpi-2560x1440/dimens.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values-xhdpi-2560x1440/dimens.xml new file mode 100644 index 0000000000..e264311f06 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -0,0 +1,29 @@ + + + 40px + 1160px + 460px + 144px + 560px + 142px + 20px + 30px + 30px + 28px + 24px + 144px + 88px + 86px + 20px + 26px + 24px + 40px + 144px + 106px + 40px + 27px + 24px + 27px + 34px + 139px + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values-xhdpi/dimens.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values-xhdpi/dimens.xml new file mode 100644 index 0000000000..56261617d8 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values-xhdpi/dimens.xml @@ -0,0 +1,1105 @@ + + + 20px + 18px + 100px + 80px + 30px + 20px + 20px + 20px + 22px + + + -60px + -30px + -20px + -12px + -10px + -8px + -5px + -2px + -1px + 0px + 0.1px + 0.5px + 1px + 1.5px + 2px + 2.5px + 3px + 3.5px + 4px + 4.5px + 5px + 6px + 7px + 7.5px + 8px + 9px + 10px + 11px + 12px + 13px + 14px + 15px + 16px + 17px + 18px + 19px + 20px + 21px + 22px + 23px + 24px + 25px + 26px + 27px + 28px + 29px + 30px + 31px + 32px + 33px + 34px + 35px + 36px + 37px + 38px + 39px + 40px + 41px + 42px + 43px + 44px + 45px + 46px + 47px + 48px + 49px + 50px + 51px + 52px + 53px + 54px + 55px + 56px + 57px + 58px + 59px + 60px + 61px + 62px + 63px + 64px + 65px + 66px + 67px + 68px + 69px + 70px + 71px + 72px + 73px + 74px + 75px + 76px + 77px + 78px + 79px + 80px + 81px + 82px + 83px + 84px + 85px + 86px + 87px + 88px + 89px + 90px + 91px + 92px + 93px + 94px + 95px + 96px + 97px + 98px + 99px + 100px + 101px + 102px + 103px + 104px + 104.5px + 105px + 106px + 107px + 108px + 109px + 110px + 111px + 112px + 113px + 114px + 115px + 116px + 117px + 118px + 119px + 120px + 121px + 122px + 123px + 124px + 125px + 126px + 127px + 128px + 129px + 130px + 131px + 132px + 133px + 134px + 134.5px + 135px + 136px + 137px + 138px + 139px + 140px + 141px + 142px + 143px + 144px + 145px + 146px + 147px + 148px + 149px + 150px + 151px + 152px + 153px + 154px + 155px + 156px + 157px + 158px + 159px + 160px + 161px + 162px + 163px + 164px + 165px + 166px + 167px + 168px + 169px + 170px + 171px + 172px + 173px + 174px + 175px + 176px + 177px + 178px + 179px + 180px + 181px + 182px + 183px + 184px + 185px + 186px + 187px + 188px + 189px + 190px + 191px + 191.25px + 192px + 193px + 194px + 195px + 196px + 197px + 198px + 199px + 200px + 201px + 202px + 203px + 204px + 205px + 206px + 207px + 208px + 209px + 210px + 211px + 212px + 213px + 214px + 215px + 216px + 217px + 218px + 219px + 220px + 221px + 222px + 223px + 224px + 225px + 226px + 227px + 228px + 229px + 230px + 231px + 232px + 233px + 234px + 235px + 236px + 237px + 238px + 239px + 240px + 241px + 242px + 243px + 244px + 245px + 246px + 247px + 248px + 249px + 250px + 251px + 252px + 253px + 254px + 255px + 256px + 257px + 258px + 259px + 260px + 261px + 262px + 263px + 264px + 265px + 266px + 267px + 268px + 269px + 270px + 271px + 272px + 273px + 274px + 275px + 276px + 277px + 278px + 279px + 280px + 281px + 282px + 283px + 284px + 285px + 286px + 287px + 288px + 289px + 290px + 291px + 292px + 293px + 294px + 295px + 296px + 297px + 298px + 299px + 300px + 301px + 302px + 303px + 304px + 305px + 306px + 307px + 308px + 309px + 310px + 311px + 312px + 313px + 314px + 315px + 316px + 317px + 318px + 319px + 320px + 321px + 322px + 323px + 324px + 325px + 326px + 327px + 328px + 329px + 330px + 331px + 332px + 333px + 334px + 335px + 336px + 337px + 338px + 339px + 340px + 341px + 342px + 343px + 344px + 345px + 346px + 347px + 348px + 349px + 350px + 351px + 352px + 353px + 354px + 355px + 356px + 357px + 358px + 359px + 366px + 367px + 368px + 369px + 370px + 371px + 372px + 373px + 374px + 375px + 376px + 377px + 378px + 379px + 380px + 381px + 382px + 383px + 384px + 385px + 386px + 387px + 388px + 389px + 390px + 391px + 392px + 393px + 394px + 395px + 396px + 397px + 398px + 399px + 400px + 401px + 402px + 403px + 404px + 405px + 406px + 407px + 408px + 409px + 410px + 411px + 412px + 413px + 414px + 415px + 416px + 417px + 418px + 419px + 420px + 421px + 422px + 423px + 424px + 425px + 426px + 427px + 428px + 429px + 430px + 431px + 432px + 433px + 434px + 435px + 436px + 437px + 438px + 439px + 440px + 441px + 442px + 443px + 444px + 445px + 446px + 447px + 448px + 449px + 450px + 451px + 452px + 453px + 454px + 455px + 456px + 457px + 458px + 459px + 460px + 461px + 462px + 463px + 464px + 465px + 466px + 467px + 468px + 469px + 470px + 471px + 472px + 473px + 474px + 475px + 476px + 477px + 478px + 479px + 480px + 481px + 482px + 483px + 484px + 485px + 486px + 487px + 488px + 489px + 490px + 491px + 492px + 493px + 494px + 495px + 496px + 497px + 498px + 499px + 500px + 501px + 502px + 503px + 504px + 505px + 506px + 507px + 508px + 509px + 510px + 511px + 512px + 513px + 514px + 515px + 516px + 517px + 518px + 519px + 520px + 521px + 522px + 523px + 524px + 525px + 526px + 527px + 528px + 529px + 530px + 531px + 532px + 533px + 534px + 535px + 536px + 537px + 538px + 539px + 540px + 541px + 542px + 543px + 544px + 545px + 546px + 547px + 548px + 549px + 550px + 551px + 552px + 553px + 554px + 555px + 556px + 557px + 558px + 559px + 560px + 561px + 562px + 563px + 564px + 565px + 566px + 567px + 568px + 569px + 570px + 571px + 572px + 573px + 574px + 575px + 576px + 577px + 578px + 579px + 580px + 581px + 582px + 583px + 584px + 585px + 586px + 587px + 588px + 589px + 590px + 591px + 592px + 593px + 594px + 595px + 596px + 597px + 598px + 599px + 600px + 601px + 602px + 603px + 604px + 605px + 606px + 607px + 608px + 609px + 610px + 611px + 612px + 613px + 614px + 615px + 616px + 617px + 618px + 619px + 620px + 621px + 622px + 623px + 624px + 625px + 626px + 627px + 628px + 629px + 630px + 631px + 632px + 633px + 634px + 635px + 636px + 637px + 638px + 639px + 640px + 641px + 642px + 643px + 644px + 645px + 646px + 647px + 648px + 649px + 650px + 651px + 652px + 653px + 654px + 655px + 656px + 657px + 658px + 659px + 660px + 661px + 662px + 663px + 664px + 665px + 666px + 667px + 668px + 669px + 670px + 671px + 672px + 673px + 674px + 675px + 676px + 677px + 678px + 679px + 680px + 681px + 682px + 683px + 684px + 685px + 686px + 687px + 688px + 689px + 690px + 691px + 692px + 693px + 694px + 695px + 696px + 697px + 698px + 699px + 700px + 701px + 702px + 703px + 704px + 705px + 706px + 707px + 708px + 709px + 710px + 711px + 712px + 713px + 714px + 715px + 716px + 717px + 718px + 719px + 720px + 721px + 722px + 723px + 724px + 725px + 726px + 727px + 728px + 729px + 730px + 731px + 732px + 733px + 734px + 735px + 736px + 737px + 738px + 739px + 740px + 741px + 742px + 743px + 744px + 745px + 746px + 747px + 748px + 749px + 750px + 751px + 752px + 753px + 754px + 755px + 756px + 757px + 758px + 759px + 760px + 761px + 762px + 763px + 764px + 765px + 766px + 767px + 768px + 769px + 770px + 771px + 772px + 773px + 774px + 775px + 776px + 777px + 778px + 779px + 780px + 781px + 782px + 783px + 784px + 785px + 786px + 787px + 788px + 789px + 790px + 791px + 792px + 793px + 794px + 795px + 796px + 797px + 798px + 799px + 800px + 801px + 802px + 803px + 804px + 805px + 806px + 807px + 808px + 809px + 810px + 811px + 812px + 813px + 814px + 815px + 816px + 817px + 818px + 819px + 820px + 821px + 822px + 823px + 824px + 825px + 826px + 827px + 828px + 829px + 830px + 831px + 832px + 833px + 834px + 835px + 836px + 837px + 838px + 839px + 840px + 841px + 842px + 843px + 844px + 845px + 846px + 847px + 848px + 849px + 850px + 851px + 852px + 853px + 854px + 855px + 856px + 857px + 858px + 859px + 860px + 861px + 862px + 863px + 864px + 865px + 866px + 867px + 868px + 869px + 870px + 871px + 872px + 873px + 874px + 875px + 876px + 877px + 878px + 879px + 880px + 881px + 882px + 883px + 884px + 885px + 886px + 887px + 888px + 889px + 890px + 891px + 892px + 893px + 894px + 895px + 896px + 897px + 898px + 899px + 900px + 901px + 902px + 903px + 904px + 905px + 906px + 907px + 908px + 909px + 910px + 911px + 912px + 913px + 914px + 915px + 916px + 917px + 918px + 919px + 920px + 921px + 922px + 923px + 924px + 925px + 926px + 927px + 928px + 929px + 930px + 931px + 932px + 933px + 934px + 935px + 936px + 937px + 938px + 939px + 940px + 941px + 942px + 943px + 944px + 945px + 946px + 947px + 948px + 949px + 950px + 951px + 952px + 953px + 954px + 955px + 956px + 957px + 958px + 959px + 960px + 961px + 962px + 963px + 964px + 965px + 966px + 967px + 968px + 969px + 970px + 971px + 972px + 973px + 974px + 975px + 976px + 977px + 978px + 979px + 980px + 981px + 982px + 983px + 984px + 985px + 986px + 987px + 988px + 989px + 990px + 991px + 992px + 993px + 994px + 995px + 996px + 997px + 998px + 999px + 1300px + 872px + 1067px + 776px + 30px + 600px + 140px + 300px + 100px + + 1380px + 20px + 740px + 854px + + 290px + + 30px + 61px + 26px + 18px + 37px + 27px + 18px + 16px + 23px + 9px + 82px + 100px + 42px + 66px + 822px + 182px + 82.5px + 150px + 30px + 159px + 8px + 16px + 40px + 15px + 90px + 50px + 70px + 10px + 56px + 30px + + 6px + 7px + 8px + 9px + 10px + 11px + 12px + 13px + 14px + 15px + 16px + 17px + 18px + 19px + 20px + 21px + 22px + 23px + 24px + 25px + 28px + 30px + 32px + 34px + 36px + 38px + 40px + 42px + 48px + + diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values/colors.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values/colors.xml new file mode 100644 index 0000000000..d5046a7da3 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values/colors.xml @@ -0,0 +1,14 @@ + + + #FFFFFF + #FFFFFF + #EE433E + #7FFFFFFF + #B5B5B5 + #66D8D8D8 + #66D8D8D8 + + #FFFFFF + + #FFFFFF + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values/dimens.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..98243747e2 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values/dimens.xml @@ -0,0 +1,1155 @@ + + + + + 560px + 142px + 139px + 20px + 30px + 86px + + 467px + 573px + 338px + 82px + + 746px + 2px + 411px + 474px + + 240px + + 338px + 260px + 82px + 27px + 23px + 27px + 25px + 60px + 54px + 28px + 22px + 22px + 24px + 17px + 8px + 23px + 58px + + 45px + 74px + 11px + 63px + 5px + 9px + 20px + 8px + 50px + 17px + 40px + 30px + 5px + 17px + + + 48px + 48px + -12px + -120px + 19.8px + 22px + 22px + 24px + 17px + 22px + 22px + 79.8px + 79.8px + 28.4px + 25px + + + 27.5px + 50px + 36px + 80.8px + 80.8px + 24px + + 14px + 32px + 164px + 98px + 198px + 30px + 34px + 98px + 46px + 26px + + + 30px + 18px + 210px + 148px + 148px + 120px + 46px + 30px + 30px + 25px + 30px + 30px + 32px + 98px + 98px + 36px + + -32.8125px + -16.4062px + -10.9375px + -6.5625px + -5.4688px + -4.3750px + -2.7344px + -1.0938px + -0.5469px + 0.0000px + 0.0547px + 0.2734px + 0.5469px + 0.8203px + 1.0938px + 1.3672px + 1.6406px + 1.9141px + 2.1875px + 2.4609px + 2.7344px + 3.2812px + 3.8281px + 4.1016px + 4.3750px + 4.9219px + 5.4688px + 6.0156px + 6.5625px + 7.1094px + 7.6562px + 8.2031px + 8.7500px + 9.2969px + 9.8438px + 10.3906px + 10.9375px + 11.4844px + 12.0312px + 12.5781px + 13.1250px + 13.6719px + 14.2188px + 14.7656px + 15.3125px + 15.8594px + 16.4062px + 16.9531px + 17.5000px + 18.0469px + 18.5938px + 19.1406px + 19.6875px + 20.2344px + 20.7812px + 21.3281px + 21.8750px + 22.4219px + 22.9688px + 23.5156px + 24.0625px + 24.6094px + 25.1562px + 25.7031px + 26.2500px + 26.7969px + 27.3438px + 27.8906px + 28.4375px + 28.9844px + 29.5312px + 30.0781px + 30.6250px + 31.1719px + 31.7188px + 32.2656px + 32.8125px + 33.3594px + 33.9062px + 34.4531px + 35.0000px + 35.5469px + 36.0938px + 36.6406px + 37.1875px + 37.7344px + 38.2812px + 38.8281px + 39.3750px + 39.9219px + 40.4688px + 41.0156px + 41.5625px + 42.1094px + 42.6562px + 43.2031px + 43.7500px + 44.2969px + 44.8438px + 45.3906px + 45.9375px + 46.4844px + 47.0312px + 47.5781px + 48.1250px + 48.6719px + 49.2188px + 49.7656px + 50.3125px + 50.8594px + 51.4062px + 51.9531px + 52.5000px + 53.0469px + 53.5938px + 54.1406px + 54.6875px + 55.2344px + 55.7812px + 56.3281px + 56.8750px + 57.1484px + 57.4219px + 57.9688px + 58.5156px + 59.0625px + 59.6094px + 60.1562px + 60.7031px + 61.2500px + 61.7969px + 62.3438px + 62.8906px + 63.4375px + 63.9844px + 64.5312px + 65.0781px + 65.6250px + 66.1719px + 66.7188px + 67.2656px + 67.8125px + 68.3594px + 68.9062px + 69.4531px + 70.0000px + 70.5469px + 71.0938px + 71.6406px + 72.1875px + 72.7344px + 73.2812px + 73.5547px + 73.8281px + 74.3750px + 74.9219px + 75.4688px + 76.0156px + 76.5625px + 77.1094px + 77.6562px + 78.2031px + 78.7500px + 79.2969px + 79.8438px + 80.3906px + 80.9375px + 81.4844px + 82.0312px + 82.5781px + 83.1250px + 83.6719px + 84.2188px + 84.7656px + 85.3125px + 85.8594px + 86.4062px + 86.9531px + 87.5000px + 88.0469px + 88.5938px + 89.1406px + 89.6875px + 90.2344px + 90.7812px + 91.3281px + 91.8750px + 92.4219px + 92.9688px + 93.5156px + 94.0625px + 94.6094px + 95.1562px + 95.7031px + 96.2500px + 96.7969px + 97.3438px + 97.8906px + 98.4375px + 98.9844px + 99.5312px + 100.0781px + 100.6250px + 101.1719px + 101.7188px + 102.2656px + 102.8125px + 103.3594px + 103.9062px + 104.4531px + 104.5898px + 105.0000px + 105.5469px + 106.0938px + 106.6406px + 107.1875px + 107.7344px + 108.2812px + 108.8281px + 109.3750px + 109.9219px + 110.4688px + 111.0156px + 111.5625px + 112.1094px + 112.6562px + 113.2031px + 113.7500px + 114.2969px + 114.8438px + 115.3906px + 115.9375px + 116.4844px + 117.0312px + 117.5781px + 118.1250px + 118.6719px + 119.2188px + 119.7656px + 120.3125px + 120.8594px + 121.4062px + 121.9531px + 122.5000px + 123.0469px + 123.5938px + 124.1406px + 124.6875px + 125.2344px + 125.7812px + 126.3281px + 126.8750px + 127.4219px + 127.9688px + 128.5156px + 129.0625px + 129.6094px + 130.1562px + 130.7031px + 131.2500px + 131.7969px + 132.3438px + 132.8906px + 133.4375px + 133.9844px + 134.5312px + 135.0781px + 135.6250px + 136.1719px + 136.7188px + 137.2656px + 137.8125px + 138.3594px + 138.9062px + 139.4531px + 140.0000px + 140.5469px + 141.0938px + 141.6406px + 142.1875px + 142.7344px + 143.2812px + 143.8281px + 144.3750px + 144.9219px + 145.4688px + 146.0156px + 146.5625px + 147.1094px + 147.6562px + 148.2031px + 148.7500px + 149.2969px + 149.8438px + 150.3906px + 150.9375px + 151.4844px + 152.0312px + 152.5781px + 153.1250px + 153.6719px + 154.2188px + 154.7656px + 155.3125px + 155.8594px + 156.4062px + 156.9531px + 157.5000px + 158.0469px + 158.5938px + 159.1406px + 159.6875px + 160.2344px + 160.7812px + 161.3281px + 161.8750px + 162.4219px + 162.9688px + 163.5156px + 164.0625px + 164.6094px + 165.1562px + 165.7031px + 166.2500px + 166.7969px + 167.3438px + 167.8906px + 168.4375px + 168.9844px + 169.5312px + 170.0781px + 170.6250px + 171.1719px + 171.7188px + 172.2656px + 172.8125px + 173.3594px + 173.9062px + 174.4531px + 175.0000px + 175.5469px + 176.0938px + 176.6406px + 177.1875px + 177.7344px + 178.2812px + 178.8281px + 179.3750px + 179.9219px + 180.4688px + 181.0156px + 181.5625px + 182.1094px + 182.6562px + 183.2031px + 183.7500px + 184.2969px + 184.8438px + 185.3906px + 185.9375px + 186.4844px + 187.0312px + 187.5781px + 188.1250px + 188.6719px + 189.2188px + 189.7656px + 190.3125px + 190.8594px + 191.4062px + 191.9531px + 192.5000px + 193.0469px + 193.5938px + 194.1406px + 194.6875px + 195.2344px + 195.7812px + 196.3281px + 200.1562px + 200.7031px + 201.2500px + 201.7969px + 202.3438px + 202.8906px + 203.4375px + 203.9844px + 204.5312px + 205.0781px + 205.6250px + 206.1719px + 206.7188px + 207.2656px + 207.8125px + 208.3594px + 208.9062px + 209.4531px + 210.0000px + 210.5469px + 211.0938px + 211.6406px + 212.1875px + 212.7344px + 213.2812px + 213.8281px + 214.3750px + 214.9219px + 215.4688px + 216.0156px + 216.5625px + 217.1094px + 217.6562px + 218.2031px + 218.7500px + 219.2969px + 219.8438px + 220.3906px + 220.9375px + 221.4844px + 222.0312px + 222.5781px + 223.1250px + 223.6719px + 224.2188px + 224.7656px + 225.3125px + 225.8594px + 226.4062px + 226.9531px + 227.5000px + 228.0469px + 228.5938px + 229.1406px + 229.6875px + 230.2344px + 230.7812px + 231.3281px + 231.8750px + 232.4219px + 232.9688px + 233.5156px + 234.0625px + 234.6094px + 235.1562px + 235.7031px + 236.2500px + 236.7969px + 237.3438px + 237.8906px + 238.4375px + 238.9844px + 239.5312px + 240.0781px + 240.6250px + 241.1719px + 241.7188px + 242.2656px + 242.8125px + 243.3594px + 243.9062px + 244.4531px + 245.0000px + 245.5469px + 246.0938px + 246.6406px + 247.1875px + 247.7344px + 248.2812px + 248.8281px + 249.3750px + 249.9219px + 250.4688px + 251.0156px + 251.5625px + 252.1094px + 252.6562px + 253.2031px + 253.7500px + 254.2969px + 254.8438px + 255.3906px + 255.9375px + 256.4844px + 257.0312px + 257.5781px + 258.1250px + 258.6719px + 259.2188px + 259.7656px + 260.3125px + 260.8594px + 261.4062px + 261.9531px + 262.5000px + 263.0469px + 263.5938px + 264.1406px + 264.6875px + 265.2344px + 265.7812px + 266.3281px + 266.8750px + 267.4219px + 267.9688px + 268.5156px + 269.0625px + 269.6094px + 270.1562px + 270.7031px + 271.2500px + 271.7969px + 272.3438px + 272.8906px + 273.4375px + 273.9844px + 274.5312px + 275.0781px + 275.6250px + 276.1719px + 276.7188px + 277.2656px + 277.8125px + 278.3594px + 278.9062px + 279.4531px + 280.0000px + 280.5469px + 281.0938px + 281.6406px + 282.1875px + 282.7344px + 283.2812px + 283.8281px + 284.3750px + 284.9219px + 285.4688px + 286.0156px + 286.5625px + 287.1094px + 287.6562px + 288.2031px + 288.7500px + 289.2969px + 289.8438px + 290.3906px + 290.9375px + 291.4844px + 292.0312px + 292.5781px + 293.1250px + 293.6719px + 294.2188px + 294.7656px + 295.3125px + 295.8594px + 296.4062px + 296.9531px + 297.5000px + 298.0469px + 298.5938px + 299.1406px + 299.6875px + 300.2344px + 300.7812px + 301.3281px + 301.8750px + 302.4219px + 302.9688px + 303.5156px + 304.0625px + 304.6094px + 305.1562px + 305.7031px + 306.2500px + 306.7969px + 307.3438px + 307.8906px + 308.4375px + 308.9844px + 309.5312px + 310.0781px + 310.6250px + 311.1719px + 311.7188px + 312.2656px + 312.8125px + 313.3594px + 313.9062px + 314.4531px + 315.0000px + 315.5469px + 316.0938px + 316.6406px + 317.1875px + 317.7344px + 318.2812px + 318.8281px + 319.3750px + 319.9219px + 320.4688px + 321.0156px + 321.5625px + 322.1094px + 322.6562px + 323.2031px + 323.7500px + 324.2969px + 324.8438px + 325.3906px + 325.9375px + 326.4844px + 327.0312px + 327.5781px + 328.1250px + 328.6719px + 329.2188px + 329.7656px + 330.3125px + 330.8594px + 331.4062px + 331.9531px + 332.5000px + 333.0469px + 333.5938px + 334.1406px + 334.6875px + 335.2344px + 335.7812px + 336.3281px + 336.8750px + 337.4219px + 337.9688px + 338.5156px + 339.0625px + 339.6094px + 340.1562px + 340.7031px + 341.2500px + 341.7969px + 342.3438px + 342.8906px + 343.4375px + 343.9844px + 344.5312px + 345.0781px + 345.6250px + 346.1719px + 346.7188px + 347.2656px + 347.8125px + 348.3594px + 348.9062px + 349.4531px + 350.0000px + 350.5469px + 351.0938px + 351.6406px + 352.1875px + 352.7344px + 353.2812px + 353.8281px + 354.3750px + 354.9219px + 355.4688px + 356.0156px + 356.5625px + 357.1094px + 357.6562px + 358.2031px + 358.7500px + 359.2969px + 359.8438px + 360.3906px + 360.9375px + 361.4844px + 362.0312px + 362.5781px + 363.1250px + 363.6719px + 364.2188px + 364.7656px + 365.3125px + 365.8594px + 366.4062px + 366.9531px + 367.5000px + 368.0469px + 368.5938px + 369.1406px + 369.6875px + 370.2344px + 370.7812px + 371.3281px + 371.8750px + 372.4219px + 372.9688px + 373.5156px + 374.0625px + 374.6094px + 375.1562px + 375.7031px + 376.2500px + 376.7969px + 377.3438px + 377.8906px + 378.4375px + 378.9844px + 379.5312px + 380.0781px + 380.6250px + 381.1719px + 381.7188px + 382.2656px + 382.8125px + 383.3594px + 383.9062px + 384.4531px + 385.0000px + 385.5469px + 386.0938px + 386.6406px + 387.1875px + 387.7344px + 388.2812px + 388.8281px + 389.3750px + 389.9219px + 390.4688px + 391.0156px + 391.5625px + 392.1094px + 392.6562px + 393.2031px + 393.7500px + 394.2969px + 394.8438px + 395.3906px + 395.9375px + 396.4844px + 397.0312px + 397.5781px + 398.1250px + 398.6719px + 399.2188px + 399.7656px + 400.3125px + 400.8594px + 401.4062px + 401.9531px + 402.5000px + 403.0469px + 403.5938px + 404.1406px + 404.6875px + 405.2344px + 405.7812px + 406.3281px + 406.8750px + 407.4219px + 407.9688px + 408.5156px + 409.0625px + 409.6094px + 410.1562px + 410.7031px + 411.2500px + 411.7969px + 412.3438px + 412.8906px + 413.4375px + 413.9844px + 414.5312px + 415.0781px + 415.6250px + 416.1719px + 416.7188px + 417.2656px + 417.8125px + 418.3594px + 418.9062px + 419.4531px + 420.0000px + 420.5469px + 421.0938px + 421.6406px + 422.1875px + 422.7344px + 423.2812px + 423.8281px + 424.3750px + 424.9219px + 425.4688px + 426.0156px + 426.5625px + 427.1094px + 427.6562px + 428.2031px + 428.7500px + 429.2969px + 429.8438px + 430.3906px + 430.9375px + 431.4844px + 432.0312px + 432.5781px + 433.1250px + 433.6719px + 434.2188px + 434.7656px + 435.3125px + 435.8594px + 436.4062px + 436.9531px + 437.5000px + 438.0469px + 438.5938px + 439.1406px + 439.6875px + 440.2344px + 440.7812px + 441.3281px + 441.8750px + 442.4219px + 442.9688px + 443.5156px + 444.0625px + 444.6094px + 445.1562px + 445.7031px + 446.2500px + 446.7969px + 447.3438px + 447.8906px + 448.4375px + 448.9844px + 449.5312px + 450.0781px + 450.6250px + 451.1719px + 451.7188px + 452.2656px + 452.8125px + 453.3594px + 453.9062px + 454.4531px + 455.0000px + 455.5469px + 456.0938px + 456.6406px + 457.1875px + 457.7344px + 458.2812px + 458.8281px + 459.3750px + 459.9219px + 460.4688px + 461.0156px + 461.5625px + 462.1094px + 462.6562px + 463.2031px + 463.7500px + 464.2969px + 464.8438px + 465.3906px + 465.9375px + 466.4844px + 467.0312px + 467.5781px + 468.1250px + 468.6719px + 469.2188px + 469.7656px + 470.3125px + 470.8594px + 471.4062px + 471.9531px + 472.5000px + 473.0469px + 473.5938px + 474.1406px + 474.6875px + 475.2344px + 475.7812px + 476.3281px + 476.8750px + 477.4219px + 477.9688px + 478.5156px + 479.0625px + 479.6094px + 480.1562px + 480.7031px + 481.2500px + 481.7969px + 482.3438px + 482.8906px + 483.4375px + 483.9844px + 484.5312px + 485.0781px + 485.6250px + 486.1719px + 486.7188px + 487.2656px + 487.8125px + 488.3594px + 488.9062px + 489.4531px + 490.0000px + 490.5469px + 491.0938px + 491.6406px + 492.1875px + 492.7344px + 493.2812px + 493.8281px + 494.3750px + 494.9219px + 495.4688px + 496.0156px + 496.5625px + 497.1094px + 497.6562px + 498.2031px + 498.7500px + 499.2969px + 499.8438px + 500.3906px + 500.9375px + 501.4844px + 502.0312px + 502.5781px + 503.1250px + 503.6719px + 504.2188px + 504.7656px + 505.3125px + 505.8594px + 506.4062px + 506.9531px + 507.5000px + 508.0469px + 508.5938px + 509.1406px + 509.6875px + 510.2344px + 510.7812px + 511.3281px + 511.8750px + 512.4219px + 512.9688px + 513.5156px + 514.0625px + 514.6094px + 515.1562px + 515.7031px + 516.2500px + 516.7969px + 517.3438px + 517.8906px + 518.4375px + 518.9844px + 519.5312px + 520.0781px + 520.6250px + 521.1719px + 521.7188px + 522.2656px + 522.8125px + 523.3594px + 523.9062px + 524.4531px + 525.0000px + 525.5469px + 526.0938px + 526.6406px + 527.1875px + 527.7344px + 528.2812px + 528.8281px + 529.3750px + 529.9219px + 530.4688px + 531.0156px + 531.5625px + 532.1094px + 532.6562px + 533.2031px + 533.7500px + 534.2969px + 534.8438px + 535.3906px + 535.9375px + 536.4844px + 537.0312px + 537.5781px + 538.1250px + 538.6719px + 539.2188px + 539.7656px + 540.3125px + 540.8594px + 541.4062px + 541.9531px + 542.5000px + 543.0469px + 543.5938px + 544.1406px + 544.6875px + 545.2344px + 545.7812px + 546.3281px + 710.9375px + + 3.2812px + 3.8281px + 4.3750px + 4.9219px + 5.4688px + 6.0156px + 6.5625px + 7.1094px + 7.6562px + 8.2031px + 8.7500px + 9.2969px + 9.8438px + 10.3906px + 10.9375px + 11.4844px + 12.0312px + 12.5781px + 13.1250px + 13.6719px + 15.3125px + 16.4062px + 17.5000px + 18.5938px + 19.6875px + 20.7812px + 21.8750px + 22.9688px + 26.2500px + diff --git a/core/function-impl/mogo-core-function-chat/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-chat/src/main/res/values/strings.xml new file mode 100644 index 0000000000..d85fb26674 --- /dev/null +++ b/core/function-impl/mogo-core-function-chat/src/main/res/values/strings.xml @@ -0,0 +1,33 @@ + + CarChatting + 已取消 + 好的 + %1$sm + %1$skm + 用户信息缺失,请稍后再试 + 拨打电话失败,不能打点话给自己 + 已挂断 + 对方无应答 + 正在通话中,请稍后再试 + 当前匹配人数较少,请稍后重试 + 打电话 + 加入车队 + 匹配车友聊天 + 正在为您匹配车友... + 取消 + 等待接听 + 车队通话中... + 点击查看信息 + 退出车队 + 请检查网络状态 + 车友%1$s邀请你加入车队! + + 已邀请 + 对方已有车队 + 有车友邀请你加入车队,你可以对我说,加入或拒绝 + SN 不能为 null + 已加入车队,你可以直接跟队友通话 + 车队已解散 + 当前正在通话中 + 挂断失败 + diff --git a/core/function-impl/mogo-core-function-check/build.gradle b/core/function-impl/mogo-core-function-check/build.gradle index 1ef065fdce..ffa5e9b62b 100644 --- a/core/function-impl/mogo-core-function-check/build.gradle +++ b/core/function-impl/mogo-core-function-check/build.gradle @@ -71,7 +71,7 @@ dependencies { implementation project(':modules:mogo-module-common') implementation project(':modules:mogo-module-service') - implementation project(':modules:mogo-module-carchattingprovider') + //implementation project(':modules:mogo-module-carchattingprovider') implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-utils') diff --git a/core/function-impl/mogo-core-function-main/build.gradle b/core/function-impl/mogo-core-function-main/build.gradle index 46450aada8..9fae680db6 100644 --- a/core/function-impl/mogo-core-function-main/build.gradle +++ b/core/function-impl/mogo-core-function-main/build.gradle @@ -70,8 +70,6 @@ dependencies { api rootProject.ext.dependencies.mogoserviceapi api rootProject.ext.dependencies.moduleservice api rootProject.ext.dependencies.mogoservice - api rootProject.ext.dependencies.callchat - api rootProject.ext.dependencies.callchatprovider api rootProject.ext.dependencies.mapcustom api rootProject.ext.dependencies.crashreportupgrade // api rootProject.ext.dependencies.crashreportbugly @@ -98,8 +96,6 @@ dependencies { api project(':services:mogo-service') api project(':modules:mogo-module-service') - api project(':modules:mogo-module-carchatting') - api project(':modules:mogo-module-carchattingprovider') api project(':libraries:map-custom') api project(':test:crashreport-upgrade') // api project(':test:crashreport-bugly') @@ -118,7 +114,7 @@ dependencies { api project(':core:function-impl:mogo-core-function-devatools') api project(':core:function-impl:mogo-core-function-carcorder') api project(':core:mogo-core-function-call') - + api project(':core:function-impl:mogo-core-function-chat') } } diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java index 06b0cd4dc1..e6aad11a00 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainActivity.java @@ -38,7 +38,6 @@ import com.mogo.map.listener.MogoMapListenerHandler; import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.module.common.MogoApisHandler; -import com.mogo.module.common.api.CallChatApi; import com.mogo.service.IMogoServiceApis; import com.mogo.service.adas.IMogoADASControlStatusChangedListener; import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; @@ -102,17 +101,17 @@ public class MainActivity extends MvpActivity implement FloatingViewHandler.init(mFloatingLayout); - if (CallChatApi.getInstance().getApiProvider() != null) { - CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this); - } -// //申请悬浮窗权限 -// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { -// // 检查是否有悬浮窗权限 -// if (Settings.canDrawOverlays(this)) { -// return; -// } -// PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG); +// if (CallChatApi.getInstance().getApiProvider() != null) { +// CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this); // } + //申请悬浮窗权限 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + // 检查是否有悬浮窗权限 + if (Settings.canDrawOverlays(this)) { + return; + } + PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG); + } } // 隐藏布局 diff --git a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index b659be95fd..dfbbaf44e0 100644 --- a/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-main/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -19,6 +19,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.constants.MoGoConfig; import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.api.chat.biz.ChatConsts; import com.mogo.eagle.core.function.notice.PushUIConstants; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; @@ -26,7 +27,6 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.DeviceUtils; import com.mogo.eagle.core.utilcode.util.ProcessUtils; import com.mogo.map.MapApiPath; -import com.mogo.module.carchatting.card.CallChatConstant; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.MogoModule; import com.mogo.module.common.MogoModulePaths; @@ -307,7 +307,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { // 初始化 apm 日志采集 MogoModulePaths.addBaseModule(new MogoModule(CrashReportConstants.PATH, CrashReportConstants.NAME)); // 车聊聊,IM - MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME)); + MogoModulePaths.addModule(new MogoModule(ChatConsts.CHAT_PROVIDER_PATH, ChatConsts.CHAT_MODULE_NAME)); MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder")); MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY)); diff --git a/core/function-impl/mogo-core-function-v2x/build.gradle b/core/function-impl/mogo-core-function-v2x/build.gradle index 5ec1a4c322..864da85cdb 100644 --- a/core/function-impl/mogo-core-function-v2x/build.gradle +++ b/core/function-impl/mogo-core-function-v2x/build.gradle @@ -7,13 +7,11 @@ plugins { } android { compileSdkVersion rootProject.ext.android.compileSdkVersion - // buildToolsVersion rootProject.ext.android.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion versionCode Integer.valueOf(VERSION_CODE) versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' //ARouter apt 参数 @@ -23,7 +21,6 @@ android { arg("AROUTER_MODULE_NAME", project.getName()) } } - } buildTypes { @@ -63,7 +60,7 @@ dependencies { implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_function_api implementation rootProject.ext.dependencies.mogo_core_function_call - implementation rootProject.ext.dependencies.callchatprovider + //implementation rootProject.ext.dependencies.callchatprovider implementation rootProject.ext.dependencies.mogo_core_res } else { implementation project(':modules:mogo-module-common') @@ -72,7 +69,7 @@ dependencies { implementation project(':core:mogo-core-utils') implementation project(':core:mogo-core-function-api') implementation project(':core:mogo-core-function-call') - implementation project(':modules:mogo-module-carchattingprovider') + //implementation project(':modules:mogo-module-carchattingprovider') implementation project(':core:mogo-core-res') implementation project(':libraries:mogo-adas') diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt index b8c8bae37b..66adce5b28 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/bridge/BridgeApi.kt @@ -10,8 +10,6 @@ import com.mogo.eagle.core.utilcode.util.Utils import com.mogo.map.uicontroller.IMogoMapUIController import com.mogo.module.common.MogoApisHandler import com.mogo.service.statusmanager.IMogoStatusManager -import com.zhidao.carchattingprovider.CallChattingProviderConstant -import com.zhidao.carchattingprovider.ICarsChattingProvider import java.lang.ref.WeakReference import java.util.concurrent.atomic.AtomicReference @@ -29,10 +27,6 @@ internal object BridgeApi { MogoApisHandler.getInstance().apis } - private val carChatProvider by lazy { - ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(context()) as? ICarsChattingProvider - } - private val v2xMarker by lazy { ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context()) as? IMoGoV2XMarkerManager } @@ -77,8 +71,6 @@ internal object BridgeApi { fun overlay() = apis?.mapServiceApi?.getOverlayManager(context()) - fun carChatProvider() = carChatProvider - fun marker() = apis?.mapServiceApi?.getMarkerManager(context()) fun v2xMarker() = v2xMarker diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java index d254f074b9..0f1b290d48 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.java @@ -3,8 +3,10 @@ package com.mogo.eagle.core.function.v2x.events.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; + import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.function.call.chat.CallerChatManager; import com.mogo.eagle.core.function.call.map.CallerSmpManager; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; @@ -13,15 +15,13 @@ import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes; import com.mogo.eagle.core.function.v2x.events.utils.TestOnLineCarUtils; import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; +import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.V2XMessageEntity; import com.mogo.module.common.entity.V2XPushMessageEntity; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.service.statusmanager.IMogoStatusManager; -import com.zhidao.carchattingprovider.ICarsChattingProvider; -import com.zhidao.carchattingprovider.MogoDriverInfo; import java.util.List; -import static android.text.style.TtsSpan.GENDER_MALE; /** * V2X 测试面板广播接收,目的是可以通过广播调用起来面板 @@ -56,16 +56,7 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver { private void dispatchSceneTest(int sceneType) { Logger.d(TAG, "sceneType=" + sceneType); if (sceneType == 0) {//打开用户信息 - MogoDriverInfo mogoDriverInfo = new MogoDriverInfo(); - mogoDriverInfo.setAge(24); - mogoDriverInfo.setGender(GENDER_MALE); - mogoDriverInfo.setSn("12345678"); - mogoDriverInfo.setUserName("测试"); - mogoDriverInfo.setUserHead("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600872867592&di=994e371880ca6ae2814f553e0d0e4139&imgtype=0&src=http%3A%2F%2Fp3.ssl.cdn.btime.com%2Ft014c5d8a1e5cef12ba.jpg%3Fsize%3D506x543"); - ICarsChattingProvider provider = BridgeApi.INSTANCE.carChatProvider(); - if (provider != null) { - provider.showUserWindow("CAR_CALL_USER_TO_" + V2XConst.MODULE_NAME, mogoDriverInfo, mContext); - } + CallerChatManager.INSTANCE.call(Utils.getApp(), "X20202111230C01"); } else if (sceneType == 1) {// 触发道路事件 V2XMessageEntity v2XMessageEntity = TestOnLineCarUtils.getV2XScenarioRoadEventData(); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ChartingUtil.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ChartingUtil.java deleted file mode 100644 index 8c8d6094c0..0000000000 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/ChartingUtil.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.mogo.eagle.core.function.v2x.events.utils; - -import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME; -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; -import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.MarkerUserInfo; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICallChatResponse; -import com.zhidao.carchattingprovider.ICarsChattingProvider; -import org.jetbrains.annotations.Nullable; -import java.util.HashMap; -import java.util.Map; - -/** - * author : donghongyu - * e-mail : 1358506549@qq.com - * date : 2020/4/15 4:26 PM - * desc : 调用车聊聊的工具类 - * version: 1.0 - */ -public class ChartingUtil { - public interface ChartStatusListener { - void canCall(boolean b); - } - - /** - * 调用车聊聊拨打电话 - * - * @param userInfo 用户数据 - * @param location 位置信息 - */ - public static void callChatting(MarkerUserInfo userInfo, MarkerLocation location) { - try { - Map params = new HashMap<>(); - params.put(CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn()); - params.put(CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead()); - params.put(CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + ""); - params.put(CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName()); - params.put(CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + ""); - - if (location != null) { - params.put(CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress()); - params.put(CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + ""); - params.put(CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + ""); - } - - Logger.d(MODULE_NAME, "调用车聊聊传入参数:\n" + params); - ICarsChattingProvider iCarsChattingProvider = BridgeApi.INSTANCE.carChatProvider(); - if ( iCarsChattingProvider != null ) { - iCarsChattingProvider.call(params); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 判断是否可以拨打电话 - * - * @param chartStatusListener 车聊聊状态监听 - */ - public static void isOnLine(String sn, ChartStatusListener chartStatusListener) { - try { - String isMe = MoGoAiCloudClientConfig.getInstance().getSn(); - if (isMe.equals(sn)) { - Logger.d("", "是我的分享"); - if (chartStatusListener != null) { - chartStatusListener.canCall(false); - return; - } - } else { - Logger.d("", "不是我的分享"); - } - ICarsChattingProvider iCarsChattingProvider = BridgeApi.INSTANCE.carChatProvider(); - if (iCarsChattingProvider != null) { - iCarsChattingProvider.isOnLine( - "CAR_CALL_TO_" + V2XConst.MODULE_NAME, - com.mogo.eagle.core.utilcode.util.Utils.getApp(), - sn, - new ICallChatResponse() { - @Override - public void refuse(boolean b, int i) { - - } - - @Override - public void isOnLine(boolean onLine, @Nullable String errorMsg) { - Logger.e(V2XConst.MODULE_NAME, "isOnLine:" + onLine + " errorMsg:" + errorMsg); - if (chartStatusListener != null) { - chartStatusListener.canCall(onLine); - } - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - - } - - /** - * 判断是否可以拨打电话 - * - * @param chartStatusListener 车聊聊状态监听 - */ - public static void isCanCall(ChartStatusListener chartStatusListener) { - try { - ICarsChattingProvider iCarsChattingProvider = BridgeApi.INSTANCE.carChatProvider(); - if (iCarsChattingProvider != null) { - iCarsChattingProvider.canCall( - "CAR_CALL_TO_" + V2XConst.MODULE_NAME, - com.mogo.eagle.core.utilcode.util.Utils.getApp(), - new ICallChatResponse() { - @Override - public void canCall(boolean onLine) { - Logger.e(V2XConst.MODULE_NAME, "isOnLine:" + onLine); - if (chartStatusListener != null) { - chartStatusListener.canCall(onLine); - } - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/BaseResponse.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/BaseResponse.kt index 3e5649b218..faad8af3e3 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/BaseResponse.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/BaseResponse.kt @@ -1,5 +1,3 @@ package com.mogo.eagle.core.data -class BaseResponse(val code: Int, val msg: String, val result: T) { - -} +class BaseResponse(val code: Int, val msg: String, val result: T) diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/UserInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/UserInfo.kt new file mode 100644 index 0000000000..fdfe16a96c --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/UserInfo.kt @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.data.chat + +import android.text.TextUtils +import java.io.Serializable + +class UserInfo : Serializable { + var sn: String = "" + var lat: Double = 0.0 + var lon: Double = 0.0 + var direction: Int = 0 + var canLive: Int = 0 //1:可直播 0:不可直播 + var canVoice: Int = 1 //1:可语音 0:不可语音 + var name: String? = null + var id: Int = 0 //用户ID 进入语音通话间唯一识别号、 + var icon: String? = null + var sex: String? = null + var city: String? = null + var age: String? = null + var brand: String? = null + + + override fun toString(): String { + return "UserInfo(sn='$sn', lat=$lat, lon=$lon, direction=$direction, canLive=$canLive, canVoice=$canVoice, name=$name, id=$id, icon=$icon, sex=$sex, city=$city, age=$age, brand=$brand)" + } + + fun isIncomplete(): Boolean = TextUtils.isEmpty(sn) || TextUtils.isEmpty(name) || TextUtils.isEmpty(icon) +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/HeartBeat.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/HeartBeat.kt new file mode 100644 index 0000000000..010daeb443 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/HeartBeat.kt @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.data.chat.socket + +class HeartBeat { + var msgType:Int = 0 + var sn:String? = null + var roomId:Int = 0 + + constructor(msgType: Int, sn: String?) { + this.msgType = msgType + this.sn = sn + } + + constructor(msgType: Int, sn: String, roomId: Int) { + this.msgType = msgType + this.sn = sn + this.roomId = roomId + } +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/Message.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/Message.kt new file mode 100644 index 0000000000..3fc37369c1 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/Message.kt @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.data.chat.socket + +import androidx.annotation.Keep + +@Keep +class Message { + var roomId: Int = -1 + var snReceiver: String = "" + var snSender: String = "" + var status: Int = 0 + var type: Int = -1 //0:语音通话 1:匹配模式 2:直播 3;车队 + var nickName: String? = null + var headImgUrl: String? = null + var carInfo: String? = null + var lat: Double = 0.0 + var lon: Double = 0.0 + var cardIdSex: String? = null + var cityName: String? = null + var cardIdAge: String? = null + var teamMember: List? = null + + + override fun toString(): String { + return "Message(roomId=$roomId, snReceiver='$snReceiver', snSender='$snSender', status=$status, type=$type, nickName=$nickName, headImgUrl=$headImgUrl, carInfo=$carInfo, lat=$lat, lon=$lon, cardIdSex=$cardIdSex, cityName=$cityName, cardIdAge=$cardIdAge, teamMember=$teamMember)" + } + +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/TeammateInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/TeammateInfo.kt new file mode 100644 index 0000000000..49f19377c4 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/chat/socket/TeammateInfo.kt @@ -0,0 +1,19 @@ +package com.mogo.eagle.core.data.chat.socket + +import androidx.annotation.Keep + +@Keep class TeammateInfo { + var sn: String = "" + var nickName: String? = null + var headImgUrl: String? = null + var cardIdAge: Int = 0 + var cardIdSex: String? = null + var cityName: String? = null + var lat: Double = 0.0 + var lon: Double = 0.0 + var carInfo: String? = null + var vehicleTeamLeader = false + override fun toString(): String { + return "TeammateInfo(sn='$sn', nickName=$nickName, headImgUrl=$headImgUrl, cardIdAge=$cardIdAge, cardIdSex=$cardIdSex, cityName=$cityName, lat=$lat, lon=$lon, carInfo=$carInfo, vehicleTeamLeader=$vehicleTeamLeader)" + } +} \ No newline at end of file diff --git a/core/mogo-core-function-api/build.gradle b/core/mogo-core-function-api/build.gradle index 45ccba2017..a9303fa9ca 100644 --- a/core/mogo-core-function-api/build.gradle +++ b/core/mogo-core-function-api/build.gradle @@ -38,7 +38,6 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - } dependencies { @@ -46,7 +45,8 @@ dependencies { implementation rootProject.ext.dependencies.kotlinstdlibjdk7 implementation rootProject.ext.dependencies.arouter kapt rootProject.ext.dependencies.aroutercompiler - + implementation rootProject.ext.dependencies.coroutinescore + implementation rootProject.ext.dependencies.coroutinesandroid if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data } else { diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/IMoGoChatProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/IMoGoChatProvider.kt new file mode 100644 index 0000000000..e12cef1c5b --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/IMoGoChatProvider.kt @@ -0,0 +1,9 @@ +package com.mogo.eagle.core.function.api.chat + +import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider +import com.mogo.eagle.core.function.api.chat.biz.IMoGoChatFacade + +interface IMoGoChatProvider: IMoGoFunctionServerProvider { + + fun chat(): IMoGoChatFacade +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/ChatConsts.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/ChatConsts.kt new file mode 100644 index 0000000000..f7262ec2c5 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/ChatConsts.kt @@ -0,0 +1,13 @@ +package com.mogo.eagle.core.function.api.chat.biz + +class ChatConsts { + + companion object{ + + const val TAG = "CALL_CHATTING" + + const val CHAT_PROVIDER_PATH = "/callchat/provider" + + const val CHAT_MODULE_NAME = "CARD_TYPE_CARS_CHATTING" + } +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/ChatParams.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/ChatParams.kt new file mode 100644 index 0000000000..6ef5cfa85c --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/ChatParams.kt @@ -0,0 +1,12 @@ +package com.mogo.eagle.core.function.api.chat.biz + +data class ChatParams( + val sn: String, + val carTypeName: String? = null, + val name: String? = null, + val age: Int = 0, + val sex: String = "未设置", + val iconUrl: String? = null, + val lat: Double = 0.0, + val lon: Double = 0.0, +) diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMCallType.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMCallType.kt new file mode 100644 index 0000000000..829288a9fa --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMCallType.kt @@ -0,0 +1,12 @@ +package com.mogo.eagle.core.function.api.chat.biz + +enum class IMCallType constructor(val type: Int) { + + CALL_TYPE_DEFAULT(-1), + + CALL_TYPE_VOICE(0), + + CALL_TYPE_VEHICLE_TEAM(3); + + fun isTeam(): Boolean = this == CALL_TYPE_VEHICLE_TEAM +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMType.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMType.kt new file mode 100644 index 0000000000..b6a5b50007 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMType.kt @@ -0,0 +1,31 @@ +package com.mogo.eagle.core.function.api.chat.biz + + +enum class IMType(val imType: Int) { + INIT_CALL(1000), + READY_TO_CALL_SENDER(1001), + READY_TO_CALL_RECEIVER(1002), + CALLING_SENDER(1003), + CALLING_RECEIVER(1004); + + fun toText() = when (this) { + INIT_CALL -> "初始状态" + READY_TO_CALL_SENDER -> "呼叫状态" + READY_TO_CALL_RECEIVER -> "呼入状态" + CALLING_SENDER -> "通话状态-当前用户是呼叫方" + CALLING_RECEIVER -> "通话状态-当前用户是接收方" + } +} + +fun IMType.isInit():Boolean{ + return this == IMType.INIT_CALL +} + +fun IMType.isCalling(): Boolean { + return this in IMType.CALLING_SENDER..IMType.CALLING_RECEIVER +} + +fun IMType.isReadyCalling(): Boolean { + return this in IMType.READY_TO_CALL_SENDER..IMType.READY_TO_CALL_RECEIVER +} + diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMoGoChatFacade.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMoGoChatFacade.kt new file mode 100644 index 0000000000..e77c682d31 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/IMoGoChatFacade.kt @@ -0,0 +1,204 @@ +package com.mogo.eagle.core.function.api.chat.biz + +import android.content.Context +import android.media.AudioManager +import com.mogo.eagle.core.data.chat.UserInfo +import kotlinx.coroutines.flow.Flow + +interface IMoGoChatFacade { + + /** + * 监听来电状态 + * isTeam: 是否是车队类型 + * user: 发送者用户数据 + */ + fun onInComingCall(cb: (isTeam: Boolean, user: UserInfo) -> Unit) + + /** + * 呼出方,呼出又挂断 + * isTeam: 是否车队类型 + * user: 发送者用户数据 + */ + fun onCallingInterrupt(cb: (isTeam: Boolean, user: UserInfo) -> Unit) + + /** + * 当前用户是否可以发起呼叫 + */ + fun canCall(): Boolean + + /** + * 当前用户是否可以收到来电 + */ + fun canAnswer(): Boolean + + /** + * 主动拨打电话给某人 + */ + fun call(params: ChatParams): Flow + + /** + * 响应发送者通话请求 + * @param sn: 发送者车机sn + */ + fun answer(sn: String): Flow + + /** + * 通话中,主动挂断电话 + * @param sn: 接收者车机sn + * @param cb: 挂断电话后的状态回调 + */ + fun handUp(sn: String): Flow + + /** + * 来电时,主动拒接他车通话请求 + * @param sn: 发送者车机sn + * @param cb: 拒接来电状态回调 + */ + fun refuse(sn: String): Flow + + /** + * 邀请某司机加入车队 + * @param sn: 接收者车机sn + */ + fun inviteJoinVehicleTeam(sn: String): Flow + + /** + * 加入某车队 + */ + fun joinVehicleTeam(sn: String): Flow + + /** + * 通话中,调起静音接口 + * @param mute: true - 静音开启, false - 静音关闭 + */ + fun muteVoice(mute: Boolean) + + /** + * 音频焦点管理类 + */ + fun audioFocus(): IMoGoAudioFocusFacade + + /** + * 语音控制管理类 + */ + fun voice(): IMoGoVoiceControlFacade + + /** + * 媒体管理类 + */ + fun media(): IMoGoMediaFacade + + /** + * 统计相关的 + */ + fun analytics(): IMoGoAnalyticsFacade +} + +interface IMoGoAudioFocusFacade { + + /** + * 获取音频焦点 + */ + fun requireAudioFocus(onGetFocus: () -> Unit) + + /** + * 释放音频焦点 + */ + fun releaseAudioFocus() +} + +interface IMoGoVoiceControlFacade { + + /** + * 注册 + */ + fun register() + + /** + * 播放语音 + * @param context : 当前上下文环境 + * @param content : 语音播放内容 + * @param listener: 语音相关回调 + */ + fun speak(context: Context, content: String, listener: IMoGoVoiceCallback) + + /** + * 注册车队通话免唤醒词 + */ + fun registerInviteJoinTeam(context: Context, listener: IMoGoVoiceCallback) + + /** + * 注册车队通话免唤醒词 + */ + fun registerJoinTeam(context: Context, listener: IMoGoVoiceCallback) + + /** + * 反注册车队通话免唤醒词 + */ + fun unRegisterInviteJoinTeam(context: Context) + + /** + * 反注册车队通话免唤醒词 + */ + fun unRegisterJoinTeam(context: Context) + + /** + * 注册来电免唤醒词 + */ + fun registerIntentInComingCall(listener: IMoGoVoiceCallback) + + /** + * 反注册来电免唤醒词 + */ + fun unRegisterIntentInComingCall(context: Context) + + /** + * 注册问答式免唤醒词 + */ + fun speakAndRegisterCall(onCmdAgree: ((Boolean) -> Unit), onSpeakFinish: (() -> Unit), listener: IMoGoVoiceCallback) + + /** + * 停止播报 + */ + fun stopTTS(context: Context, text: String) + + /** + * 解注册 + */ + fun unRegister() + + interface IMoGoVoiceCallback { + + fun onVoiceCancelCall() {} + + fun onVoiceInviteJoinTeam() {} + + fun onVoiceJoinTeam() {} + + fun onVoiceRefuseJoinTeam() {} + + fun onSpeakEnd() {} + + fun onVoiceAnswerCall() {} + + fun onVoiceRefuseCall() {} + } +} + +interface IMoGoMediaFacade { + + /** + * 播放音频 + */ + fun play(context: Context, audioSources: Int, isLoop: Boolean = false, channel:Int = AudioManager.STREAM_MUSIC) + + /** + * 释放音频 + */ + fun release() +} + +interface IMoGoAnalyticsFacade { + + fun track(eventType: String, data: Map? = hashMapOf()) +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/State.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/State.kt new file mode 100644 index 0000000000..cb4e2e684d --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/chat/biz/State.kt @@ -0,0 +1,555 @@ +package com.mogo.eagle.core.function.api.chat.biz + +import androidx.annotation.IntDef +import com.mogo.eagle.core.data.chat.socket.Message +import com.mogo.eagle.core.data.chat.socket.TeammateInfo + +/** + * 呼叫状态 + */ +sealed class CallState { + + /** + * 呼叫开始 + */ + object Init: CallState() + + /** + * 接收者同意呼叫 + * @param isTeam: 是否是车队成员同意 + * @param msg: 同意后的下行数据 + */ + class AgreeCall(val isTeam: Boolean, val msg: Message): CallState() + + /** + * 接收者拒绝呼叫 + * @param isTeam: 是否是车队成员同意 + * @param msg: 拒绝后的下行数据 + */ + class RefuseCall(val isTeam: Boolean, val msg: Message): CallState() + + /** + * 发送者进房成功 + */ + object EnterRoomSuccess: CallState() + + /** + * 房间成员退出/进入房间 + * @param isEnter: true - 进入房间; false - 退出房间 + * @param hasMember: true - 除了自己是否还有成员; false - 除了自己没有其它成员 + */ + class RoomMemberUpdate(val isMySelf: Boolean, val isEnter: Boolean, val members: List? = emptyList()): CallState() + + + /** + * 当前用户退房成功 + */ + object ExitRoomSuccess: CallState() + + /** + * 对方挂断 + * @param isTeam: 表示是否是车队类型 + * @param msg: 下行数据 + */ + class HangUp(val isTeam: Boolean, val msg: Message): CallState() + + /** + * 错误状态, 业务层收到此状态要关闭呼叫页面 + */ + class Error(@ErrorCode val code: Int, val msg: String, val extra: Map? = null): CallState() + + companion object { + /** + * 呼叫状态错误 + */ + const val CODE_CALL_STATE_ERROR = 0 + + /** + * 长链接未连接 + */ + const val CODE_CALL_SOCKET_DISCONNECT = 1 + + /** + * 关键参数不完整,一般是sn参数不存在或为空 + */ + const val CODE_CALL_PARAMS_INCOMPLETE = 2 + + /** + * 呼叫自己 + */ + const val CODE_CALL_MYSELF = 3 + + /** + * Gme Sdk初始化失败 + */ + const val CODE_GME_INIT_FAIL = 4 + + /** + * 获取当前用户(呼叫方)用户信息失败 + */ + const val CODE_CALLER_USER_INFO_FAIL = 5 + + + /** + * 接收方不在线 + */ + const val CODE_ANSWER_OFFLINE = 6 + + /** + * 获取房间数据失败 + */ + const val CODE_ROOM_INFO_FAIL = 7 + + /** + * 用户已经进房 + */ + const val CODE_USER_IN_ROOM = 8 + + /** + * 进入房间失败 + */ + const val CODE_ENTER_ROOM_FAIL = 9 + + /** + * 未知错误 + */ + const val CODE_UNKNOWN_ERROR = 10 + } + @IntDef( + CODE_CALL_STATE_ERROR, + CODE_CALL_SOCKET_DISCONNECT, + CODE_CALL_PARAMS_INCOMPLETE, + CODE_CALL_MYSELF, + CODE_GME_INIT_FAIL, + CODE_CALLER_USER_INFO_FAIL, + CODE_ANSWER_OFFLINE, + CODE_ROOM_INFO_FAIL, + CODE_USER_IN_ROOM, + CODE_ENTER_ROOM_FAIL, + CODE_UNKNOWN_ERROR + ) + @Retention(AnnotationRetention.SOURCE) + annotation class ErrorCode +} + +/** + * 响应状态 + */ +sealed class AnswerState { + /** + * 初始状态 + */ + object Init: AnswerState() + + /** + * 异常状态 + */ + class Error(@ErrorCode val code: Int, val msg: String, val extra: Map? = null): AnswerState() + + + /** + * 应答者进房成功 + */ + object EnterRoomSuccess: AnswerState() + + /** + * 应答者退房成功 + */ + object ExitRoomSuccess: AnswerState() + + + /** + * 接受车队邀请 + */ + class AcceptTeamInvite(val msg: Message): AnswerState() + + /** + * 拒绝车队邀请 + */ + class RefuseTeamInvite(val msg: Message): AnswerState() + + /** + * 房间成员退出/进入房间 + * @param isMySelf: 是否是自己进出房间 + * @param isEnter: true - 进入房间; false - 退出房间 + * @param hasMember: true - 除了自己是否还有成员; false - 除了自己没有其它成员 + */ + class RoomMemberUpdate(val isMySelf: Boolean, val isEnter: Boolean, val members: List? = emptyList()): AnswerState() + + + /** + * 对方挂断 + */ + class HangUp(val isTeam: Boolean, val msg: Message): AnswerState() + + + companion object { + /** + * 应答状态错误 + */ + const val CODE_ANSWER_STATE_ERROR = -1 + + /** + * 长链接未连接 + */ + const val CODE_ANSWER_SOCKET_DISCONNECT = -2 + + /** + * 应答者数据缺失, 一般是sn参数不存在或为空 + */ + const val CODE_ANSWER_PARAMS_INCOMPLETE = -3 + + /** + * 应答自己 + */ + const val CODE_ANSWER_MYSELF = -4 + + /** + * Gme Sdk初始化失败 + */ + const val CODE_GME_INIT_FAIL = -5 + + /** + * 获取当前用户(应答方)用户信息失败 + */ + const val CODE_ANSWER_USER_INFO_FAIL = -6 + + /** + * 获取呼叫方(发送方)用户信息失败 + */ + const val CODE_CALLER_USER_INFO_FAIL = -7 + + /** + * 应答者退房失败 + */ + const val CODE_ANSWER_EXIT_ROOM_FAIL = -9 + + /** + * 应答网络请求API失败 + */ + const val CODE_ANSWER_API_REQ_FAIL = -10 + + /** + * 未知错误 + */ + const val CODE_UNKNOWN_ERROR = -11 + + } + @IntDef( + CODE_ANSWER_STATE_ERROR, + CODE_ANSWER_SOCKET_DISCONNECT, + CODE_ANSWER_PARAMS_INCOMPLETE, + CODE_ANSWER_MYSELF, + CODE_GME_INIT_FAIL, + CODE_ANSWER_USER_INFO_FAIL, + CODE_CALLER_USER_INFO_FAIL, + CODE_ANSWER_EXIT_ROOM_FAIL, + CODE_ANSWER_API_REQ_FAIL + ) + @Retention(AnnotationRetention.SOURCE) + annotation class ErrorCode +} + +/** + * 挂断状态 + */ +sealed class HangUpState { + + /** + * 初始状态 + */ + object Init: HangUpState() + + /** + * 挂断失败 + */ + class Error(@ErrorCode val code: Int, val msg: String, val extra: Map? = null): HangUpState() + + /** + * 挂断成功 + */ + object Success: HangUpState() + + + companion object { + /** + * 挂断状态错误 + */ + const val CODE_HANG_UP_STATE_ERROR = -1 + + /** + * 网络请求失败 + */ + const val CODE_HANG_UP_API_ERROR = -2 + + /** + * 当前用户尚未进入房间 + */ + const val CODE_HANG_UP_NOT_IN_ROOM = -3 + + /** + * 当前用户退出房间失败 + */ + const val CODE_HANG_UP_EXIT_ROOM_ERROR = -4 + + /** + * 未知错误 + */ + const val CODE_UNKNOWN_ERROR = -5 + } + + @IntDef( + CODE_HANG_UP_STATE_ERROR, + CODE_HANG_UP_API_ERROR, + CODE_HANG_UP_NOT_IN_ROOM, + CODE_HANG_UP_EXIT_ROOM_ERROR, + CODE_UNKNOWN_ERROR + ) + @Retention(AnnotationRetention.SOURCE) + annotation class ErrorCode +} + +/** + * 拒绝状态 + */ +sealed class RefuseState { + + /** + * 初始状态 + */ + object Init: RefuseState() + + /** + * 错误状态 + */ + class Error(@ErrorCode val code: Int, val msg: String, val extra: Map? = null): RefuseState() + + /** + * 成功 + */ + object Success: RefuseState() + + + companion object { + /** + * 拒绝状态错误 + */ + const val CODE_REFUSE_STATE_ERROR = -1 + + /** + * 网络请求失败 + */ + const val CODE_REFUSE_API_ERROR = -2 + + /** + * 当前用户已经进房,不能拒绝 + */ + const val CODE_REFUSE_IS_IN_ROOM = -3 + + /** + * 未知错误 + */ + const val CODE_UNKNOWN_ERROR = -4 + } + + @IntDef( + CODE_REFUSE_STATE_ERROR, + CODE_REFUSE_API_ERROR, + CODE_REFUSE_IS_IN_ROOM, + CODE_UNKNOWN_ERROR + ) + @Retention(AnnotationRetention.SOURCE) + annotation class ErrorCode +} + +/** + * 车队邀请状态 + */ +sealed class InviteState { + + /** + * 初始状态 + */ + object Init: InviteState() + + /** + * 错误状态 + */ + class Error(@ErrorCode val code: Int, val msg: String, val extra: Map? = null): InviteState() + + + /** + * 进房成功 + */ + object EnterRoomSuccess: InviteState() + + /** + * 退房成功 + */ + object ExitRoomSuccess: InviteState() + + /** + * 邀请被拒 + */ + object Refused: InviteState() + + + class RoomMemberUpdate(val isMySelf: Boolean, val isEnter: Boolean, val members: List? = emptyList()): InviteState() + + + companion object { + /** + * 拒绝状态错误 + */ + const val CODE_INVITE_STATE_ERROR = -1 + + /** + * 网络请求失败 + */ + const val CODE_INVITE_API_ERROR = -2 + + /** + * 邀请自己 + */ + const val CODE_INVITE_TO_MYSELF = -3 + + /** + * sn不存在 + */ + const val CODE_INVITE_SN_NOT_IN = -4 + + /** + * 用户信息请求失败 + */ + const val CODE_INVITE_USR_REQ_ERROR = -5 + + /** + * 进入房间失败 + */ + const val CODE_ENTER_ROOM_FAIL = -6 + + /** + * GME初始化失败 + */ + const val CODE_GME_INIT_FAIL = -7 + + /** + * 被邀请方不在线 + */ + const val CODE_INVITEE_OFFLINE = -8 + + /** + * 未知错误 + */ + const val CODE_UNKNOWN_ERROR = -9 + } + + @IntDef( + CODE_INVITE_STATE_ERROR, + CODE_INVITE_API_ERROR, + CODE_INVITE_TO_MYSELF, + CODE_INVITE_SN_NOT_IN, + CODE_INVITE_USR_REQ_ERROR, + CODE_ENTER_ROOM_FAIL, + CODE_GME_INIT_FAIL + ) + @Retention(AnnotationRetention.SOURCE) + annotation class ErrorCode +} + +sealed class JoinState { + + /** + * 初始状态 + */ + object Init: JoinState() + + /** + * 错误状态 + */ + class Error(@ErrorCode val code: Int, val msg: String, val extra: Map? = null): JoinState() + + /** + * 进入房间成功 + */ + object EnterRoomSuccess: JoinState() + + /** + * 退出房间成功 + */ + object ExitRoomSuccess: JoinState() + + /** + * 房间成员更新 + */ + class RoomMemberUpdate(val isMySelf: Boolean, val isEnter: Boolean, val members: List? = emptyList()): JoinState() + + companion object { + + /** + * 网络请求失败 + */ + const val CODE_JOIN_API_ERROR = -1 + + /** + * 用户信息请求失败 + */ + const val CODE_JOIN_USR_REQ_ERROR = -2 + + /** + * sn不存在 + */ + const val CODE_JOIN_SN_NOT_IN = -3 + + /** + * 加入自己 + */ + const val CODE_JOIN_TO_MYSELF = -4 + + /** + * 当前用户状态不对 + */ + const val CODE_INVITE_STATE_ERROR = -5 + + /** + * 长链接断开 + */ + const val CODE_INVITE_STATE_SOCKET_DISCONNECT = -6 + + const val CODE_CALLER_USER_INFO_FAIL = -7 + + const val CODE_ENTER_ROOM_FAIL = -8 + + const val CODE_GME_INIT_FAIL = -9 + + /** + * 未知错误 + */ + const val CODE_UNKNOWN_ERROR = -10 + } + + @IntDef( + CODE_JOIN_API_ERROR, + CODE_JOIN_USR_REQ_ERROR, + CODE_JOIN_SN_NOT_IN, + CODE_JOIN_TO_MYSELF, + CODE_INVITE_STATE_ERROR, + CODE_INVITE_STATE_SOCKET_DISCONNECT, + CODE_CALLER_USER_INFO_FAIL, + CODE_ENTER_ROOM_FAIL, + CODE_GME_INIT_FAIL + ) + @Retention(AnnotationRetention.SOURCE) + annotation class ErrorCode +} + + + + + + + + + + + diff --git a/core/mogo-core-function-call/build.gradle b/core/mogo-core-function-call/build.gradle index 9ac8df1466..517cf23278 100644 --- a/core/mogo-core-function-call/build.gradle +++ b/core/mogo-core-function-call/build.gradle @@ -7,7 +7,6 @@ plugins { } android { compileSdkVersion rootProject.ext.android.compileSdkVersion - // buildToolsVersion rootProject.ext.android.buildToolsVersion defaultConfig { minSdkVersion rootProject.ext.android.minSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion @@ -45,16 +44,19 @@ dependencies { implementation rootProject.ext.dependencies.kotlinstdlibjdk7 implementation rootProject.ext.dependencies.arouter + kapt rootProject.ext.dependencies.aroutercompiler if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_function_api + implementation rootProject.ext.dependencies.mogoserviceapi } else { implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-utils') implementation project(':core:mogo-core-function-api') + implementation project(':services:mogo-service-api') } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/chat/CallerChatManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/chat/CallerChatManager.kt new file mode 100644 index 0000000000..7be20fc841 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/chat/CallerChatManager.kt @@ -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 +} \ No newline at end of file diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt index 1338c8e388..c7ad99afb6 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt @@ -4,18 +4,19 @@ import android.content.Context import android.graphics.Color import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable +import android.text.TextUtils import android.util.TypedValue import android.view.View import androidx.annotation.ColorInt import androidx.annotation.IntRange import androidx.core.view.ViewCompat -import androidx.lifecycle.Lifecycle -import androidx.lifecycle.LifecycleEventObserver -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.LifecycleRegistry +import androidx.lifecycle.* +import androidx.lifecycle.Lifecycle.Event import com.mogo.eagle.core.utilcode.util.ClickUtils import com.mogo.eagle.core.utilcode.util.R import com.mogo.eagle.core.utilcode.util.Utils +import kotlinx.coroutines.* +import kotlinx.coroutines.channels.Channel import java.util.* val T.lifecycleOwner: LifecycleOwner @@ -72,6 +73,37 @@ fun View.onClick(block: (View) -> Unit) { } } +val T.lifeCycleScope: LifecycleCoroutineScope + get() = (this as? LifecycleOwner)?.lifecycleScope ?: ProcessLifecycleOwner.get().lifecycleScope + +fun T.observe(target: Array, block: ((event: Event) -> Unit) ?= null) { + block?.let { + this.lifecycleOwner.lifecycle.addObserver(object : LifecycleEventObserver { + override fun onStateChanged(source: LifecycleOwner, event: Event) { + if (target.contains(event)) { + it.invoke(event) + } + } + }) + } +} + +fun Job.safeCancel(cause: String? = null) = try { + this.cancel(if (TextUtils.isEmpty(cause)) null else CancellationException(cause)) +} catch (t: Throwable) { t.printStackTrace() } + +fun CoroutineScope.safeCancel(cause: String? = null) = try { + this.cancel(if (TextUtils.isEmpty(cause)) null else CancellationException(cause)) +} catch (t: Throwable) { t.printStackTrace() } + +fun Channel.safeCancel(cause: String? = null) = try { + this.cancel(if (TextUtils.isEmpty(cause)) null else CancellationException(cause)) +} catch (t: Throwable) { t.printStackTrace() } + +fun Deferred.safeCancel(cause: String? = null) = try { + this.cancel(if (TextUtils.isEmpty(cause)) null else CancellationException(cause)) +} catch (t: Throwable) { t.printStackTrace() } + fun shape(@ColorInt solid: Int = Color.TRANSPARENT, @ColorInt stroke: Int = Color.TRANSPARENT, @IntRange(from = 0) strokeWidth: Int = 0, @IntRange(from = 0) radius: Int = 0, radii: FloatArray = FloatArray(8).apply { Arrays.fill(this, radius.toFloat()) }, shape: Int = GradientDrawable.RECTANGLE): Drawable { val drawable = GradientDrawable() drawable.shape = shape diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java index 1e44253913..e82067d439 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/util/ClickUtils.java @@ -632,11 +632,10 @@ public class ClickUtils { if (Math.abs(now - past) < (long)duration) { return true; } - view.setTag(R.id.tag_click_time, now); - } catch (Exception var7) { + } catch (Exception ex) { + ex.printStackTrace(); } - return false; } } diff --git a/modules.txt b/modules.txt index 22e495653a..a6af95ed7e 100644 --- a/modules.txt +++ b/modules.txt @@ -14,10 +14,7 @@ :libraries:map-custom :libraries:mogo-map :libraries:mogo-adas -:modules:mogo-module-carchattingprovider :modules:mogo-module-common -:modules:mogo-module-chat -:modules:mogo-module-carchatting :test:crashreport :test:crashreport-apm :test:crashreport-noop @@ -32,5 +29,6 @@ :core:function-impl:mogo-core-function-monitoring :core:function-impl:mogo-core-function-notice :core:function-impl:mogo-core-function-v2x +:core:function-impl:mogo-core-function-chat :core:function-impl:mogo-core-function-devatools :core:function-impl:mogo-core-function-main \ No newline at end of file diff --git a/modules/mogo-module-carchatting/build.gradle b/modules/mogo-module-carchatting/build.gradle index cd44fd3445..665003d96b 100644 --- a/modules/mogo-module-carchatting/build.gradle +++ b/modules/mogo-module-carchatting/build.gradle @@ -79,7 +79,7 @@ dependencies { implementation rootProject.ext.dependencies.mogo_core_data } else { - compileOnly project(':modules:mogo-module-carchattingprovider') + //compileOnly project(':modules:mogo-module-carchattingprovider') api project(":libraries:mogo-map") api project(':core:mogo-core-utils') diff --git a/modules/mogo-module-chat/consumer-rules.pro b/modules/mogo-module-chat/consumer-rules.pro index 5fd8969570..9399a921c5 100644 --- a/modules/mogo-module-chat/consumer-rules.pro +++ b/modules/mogo-module-chat/consumer-rules.pro @@ -6,7 +6,7 @@ -keep class com.mogo.chat.model.*{*;} -keep class com.mogo.chat.net.*{*;} -keep class com.mogo.chat.service.InvokeDataProxy{*;} --keep class com.mogo.chat.util.audio.IAudioFocus{*;} +-keep class com.mogo.eagle.core.function.chat.utils.IAudioFocus{*;} -keep class com.mogo.chat.util.sp.SharedPreferenceUtil{*;} -keep class com.mogo.chat.util.AnalyticsUtilKt{*;} -keep class com.mogo.chat.util.LogUtil{*;} diff --git a/modules/mogo-module-common/build.gradle b/modules/mogo-module-common/build.gradle index 49b6b6cbf6..a313fb0ef6 100644 --- a/modules/mogo-module-common/build.gradle +++ b/modules/mogo-module-common/build.gradle @@ -75,8 +75,6 @@ dependencies { api rootProject.ext.dependencies.mogomapapi api rootProject.ext.dependencies.mogocommons api rootProject.ext.dependencies.mogoserviceapi - implementation rootProject.ext.dependencies.callchatprovider - api rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_function_call @@ -85,8 +83,6 @@ dependencies { api project(":libraries:mogo-map-api") api project(":foudations:mogo-commons") api project(':services:mogo-service-api') - implementation project(':modules:mogo-module-carchattingprovider') - api project(':core:mogo-core-utils') implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-function-call') diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java index 030a664a5a..979189bf3e 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/api/CallChatApi.java @@ -2,11 +2,7 @@ package com.mogo.module.common.api; import android.content.Context; -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.module.common.entity.MarkerOnlineCar; -import com.zhidao.carchattingprovider.ICarsChattingProvider; -import com.zhidao.carchattingprovider.MogoDriverInfo; public /** @@ -22,7 +18,7 @@ class CallChatApi { private static volatile CallChatApi sInstance; private CallChatApi() { - mApiProvider = ARouter.getInstance().navigation( ICarsChattingProvider.class ); + //mApiProvider = ARouter.getInstance().navigation( ICarsChattingProvider.class ); } public static CallChatApi getInstance() { @@ -45,37 +41,24 @@ class CallChatApi { return sInstance; } - public ICarsChattingProvider getApiProvider() { - return mApiProvider; - } - - private ICarsChattingProvider mApiProvider; - public void showUserWindow( Context context, MarkerOnlineCar onlineCar ) throws Exception { - if ( mApiProvider == null ) { - Logger.e( TAG, "no call chat api instance." ); - return; - } - MogoDriverInfo driverInfo = new MogoDriverInfo(); - driverInfo.setAge( onlineCar.getUserInfo().getAgeNumber() ); - driverInfo.setCarTypeName( onlineCar.getCarInfo().getCarTypeName() ); - driverInfo.setGender( onlineCar.getUserInfo().getGender() ); - driverInfo.setLat( onlineCar.getLocation().getLat() ); - driverInfo.setLon( onlineCar.getLocation().getLon() ); - driverInfo.setLocationInfo( onlineCar.getLocation().getAddress() ); - driverInfo.setSn( onlineCar.getUserInfo().getSn() ); - driverInfo.setUserHead( onlineCar.getUserInfo().getUserHead() ); - driverInfo.setUserName( onlineCar.getUserInfo().getUserName() ); - if ( mApiProvider != null ) { - mApiProvider.showUserWindow( TAG, driverInfo, context ); - } +// if ( mApiProvider == null ) { +// Logger.e( TAG, "no call chat api instance." ); +// return; +// } +// MogoDriverInfo driverInfo = new MogoDriverInfo(); +// driverInfo.setAge( onlineCar.getUserInfo().getAgeNumber() ); +// driverInfo.setCarTypeName( onlineCar.getCarInfo().getCarTypeName() ); +// driverInfo.setGender( onlineCar.getUserInfo().getGender() ); +// driverInfo.setLat( onlineCar.getLocation().getLat() ); +// driverInfo.setLon( onlineCar.getLocation().getLon() ); +// driverInfo.setLocationInfo( onlineCar.getLocation().getAddress() ); +// driverInfo.setSn( onlineCar.getUserInfo().getSn() ); +// driverInfo.setUserHead( onlineCar.getUserInfo().getUserHead() ); +// driverInfo.setUserName( onlineCar.getUserInfo().getUserName() ); +// if ( mApiProvider != null ) { +// mApiProvider.showUserWindow( TAG, driverInfo, context ); +// } } - public void hideUserWindow( Context context ) { - if ( mApiProvider == null ) { - Logger.e( TAG, "no call chat api instance." ); - return; - } - mApiProvider.hideUserWindow( TAG, context, null ); - } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java index d5e3a69162..d1162a113d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java @@ -22,14 +22,11 @@ import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.R; -import com.mogo.module.common.api.CallChatApi; import com.mogo.module.common.constants.DataTypes; import com.mogo.module.common.utils.Trigonometric; import com.mogo.service.adas.IMogoADASController; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; -import com.zhidao.carchattingprovider.ICarsChattingProvider; -import com.zhidao.carchattingprovider.MogoDriverInfo; import com.zhjt.service.chain.ChainLog; import com.zhjt.service.chain.TracingConstants; @@ -487,7 +484,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic */ private void showCarCallPanel(SocketDownData.CloudRoadDataProto data) { - MogoDriverInfo driverInfo = new MogoDriverInfo(); + /* MogoDriverInfo driverInfo = new MogoDriverInfo(); driverInfo.setLat(data.getLat()); driverInfo.setLon(data.getLon()); driverInfo.setSn(data.getSn()); @@ -499,7 +496,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic } catch (Exception e) { Logger.e(TAG, e, "showCarCallPanel"); } - } + }*/ } public void changeIconResourceIfNecessary(SocketDownData.CloudRoadDataProto cloudRoadData, IMogoMarker marker) { diff --git a/modules/mogo-module-main/build.gradle b/modules/mogo-module-main/build.gradle new file mode 100644 index 0000000000..e69de29bb2 diff --git a/modules/mogo-module-service/build.gradle b/modules/mogo-module-service/build.gradle index 49541a4b78..90b63cd7e0 100644 --- a/modules/mogo-module-service/build.gradle +++ b/modules/mogo-module-service/build.gradle @@ -58,7 +58,7 @@ dependencies { implementation rootProject.ext.dependencies.mogocommons implementation rootProject.ext.dependencies.mogoserviceapi implementation rootProject.ext.dependencies.modulecommon - implementation rootProject.ext.dependencies.callchatprovider + //implementation rootProject.ext.dependencies.callchatprovider implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_res @@ -70,8 +70,6 @@ dependencies { implementation project(":foudations:mogo-commons") implementation project(':services:mogo-service-api') implementation project(':modules:mogo-module-common') - implementation project(':modules:mogo-module-carchattingprovider') - implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-res') implementation project(':core:mogo-core-utils') diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java index 93be58b799..cdfc3f6a26 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java @@ -26,8 +26,6 @@ import com.mogo.service.map.IMogoMapService; import com.mogo.service.module.IMogoActionManager; import com.mogo.service.module.IMogoRegisterCenter; import com.mogo.service.statusmanager.IMogoStatusManager; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICarsChattingProvider; /** * author : donghongyu @@ -55,15 +53,10 @@ public class MarkerServiceHandler { private static IMogoIntentManager sIntentManager; private static IMogoADASController sADASController; private static IMogoFragmentManager sFragmentManager; - private static ICarsChattingProvider sCarChatting; private static IMogoOverlayManager sIMogoOverlayManager; public static synchronized void init( final Context context ) { - if ( sCarChatting != null ) { - return; - } - sApis = MogoApisHandler.getInstance().getApis(); sMapService = sApis.getMapServiceApi(); sImageloader = sApis.getImageLoaderApi(); @@ -80,8 +73,6 @@ public class MarkerServiceHandler { sIntentManager = sApis.getIntentManagerApi(); sADASController = sApis.getAdasControllerApi(); sFragmentManager = sApis.getFragmentManagerApi(); - sCarChatting = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context ); - MapMarkerManager.getInstance().init( context ); } @@ -149,9 +140,6 @@ public class MarkerServiceHandler { return sDataManager; } - public static ICarsChattingProvider getCarChatting() { - return sCarChatting; - } public static IMogoOverlayManager getsIMogoOverlayManager() { return sIMogoOverlayManager; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java index e019bef3b6..d6d081ef7e 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/StatusChangedAdapter.java @@ -6,15 +6,10 @@ import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.AbsMogoApplication; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.module.common.MogoApisHandler; import com.mogo.module.service.launchercard.LauncherCardRefresher; import com.mogo.module.service.marker.MapMarkerManager; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; -import com.zhidao.carchattingprovider.CallChattingProviderConstant; -import com.zhidao.carchattingprovider.ICallChatResponse; -import com.zhidao.carchattingprovider.ICallProviderResponse; -import com.zhidao.carchattingprovider.ICarsChattingProvider; import org.jetbrains.annotations.NotNull; import org.json.JSONObject; @@ -32,8 +27,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener { private boolean mIsMainPageFirstResume = true; - private ICallProviderResponse mCallProviderResponse; - private ICarsChattingProvider mCarsChattingProvider; private boolean mIsFirstAccOn = true; @@ -99,20 +92,20 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener { * 关闭所有模块的控制面板 */ private void closeAllPanel() { - - if (mCallProviderResponse == null) { - mCallProviderResponse = new ICallChatResponse() { - @Override - public void hideUserWindowError(@NotNull String errorMsg) { - } - }; - } - if (mCarsChattingProvider == null) { - mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(); - } - if (mCarsChattingProvider != null) { - mCarsChattingProvider.hideUserWindow(TAG, AbsMogoApplication.getApp(), mCallProviderResponse); - } +// +// if (mCallProviderResponse == null) { +// mCallProviderResponse = new ICallChatResponse() { +// @Override +// public void hideUserWindowError(@NotNull String errorMsg) { +// } +// }; +// } +// if (mCarsChattingProvider == null) { +// mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation(); +// } +// if (mCarsChattingProvider != null) { +// mCarsChattingProvider.hideUserWindow(TAG, AbsMogoApplication.getApp(), mCallProviderResponse); +// } } public void onSeekHelpingStatusChanged(boolean isSeekingHelping) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index 192a6f7345..6bb89f90e4 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -39,7 +39,6 @@ import com.mogo.realtime.api.MoGoAiCloudRealTime; import com.mogo.realtime.socket.IMogoCloudOnMsgListener; import com.mogo.service.adas.IMogoADASControlStatusChangedListener; import com.mogo.service.module.IMogoBizActionDoneListener; -import com.zhidao.carchattingprovider.ICallChatResponse; import org.json.JSONArray; import org.json.JSONException; @@ -108,26 +107,26 @@ public class MapMarkerManager implements IMogoMarkerClickListener, MarkerServiceHandler.getActionManager().registerBizActionDoneListener(this); MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this); - if (CallChatApi.getInstance().getApiProvider() != null) { - CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener(TAG, mContext, new ICallChatResponse() { - - @Override - public void userWindowStatus(boolean show) { - try { - if (mLastCheckMarker == null) { - return; - } - if (TextUtils.equals(mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA) - && !show) { - closeMarker(mLastCheckMarker); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - }); - } +// if (CallChatApi.getInstance().getApiProvider() != null) { +// CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener(TAG, mContext, new ICallChatResponse() { +// +// @Override +// public void userWindowStatus(boolean show) { +// try { +// if (mLastCheckMarker == null) { +// return; +// } +// if (TextUtils.equals(mLastCheckMarker.getOwner(), ModuleNames.CARD_TYPE_USER_DATA) +// && !show) { +// closeMarker(mLastCheckMarker); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +// }); +// } /* * 云端下发数据与adas定频传输数据均发送至同一Handler线程处理 diff --git a/settings.gradle b/settings.gradle index 5ea9f1765a..0c54f45c0c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -43,6 +43,8 @@ include ':core:function-impl:mogo-core-function-monitoring' // USB 行车记录仪 include ':core:function-impl:mogo-core-function-carcorder' +// 车聊聊业务 +include ':core:function-impl:mogo-core-function-chat' // 服务 include ':services:mogo-service-api' @@ -62,9 +64,9 @@ include ':libraries:mogo-adas' // OLD业务模块 include ':modules:mogo-module-common' include ':modules:mogo-module-service' -include ':modules:mogo-module-carchatting' -include ':modules:mogo-module-carchattingprovider' -include ':modules:mogo-module-chat' +//include ':modules:mogo-module-carchatting' +//include ':modules:mogo-module-carchattingprovider' +//include ':modules:mogo-module-chat' // 语音 include ':tts:tts-base'