Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
76ea785b
Commit
76ea785b
authored
Apr 14, 2020
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志 推送
parent
6c72f6e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
35 deletions
+36
-35
config.gradle
config.gradle
+3
-3
AndroidManifest.xml
m-audioim/src/main/AndroidManifest.xml
+2
-0
YDLavManager.kt
m-audioim/src/main/java/com/ydl/audioim/YDLavManager.kt
+8
-10
ConsultantAudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/consultantim/ConsultantAudioHomeActivity.kt
+23
-22
No files found.
config.gradle
View file @
76ea785b
...
...
@@ -42,7 +42,7 @@ ext {
ydlPublishVersion
=
[
// -------------- 业务模块 --------------
//第三步 若干
"m-confide"
:
"0.0.48.1
2
"
,
"m-confide"
:
"0.0.48.1
5
"
,
"m-consultant"
:
"0.0.59.0"
,
"m-fm"
:
"0.0.29.3"
,
"m-user"
:
"0.0.60.4"
,
...
...
@@ -75,7 +75,7 @@ ext {
"ydl-webview"
:
"0.0.38.29"
,
"ydl-media"
:
"0.0.20"
,
"ydl-pay"
:
"0.0.17"
,
"m-audioim"
:
"0.0.48.3.1
6
"
,
"m-audioim"
:
"0.0.48.3.1
9
"
,
"ydl-flutter-base"
:
"0.0.14.12"
,
//以下 几乎不会动
...
...
@@ -121,7 +121,7 @@ ext {
"ydl-webview"
:
"0.0.38.29"
,
"ydl-media"
:
"0.0.20"
,
"ydl-pay"
:
"0.0.17"
,
"m-audioim"
:
"0.0.48.3.1
6
"
,
"m-audioim"
:
"0.0.48.3.1
9
"
,
"ydl-flutter-base"
:
"0.0.10.9"
,
//以下 几乎不会动
...
...
m-audioim/src/main/AndroidManifest.xml
View file @
76ea785b
...
...
@@ -8,11 +8,13 @@
<activity
android:name=
".AudioHomeActivity"
android:launchMode=
"singleTask"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"com.ydl.consultantim.ConsultantAudioHomeActivity"
android:launchMode=
"singleTask"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation=
"portrait"
/>
</application>
...
...
m-audioim/src/main/java/com/ydl/audioim/YDLavManager.kt
View file @
76ea785b
...
...
@@ -5,12 +5,10 @@ import android.content.Context
import
android.os.Handler
import
android.text.TextUtils
import
com.alibaba.android.arouter.launcher.ARouter
import
com.google.gson.Gson
import
com.ydl.audioim.http.AudioApiRequestUtil
import
com.ydl.audioim.http.command.ConnectExceptionCommand
import
com.ydl.audioim.utils.AudioLogUtils
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.bean.RTMMesssage
import
com.ydl.ydl_av.messge_service.callback.CallListener
...
...
@@ -40,7 +38,7 @@ class YDLavManager {
companion
object
{
val
FILE_NAME
=
"consult"
val
FILE_NAME
=
"consult"
//当前sdk的登录状态
var
sdkStatus
=
-
1
...
...
@@ -56,7 +54,7 @@ class YDLavManager {
//设置回调
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
))
{
//不延时,可能会导致请求api报 network not unablibale
Handler
().
postDelayed
({
...
...
@@ -102,7 +100,7 @@ class YDLavManager {
if
(
act
is
AudioHomeActivity
)
{
act
.
runOnUiThread
{
ToastUtil
.
toastShort
(
"对方已挂断"
)
act
.
writeAgoraLog
(
"被叫拒绝了通话邀请"
)
act
.
writeAgoraLog
(
"被叫拒绝了通话邀请"
)
//通话结束或挂断时,上传日志文件
act
.
uploadLog
()
act
.
leaveChannel
()
...
...
@@ -141,7 +139,7 @@ class YDLavManager {
RtmStatusCode
.
LocalInvitationError
.
LOCAL_INVITATION_ERR_INVITATION_EXPIRE
->
{
//呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
if
(
act
is
AudioHomeActivity
)
{
act
.
runOnUiThread
{
act
.
writeAgoraLog
(
"呼叫失败:${errorCode}"
)
act
.
writeAgoraLog
(
"呼叫失败:${errorCode}"
)
//通话结束或挂断时,上传日志文件
act
.
uploadLog
()
act
.
leaveChannel
()
...
...
@@ -170,7 +168,7 @@ class YDLavManager {
override
fun
onRemoteInvitationCanceled
(
response
:
CallRemoteResponse
?)
{
//返回给被叫
LogUtil
.
e
(
"[agora]主叫${response?.callerId}已取消呼叫邀请"
)
AudioLogUtils
.
writeAgoraLog
(
"呼叫邀请被取消:主叫主动取消"
,
FILE_NAME
)
AudioLogUtils
.
writeAgoraLog
(
"呼叫邀请被取消:主叫主动取消"
,
FILE_NAME
)
closePage
()
}
...
...
@@ -178,9 +176,9 @@ class YDLavManager {
//返回给被叫
LogUtil
.
e
(
"[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}"
)
if
(
errorCode
==
RtmStatusCode
.
RemoteInvitationError
.
REMOTE_INVITATION_ERR_INVITATION_EXPIRE
)
{
//呼叫邀请过期
AudioLogUtils
.
writeAgoraLog
(
"呼叫邀请被取消:呼叫邀请过期"
,
FILE_NAME
)
AudioLogUtils
.
writeAgoraLog
(
"呼叫邀请被取消:呼叫邀请过期"
,
FILE_NAME
)
}
else
{
AudioLogUtils
.
writeAgoraLog
(
"呼叫邀请被取消:错误原因(${errorCode})"
,
FILE_NAME
)
AudioLogUtils
.
writeAgoraLog
(
"呼叫邀请被取消:错误原因(${errorCode})"
,
FILE_NAME
)
}
//关闭页面
closePage
()
...
...
@@ -199,7 +197,6 @@ class YDLavManager {
}
@SuppressLint
(
"CheckResult"
)
fun
login
(
userId
:
String
?,
event
:
(
isSuccess
:
Boolean
,
msg
:
String
?)
->
Unit
)
{
if
(
TextUtils
.
isEmpty
(
userId
)
||
userId
?:
"0"
<=
"0"
)
{
...
...
@@ -214,6 +211,7 @@ class YDLavManager {
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
if
(
"200"
.
equals
(
it
.
code
))
{
LogUtil
.
e
(
"[agora]登录av的login-uid:$userId"
)
YDLRTMClient
.
instances
.
login
(
LoginParam
(
userId
,
it
.
data
.
token
),
object
:
LoginCallback
{
override
fun
onSuccess
()
{
...
...
m-audioim/src/main/java/com/ydl/consultantim/ConsultantAudioHomeActivity.kt
View file @
76ea785b
...
...
@@ -49,7 +49,6 @@ import com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.user.api.service.IUserService
import
de.greenrobot.event.EventBus
import
io.agora.rtc.Constants
...
...
@@ -122,7 +121,7 @@ class ConsultantAudioHomeActivity :
*/
override
fun
onUserMuteAudio
(
uid
:
Int
,
muted
:
Boolean
)
{
runOnUiThread
{
show
Long
Toast
(
"对方静音了,提醒他打开!"
)
showToast
(
"对方静音了,提醒他打开!"
)
}
}
...
...
@@ -192,7 +191,7 @@ class ConsultantAudioHomeActivity :
super
.
onConnectionStateChanged
(
state
,
reason
)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if
(
reason
==
3
)
{
ToastUtil
.
toastShor
t
(
"对方已挂断"
)
showToas
t
(
"对方已挂断"
)
writeAgoraLog
(
"通话挂断:网络连接被服务器中止"
)
//通话结束或挂断时,上传日志文件
uploadLog
()
...
...
@@ -230,7 +229,7 @@ class ConsultantAudioHomeActivity :
super
.
onUserOffline
(
uid
,
elapsed
)
LogUtil
.
e
(
"[agora]$uid 主播离开频道回调"
)
runOnUiThread
{
show
Long
Toast
(
"对方已挂断"
)
showToast
(
"对方已挂断"
)
writeAgoraLog
(
"通话接通后挂断:主叫离开频道"
)
//通话结束或挂断时,上传日志文件
uploadLog
()
...
...
@@ -266,7 +265,7 @@ class ConsultantAudioHomeActivity :
when
(
warn
)
{
103
,
104
,
105
,
106
,
107
->
{
writeAgoraLog
(
"通话挂断:网络异常($warn)"
)
show
Long
Toast
(
"当前网络较差,请更换网络!"
)
showToast
(
"当前网络较差,请更换网络!"
)
//通话结束或挂断时,上传日志文件
uploadLog
()
close
(
RESULT_NOT_ANSWERED_CODE
,
"[agora]专家网络较差"
)
...
...
@@ -293,23 +292,23 @@ class ConsultantAudioHomeActivity :
runOnUiThread
{
when
(
err
)
{
3
,
7
,
109
,
110
->
{
show
Long
Toast
(
"请退出应用,重新打开"
)
showToast
(
"请退出应用,重新打开"
)
close
(
RESULT_NOT_ANSWERED_CODE
,
"咨询师已挂断"
)
}
10
,
17
->
{
show
Long
Toast
(
"当前网络较差,请更换网络"
)
showToast
(
"当前网络较差,请更换网络"
)
close
(
RESULT_NOT_ANSWERED_CODE
,
"专家网络较差"
)
}
101
->
{
show
Long
Toast
(
"安装包有问题,请联系技术"
)
showToast
(
"安装包有问题,请联系技术"
)
close
(
RESULT_NOT_ANSWERED_CODE
,
"安装包有问题,请联系技术"
)
}
102
->
{
show
Long
Toast
(
"频道错误,请联系技术"
)
showToast
(
"频道错误,请联系技术"
)
close
(
RESULT_NOT_ANSWERED_CODE
,
"频道错误,请联系技术"
)
}
123
->
{
show
Long
Toast
(
"对方不允许接听电话,请联系客服"
)
showToast
(
"对方不允许接听电话,请联系客服"
)
close
(
RESULT_NOT_ANSWERED_CODE
,
"该专家不允许接听电话,请联系客服"
)
}
else
->
{
...
...
@@ -372,7 +371,6 @@ class ConsultantAudioHomeActivity :
writeAgoraLog
(
"收到邀请通话消息内容:$json"
)
mAudioMessageBean
=
Gson
().
fromJson
(
json
,
AudioMessageBean
::
class
.
java
)
if
(
YDLavManager
.
sdkStatus
!=
Constants
.
CONNECTION_STATE_CONNECTED
)
{
writeAgoraLog
(
"RMT状态:${YDLavManager.sdkStatus},重新登录RMT"
)
val
uid
=
...
...
@@ -382,6 +380,8 @@ class ConsultantAudioHomeActivity :
val
result
=
if
(
_isSuccess
)
"RMT登录成功"
else
"RMT登录失败:$_msg"
writeAgoraLog
(
result
)
}
}
else
{
writeAgoraLog
(
"当前RMT状态:${YDLavManager.sdkStatus}"
)
}
}
}
else
{
...
...
@@ -456,7 +456,7 @@ class ConsultantAudioHomeActivity :
override
fun
channelTokenResponse
(
token
:
String
?,
needJoinChannel
:
Boolean
)
{
if
(
TextUtils
.
isEmpty
(
token
))
{
LogUtil
.
e
(
"[agora]token not null"
)
ToastUtil
.
toastShor
t
(
"通话频道不存在"
)
showToas
t
(
"通话频道不存在"
)
finish
()
return
}
...
...
@@ -543,7 +543,7 @@ class ConsultantAudioHomeActivity :
override
fun
executeFinish
()
{
//通话结束或挂断时,上传日志文件
uploadLog
()
ToastUtil
.
toastShor
t
(
"对方已挂断"
)
showToas
t
(
"对方已挂断"
)
close
(
RESULT_ANSWERED_CODE
,
""
)
}
...
...
@@ -644,7 +644,7 @@ class ConsultantAudioHomeActivity :
//停止震动
VibratorUtil
.
StopVibrate
(
this
)
if
(!
canExcute
)
{
ToastUtil
.
toastShor
t
(
"对方已挂断"
)
showToas
t
(
"对方已挂断"
)
finish
()
}
else
{
if
(
null
!=
mAudioMessageBean
)
{
...
...
@@ -724,12 +724,13 @@ class ConsultantAudioHomeActivity :
}
private
fun
showLongToast
(
msg
:
String
)
{
ToastUtil
.
toastLong
(
AudioHomeActivity
@
this
,
msg
)
}
private
fun
showShortToast
(
msg
:
String
)
{
ToastUtil
.
toastLong
(
AudioHomeActivity
@
this
,
msg
)
/**
* 显示自定义弹窗
*/
private
fun
showToast
(
msg
:
String
?)
{
runOnUiThread
{
ToastHelper
.
show
(
msg
?:
""
)
}
}
//关闭本页面
...
...
@@ -751,7 +752,7 @@ class ConsultantAudioHomeActivity :
}
else
if
(
code
==
RESULT_USER_CANCEL
)
{
callStatus
=
1
uploadException
(
"主叫取消"
,
zhu
=
""
)
ToastUtil
.
toastShor
t
(
"对方已挂断"
)
showToas
t
(
"对方已挂断"
)
}
finish
()
}
...
...
@@ -801,7 +802,7 @@ class ConsultantAudioHomeActivity :
.
subscribe
({},
{},
{
if
(!
isConnectSuccess
)
{
writeAgoraLog
(
"通话未接通挂断:连接中的状态超过5s自动挂断"
)
ToastUtil
.
toastShort
(
this
,
"用户已挂断"
)
showToast
(
"用户已挂断"
)
close
(
RESULT_NOT_ANSWERED_CODE
,
""
)
}
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment