Commit aa31f928 by ydl

merge

parents e34eff7a cd3bc428
...@@ -42,7 +42,7 @@ ext { ...@@ -42,7 +42,7 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.12", "m-confide" : "0.0.48.17",
"m-consultant" : "0.0.59.6", "m-consultant" : "0.0.59.6",
"m-fm" : "0.0.29.3", "m-fm" : "0.0.29.3",
"m-user" : "0.0.60.4", "m-user" : "0.0.60.4",
...@@ -75,7 +75,7 @@ ext { ...@@ -75,7 +75,7 @@ ext {
"ydl-webview" : "0.0.38.29", "ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.4", "m-audioim" : "0.0.48.5",
"ydl-flutter-base": "0.0.14.12", "ydl-flutter-base": "0.0.14.12",
//以下 几乎不会动 //以下 几乎不会动
...@@ -121,7 +121,7 @@ ext { ...@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.29", "ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.4", "m-audioim" : "0.0.48.5",
"ydl-flutter-base": "0.0.10.9", "ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
<activity <activity
android:name=".AudioHomeActivity" android:name=".AudioHomeActivity"
android:launchMode="singleTask"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name="com.ydl.consultantim.ConsultantAudioHomeActivity" android:name="com.ydl.consultantim.ConsultantAudioHomeActivity"
android:launchMode="singleTask"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
</application> </application>
......
...@@ -5,12 +5,10 @@ import android.content.Context ...@@ -5,12 +5,10 @@ import android.content.Context
import android.os.Handler import android.os.Handler
import android.text.TextUtils import android.text.TextUtils
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.google.gson.Gson
import com.ydl.audioim.http.AudioApiRequestUtil import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectExceptionCommand import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.utils.AudioLogUtils import com.ydl.audioim.utils.AudioLogUtils
import com.ydl.consultantim.ConsultantAudioHomeActivity import com.ydl.consultantim.ConsultantAudioHomeActivity
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.ydl_av.messge_service.YDLRTMClient import com.ydl.ydl_av.messge_service.YDLRTMClient
import com.ydl.ydl_av.messge_service.bean.RTMMesssage import com.ydl.ydl_av.messge_service.bean.RTMMesssage
import com.ydl.ydl_av.messge_service.callback.CallListener import com.ydl.ydl_av.messge_service.callback.CallListener
...@@ -40,7 +38,7 @@ class YDLavManager { ...@@ -40,7 +38,7 @@ class YDLavManager {
companion object { companion object {
val FILE_NAME="consult" val FILE_NAME = "consult"
//当前sdk的登录状态 //当前sdk的登录状态
var sdkStatus = -1 var sdkStatus = -1
...@@ -56,7 +54,7 @@ class YDLavManager { ...@@ -56,7 +54,7 @@ class YDLavManager {
//设置回调 //设置回调
setCallback() setCallback()
val uid= ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid val uid = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid
if (!TextUtils.isEmpty(uid) && !TextUtils.equals("0", uid)) { if (!TextUtils.isEmpty(uid) && !TextUtils.equals("0", uid)) {
//不延时,可能会导致请求api报 network not unablibale //不延时,可能会导致请求api报 network not unablibale
Handler().postDelayed({ Handler().postDelayed({
...@@ -102,7 +100,7 @@ class YDLavManager { ...@@ -102,7 +100,7 @@ class YDLavManager {
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
act.runOnUiThread { act.runOnUiThread {
ToastUtil.toastShort("对方已挂断") ToastUtil.toastShort("对方已挂断")
act. writeAgoraLog("被叫拒绝了通话邀请") act.writeAgoraLog("被叫拒绝了通话邀请")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
act.uploadLog() act.uploadLog()
act.leaveChannel() act.leaveChannel()
...@@ -141,7 +139,7 @@ class YDLavManager { ...@@ -141,7 +139,7 @@ class YDLavManager {
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> {//呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。 RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> {//呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
if (act is AudioHomeActivity) { if (act is AudioHomeActivity) {
act.runOnUiThread { act.runOnUiThread {
act. writeAgoraLog("呼叫失败:${errorCode}") act.writeAgoraLog("呼叫失败:${errorCode}")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
act.uploadLog() act.uploadLog()
act.leaveChannel() act.leaveChannel()
...@@ -170,7 +168,7 @@ class YDLavManager { ...@@ -170,7 +168,7 @@ class YDLavManager {
override fun onRemoteInvitationCanceled(response: CallRemoteResponse?) { override fun onRemoteInvitationCanceled(response: CallRemoteResponse?) {
//返回给被叫 //返回给被叫
LogUtil.e("[agora]主叫${response?.callerId}已取消呼叫邀请") LogUtil.e("[agora]主叫${response?.callerId}已取消呼叫邀请")
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:主叫主动取消",FILE_NAME) AudioLogUtils.writeAgoraLog("呼叫邀请被取消:主叫主动取消", FILE_NAME)
closePage() closePage()
} }
...@@ -178,9 +176,9 @@ class YDLavManager { ...@@ -178,9 +176,9 @@ class YDLavManager {
//返回给被叫 //返回给被叫
LogUtil.e("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}") LogUtil.e("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}")
if (errorCode == RtmStatusCode.RemoteInvitationError.REMOTE_INVITATION_ERR_INVITATION_EXPIRE) {//呼叫邀请过期 if (errorCode == RtmStatusCode.RemoteInvitationError.REMOTE_INVITATION_ERR_INVITATION_EXPIRE) {//呼叫邀请过期
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:呼叫邀请过期",FILE_NAME) AudioLogUtils.writeAgoraLog("呼叫邀请被取消:呼叫邀请过期", FILE_NAME)
} else { } else {
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:错误原因(${errorCode})",FILE_NAME) AudioLogUtils.writeAgoraLog("呼叫邀请被取消:错误原因(${errorCode})", FILE_NAME)
} }
//关闭页面 //关闭页面
closePage() closePage()
...@@ -199,7 +197,6 @@ class YDLavManager { ...@@ -199,7 +197,6 @@ class YDLavManager {
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit) { fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit) {
if (TextUtils.isEmpty(userId) || userId ?: "0" <= "0") { if (TextUtils.isEmpty(userId) || userId ?: "0" <= "0") {
...@@ -214,6 +211,7 @@ class YDLavManager { ...@@ -214,6 +211,7 @@ class YDLavManager {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
if ("200".equals(it.code)) { if ("200".equals(it.code)) {
LogUtil.e("[agora]登录av的login-uid:$userId")
YDLRTMClient.instances.login(LoginParam(userId, it.data.token), YDLRTMClient.instances.login(LoginParam(userId, it.data.token),
object : LoginCallback { object : LoginCallback {
override fun onSuccess() { override fun onSuccess() {
......
...@@ -49,7 +49,6 @@ import com.ydl.ydlcommon.utils.Utils ...@@ -49,7 +49,6 @@ import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import io.agora.rtc.Constants import io.agora.rtc.Constants
...@@ -122,7 +121,7 @@ class ConsultantAudioHomeActivity : ...@@ -122,7 +121,7 @@ class ConsultantAudioHomeActivity :
*/ */
override fun onUserMuteAudio(uid: Int, muted: Boolean) { override fun onUserMuteAudio(uid: Int, muted: Boolean) {
runOnUiThread { runOnUiThread {
showLongToast("对方静音了,提醒他打开!") showToast("对方静音了,提醒他打开!")
} }
} }
...@@ -192,7 +191,7 @@ class ConsultantAudioHomeActivity : ...@@ -192,7 +191,7 @@ class ConsultantAudioHomeActivity :
super.onConnectionStateChanged(state, reason) super.onConnectionStateChanged(state, reason)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑 // 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) { if (reason == 3) {
ToastUtil.toastShort("对方已挂断") showToast("对方已挂断")
writeAgoraLog("通话挂断:网络连接被服务器中止") writeAgoraLog("通话挂断:网络连接被服务器中止")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
...@@ -230,7 +229,7 @@ class ConsultantAudioHomeActivity : ...@@ -230,7 +229,7 @@ class ConsultantAudioHomeActivity :
super.onUserOffline(uid, elapsed) super.onUserOffline(uid, elapsed)
LogUtil.e("[agora]$uid 主播离开频道回调") LogUtil.e("[agora]$uid 主播离开频道回调")
runOnUiThread { runOnUiThread {
showLongToast("对方已挂断") showToast("对方已挂断")
writeAgoraLog("通话接通后挂断:主叫离开频道") writeAgoraLog("通话接通后挂断:主叫离开频道")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
...@@ -266,7 +265,7 @@ class ConsultantAudioHomeActivity : ...@@ -266,7 +265,7 @@ class ConsultantAudioHomeActivity :
when (warn) { when (warn) {
103, 104, 105, 106, 107 -> { 103, 104, 105, 106, 107 -> {
writeAgoraLog("通话挂断:网络异常($warn)") writeAgoraLog("通话挂断:网络异常($warn)")
showLongToast("当前网络较差,请更换网络!") showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
close(RESULT_NOT_ANSWERED_CODE, "[agora]专家网络较差") close(RESULT_NOT_ANSWERED_CODE, "[agora]专家网络较差")
...@@ -293,23 +292,23 @@ class ConsultantAudioHomeActivity : ...@@ -293,23 +292,23 @@ class ConsultantAudioHomeActivity :
runOnUiThread { runOnUiThread {
when (err) { when (err) {
3, 7, 109, 110 -> { 3, 7, 109, 110 -> {
showLongToast("请退出应用,重新打开") showToast("请退出应用,重新打开")
close(RESULT_NOT_ANSWERED_CODE, "咨询师已挂断") close(RESULT_NOT_ANSWERED_CODE, "咨询师已挂断")
} }
10, 17 -> { 10, 17 -> {
showLongToast("当前网络较差,请更换网络") showToast("当前网络较差,请更换网络")
close(RESULT_NOT_ANSWERED_CODE, "专家网络较差") close(RESULT_NOT_ANSWERED_CODE, "专家网络较差")
} }
101 -> { 101 -> {
showLongToast("安装包有问题,请联系技术") showToast("安装包有问题,请联系技术")
close(RESULT_NOT_ANSWERED_CODE, "安装包有问题,请联系技术") close(RESULT_NOT_ANSWERED_CODE, "安装包有问题,请联系技术")
} }
102 -> { 102 -> {
showLongToast("频道错误,请联系技术") showToast("频道错误,请联系技术")
close(RESULT_NOT_ANSWERED_CODE, "频道错误,请联系技术") close(RESULT_NOT_ANSWERED_CODE, "频道错误,请联系技术")
} }
123 -> { 123 -> {
showLongToast("对方不允许接听电话,请联系客服") showToast("对方不允许接听电话,请联系客服")
close(RESULT_NOT_ANSWERED_CODE, "该专家不允许接听电话,请联系客服") close(RESULT_NOT_ANSWERED_CODE, "该专家不允许接听电话,请联系客服")
} }
else -> { else -> {
...@@ -372,7 +371,6 @@ class ConsultantAudioHomeActivity : ...@@ -372,7 +371,6 @@ class ConsultantAudioHomeActivity :
writeAgoraLog("收到邀请通话消息内容:$json") writeAgoraLog("收到邀请通话消息内容:$json")
mAudioMessageBean = Gson().fromJson(json, AudioMessageBean::class.java) mAudioMessageBean = Gson().fromJson(json, AudioMessageBean::class.java)
if (YDLavManager.sdkStatus != Constants.CONNECTION_STATE_CONNECTED) { if (YDLavManager.sdkStatus != Constants.CONNECTION_STATE_CONNECTED) {
writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT") writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT")
val uid = val uid =
...@@ -382,6 +380,8 @@ class ConsultantAudioHomeActivity : ...@@ -382,6 +380,8 @@ class ConsultantAudioHomeActivity :
val result = if (_isSuccess) "RMT登录成功" else "RMT登录失败:$_msg" val result = if (_isSuccess) "RMT登录成功" else "RMT登录失败:$_msg"
writeAgoraLog(result) writeAgoraLog(result)
} }
} else {
writeAgoraLog("当前RMT状态:${YDLavManager.sdkStatus}")
} }
} }
} else { } else {
...@@ -456,7 +456,7 @@ class ConsultantAudioHomeActivity : ...@@ -456,7 +456,7 @@ class ConsultantAudioHomeActivity :
override fun channelTokenResponse(token: String?, needJoinChannel: Boolean) { override fun channelTokenResponse(token: String?, needJoinChannel: Boolean) {
if (TextUtils.isEmpty(token)) { if (TextUtils.isEmpty(token)) {
LogUtil.e("[agora]token not null") LogUtil.e("[agora]token not null")
ToastUtil.toastShort("通话频道不存在") showToast("通话频道不存在")
finish() finish()
return return
} }
...@@ -543,7 +543,7 @@ class ConsultantAudioHomeActivity : ...@@ -543,7 +543,7 @@ class ConsultantAudioHomeActivity :
override fun executeFinish() { override fun executeFinish() {
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
uploadLog() uploadLog()
ToastUtil.toastShort("对方已挂断") showToast("对方已挂断")
close(RESULT_ANSWERED_CODE, "") close(RESULT_ANSWERED_CODE, "")
} }
...@@ -644,7 +644,7 @@ class ConsultantAudioHomeActivity : ...@@ -644,7 +644,7 @@ class ConsultantAudioHomeActivity :
//停止震动 //停止震动
VibratorUtil.StopVibrate(this) VibratorUtil.StopVibrate(this)
if (!canExcute) { if (!canExcute) {
ToastUtil.toastShort("对方已挂断") showToast("对方已挂断")
finish() finish()
} else { } else {
if (null != mAudioMessageBean) { if (null != mAudioMessageBean) {
...@@ -724,12 +724,13 @@ class ConsultantAudioHomeActivity : ...@@ -724,12 +724,13 @@ class ConsultantAudioHomeActivity :
} }
private fun showLongToast(msg: String) { /**
ToastUtil.toastLong(AudioHomeActivity@ this, msg) * 显示自定义弹窗
} */
private fun showToast(msg: String?) {
private fun showShortToast(msg: String) { runOnUiThread {
ToastUtil.toastLong(AudioHomeActivity@ this, msg) ToastHelper.show(msg ?: "")
}
} }
//关闭本页面 //关闭本页面
...@@ -751,7 +752,7 @@ class ConsultantAudioHomeActivity : ...@@ -751,7 +752,7 @@ class ConsultantAudioHomeActivity :
} else if (code == RESULT_USER_CANCEL) { } else if (code == RESULT_USER_CANCEL) {
callStatus = 1 callStatus = 1
uploadException("主叫取消", zhu = "") uploadException("主叫取消", zhu = "")
ToastUtil.toastShort("对方已挂断") showToast("对方已挂断")
} }
finish() finish()
} }
...@@ -801,7 +802,7 @@ class ConsultantAudioHomeActivity : ...@@ -801,7 +802,7 @@ class ConsultantAudioHomeActivity :
.subscribe({}, {}, { .subscribe({}, {}, {
if (!isConnectSuccess) { if (!isConnectSuccess) {
writeAgoraLog("通话未接通挂断:连接中的状态超过5s自动挂断") writeAgoraLog("通话未接通挂断:连接中的状态超过5s自动挂断")
ToastUtil.toastShort(this, "用户已挂断") showToast( "用户已挂断")
close(RESULT_NOT_ANSWERED_CODE, "") close(RESULT_NOT_ANSWERED_CODE, "")
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment