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
f6456cb1
Commit
f6456cb1
authored
Nov 28, 2019
by
徐健
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/audio_xj' into feature/test_home_pager
parents
cfab77e2
b4f45bd1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
152 additions
and
79 deletions
+152
-79
config.gradle
config.gradle
+3
-3
build.gradle
m-audioim/build.gradle
+2
-0
AudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
+18
-6
IAudioHomeActivityContract.kt
m-audioim/src/main/java/com/ydl/audioim/contract/IAudioHomeActivityContract.kt
+15
-8
AudioApiRequestUtil.kt
m-audioim/src/main/java/com/ydl/audioim/http/AudioApiRequestUtil.kt
+22
-13
AudioNetAPi.kt
m-audioim/src/main/java/com/ydl/audioim/http/AudioNetAPi.kt
+12
-5
ConnectExceptionCommand.kt
m-audioim/src/main/java/com/ydl/audioim/http/command/ConnectExceptionCommand.kt
+24
-0
AudioHomeModelImpl.kt
m-audioim/src/main/java/com/ydl/audioim/model/AudioHomeModelImpl.kt
+10
-9
AudioHomePresenterImpl.kt
m-audioim/src/main/java/com/ydl/audioim/presenter/AudioHomePresenterImpl.kt
+46
-35
No files found.
config.gradle
View file @
f6456cb1
...
...
@@ -43,7 +43,7 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide"
:
"0.0.
29
"
,
"m-confide"
:
"0.0.
31.8
"
,
"m-consultant"
:
"0.0.44"
,
"m-fm"
:
"0.0.21"
,
"m-user"
:
"0.0.34"
,
...
...
@@ -70,7 +70,7 @@ ext {
"ydl-webview"
:
"0.0.28"
,
"ydl-media"
:
"0.0.14"
,
"ydl-pay"
:
"0.0.11"
,
"m-audioim"
:
"0.0.
2
9"
,
"m-audioim"
:
"0.0.
31.
9"
,
//以下 几乎不会动
"router"
:
"0.0.1"
,
...
...
@@ -110,7 +110,7 @@ ext {
"ydl-webview"
:
"0.0.28"
,
"ydl-media"
:
"0.0.14"
,
"ydl-pay"
:
"0.0.11"
,
"m-audioim"
:
"0.0.
2
9"
,
"m-audioim"
:
"0.0.
31.
9"
,
//以下 几乎不会动
...
...
m-audioim/build.gradle
View file @
f6456cb1
...
...
@@ -83,10 +83,12 @@ dependencies {
//开发时使用
api
project
(
':ydl-platform'
)
api
project
(
':ydl-webview'
)
implementation
modularPublication
(
'com.ydl:m-user-api'
)
implementation
modularPublication
(
'com.ydl:m-audioim-api'
)
}
else
{
//发布时使用
api
rootProject
.
ext
.
dependencies
[
"ydl-webview"
]
compileOnly
rootProject
.
ext
.
dependencies
[
"ydl-m-user-api"
]
compileOnly
rootProject
.
ext
.
dependencies
[
"ydl-m-audioim-api"
]
api
(
rootProject
.
ext
.
dependencies
[
"ydl-platform"
])
{
transitive
=
true
...
...
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
View file @
f6456cb1
...
...
@@ -38,10 +38,7 @@ import com.ydl.ydl_image.config.SimpleImageOpConfiger
import
com.ydl.ydl_image.manager.YDLImageCacheManager
import
com.ydl.ydl_av.chat.bean.AudioMessageBean
import
com.ydl.audioim.contract.IAudioHomeActivityContract
import
com.ydl.audioim.http.command.ConnectCommand
import
com.ydl.audioim.http.command.ConnectFinishCommand
import
com.ydl.audioim.http.command.ConnectStartCommand
import
com.ydl.audioim.http.command.NoticePushCommand
import
com.ydl.audioim.http.command.*
import
com.ydl.audioim.player.AudioPlayer
import
com.ydl.audioim.presenter.AudioHomePresenterImpl
import
com.ydl.audioim.utils.DateUtils
...
...
@@ -51,10 +48,12 @@ import com.ydl.webview.H5Params
import
com.ydl.webview.NewH5Activity
import
com.ydl.webview.RefreshWebEvent
import
com.ydl.ydlcommon.base.BaseMvpActivity
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.router.YdlCommonRouterManager
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.StatusBarUtils
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.yidianling.user.api.service.IUserService
import
de.greenrobot.event.EventBus
import
io.agora.rtc.IRtcEngineEventHandler
import
io.reactivex.Observable
...
...
@@ -174,6 +173,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override
fun
onWarning
(
warn
:
Int
)
{
super
.
onWarning
(
warn
)
uploadException
(
"mRtcEventHandler-onWarning:warnCode--%${warn}"
)
//103:没有可用的频道资源。可能是因为服务端没法分配频道资源
//104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
...
...
@@ -192,6 +192,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override
fun
onError
(
err
:
Int
)
{
super
.
onError
(
err
)
uploadException
(
"mRtcEventHandler-onError:errorCode--%${err}"
)
//3:SDK 初始化失败。Agora 建议尝试以下处理方法
//7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化
//10:API 调用超时。有些 API 调用需要 SDK 返回结果,如果 SDK 处理时间过长,超过 10 秒没有返回,会出现此错误
...
...
@@ -288,6 +289,17 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
}
//
/**
* 上传错误日志
*/
private
fun
uploadException
(
message
:
String
)
{
var
time
:
String
=
(
System
.
currentTimeMillis
()
/
1000
).
toString
()
var
uid
:
String
=
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
).
getUserInfo
()
?.
uid
!!
var
payLoad
=
PayLoad
(
channelId
?:
"0"
,
time
,
uid
,
"1"
,
"999"
,
message
)
var
connectException
=
ConnectExceptionCommand
(
time
,
"2"
,
"99"
,
payLoad
)
getPresenter
().
connectException
(
connectException
)
}
override
fun
createPresenter
():
IAudioHomeActivityContract
.
Presenter
{
return
AudioHomePresenterImpl
()
}
...
...
@@ -609,13 +621,13 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
remainTime
!!
.
toInt
()
-
localRemainTime
!!
,
callId
!!
,
"0"
,
"0"
,
"$callStartTime"
,
"${System.currentTimeMillis()}"
,
3
)
mPresenter
.
connectFinish
(
param
)
//
mPresenter.connectFinish(param)
}
else
{
//接通开始回调
callStartTime
=
System
.
currentTimeMillis
()
var
param
=
ConnectStartCommand
(
listenerUid
!!
,
relationId
!!
,
callId
!!
,
"${System.currentTimeMillis()}"
,
"3"
,
"0"
,
"0"
,
"0"
,
"0"
)
mPresenter
.
connectStart
(
param
)
//
mPresenter.connectStart(param)
}
}
...
...
m-audioim/src/main/java/com/ydl/audioim/contract/IAudioHomeActivityContract.kt
View file @
f6456cb1
package
com.ydl.audioim.contract
import
com.ydl.audioim.bean.ConnectBean
import
com.ydl.audioim.http.command.ConnectCommand
import
com.ydl.audioim.http.command.ConnectFinishCommand
import
com.ydl.audioim.http.command.ConnectStartCommand
import
com.ydl.audioim.http.command.NoticePushCommand
import
com.ydl.audioim.http.command.*
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.ydl.ydlcommon.mvp.base.BasePresenter
...
...
@@ -66,13 +63,18 @@ interface IAudioHomeActivityContract {
* 通话开始(更新专家状态)
* @param param 请求参数
*/
fun
connectStart
(
param
:
ConnectStartCommand
)
//
fun connectStart(param: ConnectStartCommand)
/**
* 通话结束(更新专家状态)
* @param param 请求参数
*/
fun
connectFinish
(
param
:
ConnectFinishCommand
)
// fun connectFinish(param: ConnectFinishCommand)
/**
* 通话异常
*/
fun
connectException
(
param
:
ConnectExceptionCommand
)
/**
...
...
@@ -91,12 +93,17 @@ interface IAudioHomeActivityContract {
/**
* 通话开始回调(更新专家状态)
*/
fun
connectStart
(
param
:
ConnectStartCommand
):
Observable
<
BaseAPIResponse
<
Any
>>
//
fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>>
/**
* 通话结束(更新专家状态)
*/
fun
connectFinish
(
param
:
ConnectFinishCommand
):
Observable
<
BaseAPIResponse
<
Any
>>
// fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>>
/**
* 通话异常
*/
fun
connectException
(
param
:
ConnectExceptionCommand
):
Observable
<
BaseAPIResponse
<
Any
>>
/**
...
...
m-audioim/src/main/java/com/ydl/audioim/http/AudioApiRequestUtil.kt
View file @
f6456cb1
...
...
@@ -3,10 +3,7 @@ package com.ydl.audioim.http
import
com.google.gson.Gson
import
com.ydl.audioim.bean.AgoraTokenResponse
import
com.ydl.audioim.bean.ConnectBean
import
com.ydl.audioim.http.command.ConnectCommand
import
com.ydl.audioim.http.command.NoticePushCommand
import
com.ydl.audioim.http.command.ConnectFinishCommand
import
com.ydl.audioim.http.command.ConnectStartCommand
import
com.ydl.audioim.http.command.*
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.ydl.ydlcommon.data.http.RxUtils
...
...
@@ -41,12 +38,12 @@ class AudioApiRequestUtil {
* @param param
* @return
*/
fun
connectStart
(
param
:
ConnectStartCommand
):
Observable
<
BaseAPIResponse
<
Any
>>
{
// val list = YdlRetrofitUtils.getPostList(param)
var
str
=
Gson
().
toJson
(
param
)
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
return
YDLHttpUtils
.
obtainApi
(
AudioNetAPi
::
class
.
java
).
connectStart
(
body
)
}
//
fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
//
//
val list = YdlRetrofitUtils.getPostList(param)
//
var str = Gson().toJson(param)
//
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
//
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectStart(body)
//
}
/**
* 通话结束回调
...
...
@@ -54,11 +51,23 @@ class AudioApiRequestUtil {
* @param param
* @return
*/
fun
connectFinish
(
param
:
ConnectFinishCommand
):
Observable
<
BaseAPIResponse
<
Any
>>
{
// val list = YdlRetrofitUtils.getPostList(param)
// fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
//// val list = YdlRetrofitUtils.getPostList(param)
// var str = Gson().toJson(param)
// val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
// return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectFinish(body)
// }
/**
* 通话警告与异常回调
*
* @param param
* @return
*/
fun
connectException
(
param
:
ConnectExceptionCommand
):
Observable
<
BaseAPIResponse
<
Any
>>
{
var
str
=
Gson
().
toJson
(
param
)
val
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json; charset=utf-8"
),
str
)
as
RequestBody
return
YDLHttpUtils
.
obtainApi
(
AudioNetAPi
::
class
.
java
).
connect
Finish
(
body
)
return
YDLHttpUtils
.
obtainApi
(
AudioNetAPi
::
class
.
java
).
connect
Exception
(
body
)
}
/**
...
...
m-audioim/src/main/java/com/ydl/audioim/http/AudioNetAPi.kt
View file @
f6456cb1
...
...
@@ -21,16 +21,23 @@ interface AudioNetAPi {
/**
* 通话开始回调
*/
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
,
"Content-Type:application/json"
)
@POST
(
"auth/listen-order/callback/agora/start"
)
fun
connectStart
(
@Body
body
:
RequestBody
):
Observable
<
BaseAPIResponse
<
Any
>>
//
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
//
@POST("auth/listen-order/callback/agora/start")
//
fun connectStart(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
/**
* 通话结束回调
*/
// @Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json")
// @POST("auth/listen-order/callback/agora/finish")
// fun connectFinish(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
/**
* 通话警告与错误回调
*/
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
,
"Content-Type:application/json"
)
@POST
(
"auth/listen-order/callback/agora
/finish
"
)
fun
connect
Finish
(
@Body
body
:
RequestBody
):
Observable
<
BaseAPIResponse
<
Any
>>
@POST
(
"auth/listen-order/callback/agora"
)
fun
connect
Exception
(
@Body
body
:
RequestBody
):
Observable
<
BaseAPIResponse
<
Any
>>
/**
...
...
m-audioim/src/main/java/com/ydl/audioim/http/command/ConnectExceptionCommand.kt
0 → 100644
View file @
f6456cb1
package
com.ydl.audioim.http.command
import
com.ydl.ydlcommon.data.http.BaseCommand
/**
连接异常请求bean
*/
data class
ConnectExceptionCommand
(
var
noticeId
:
String
,
// 秒级
var
productId
:
String
,
// 2
var
eventType
:
String
,
// 99
var
payload
:
PayLoad
)
:
BaseCommand
()
data class
PayLoad
(
var
channelName
:
String
,
// 房间id
var
ts
:
String
,
// 秒级
var
uid
:
String
,
var
platform
:
String
,
var
reason
:
String
,
var
message
:
String
)
\ No newline at end of file
m-audioim/src/main/java/com/ydl/audioim/model/AudioHomeModelImpl.kt
View file @
f6456cb1
...
...
@@ -3,10 +3,7 @@ package com.ydl.audioim.model
import
com.ydl.audioim.bean.ConnectBean
import
com.ydl.audioim.contract.IAudioHomeActivityContract
import
com.ydl.audioim.http.AudioApiRequestUtil
import
com.ydl.audioim.http.command.ConnectCommand
import
com.ydl.audioim.http.command.NoticePushCommand
import
com.ydl.audioim.http.command.ConnectFinishCommand
import
com.ydl.audioim.http.command.ConnectStartCommand
import
com.ydl.audioim.http.command.*
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseResponse
import
io.reactivex.Observable
...
...
@@ -19,12 +16,16 @@ import io.reactivex.Observable
* @date 2018/10/30
*/
class
AudioHomeModelImpl
:
IAudioHomeActivityContract
.
Model
{
override
fun
connectStart
(
param
:
ConnectStartCommand
):
Observable
<
BaseAPIResponse
<
Any
>>
{
return
AudioApiRequestUtil
.
connectStart
(
param
)
}
// override fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
// return AudioApiRequestUtil.connectStart(param)
// }
//
// override fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
// return AudioApiRequestUtil.connectFinish(param)
// }
override
fun
connect
Finish
(
param
:
ConnectFinish
Command
):
Observable
<
BaseAPIResponse
<
Any
>>
{
return
AudioApiRequestUtil
.
connect
Finish
(
param
)
override
fun
connect
Exception
(
param
:
ConnectException
Command
):
Observable
<
BaseAPIResponse
<
Any
>>
{
return
AudioApiRequestUtil
.
connect
Exception
(
param
)
}
override
fun
noticeServerPush
(
param
:
NoticePushCommand
):
Observable
<
BaseResponse
<
Any
>>
{
...
...
m-audioim/src/main/java/com/ydl/audioim/presenter/AudioHomePresenterImpl.kt
View file @
f6456cb1
...
...
@@ -3,10 +3,7 @@ package com.ydl.audioim.presenter
import
com.ydl.audioim.BuildConfig
import
com.ydl.ydl_av.chat.config.YDLChatParam
import
com.ydl.audioim.contract.IAudioHomeActivityContract
import
com.ydl.audioim.http.command.ConnectCommand
import
com.ydl.audioim.http.command.ConnectFinishCommand
import
com.ydl.audioim.http.command.ConnectStartCommand
import
com.ydl.audioim.http.command.NoticePushCommand
import
com.ydl.audioim.http.command.*
import
com.ydl.audioim.model.AudioHomeModelImpl
import
com.ydl.ydlcommon.mvp.base.BasePresenter
import
com.ydl.ydlcommon.router.YdlCommonRouterManager
...
...
@@ -23,48 +20,62 @@ import io.reactivex.schedulers.Schedulers
* @date 2018/10/30
*/
class
AudioHomePresenterImpl
:
BasePresenter
<
IAudioHomeActivityContract
.
View
,
IAudioHomeActivityContract
.
Model
>(),
IAudioHomeActivityContract
.
Presenter
{
override
fun
connectStart
(
param
:
ConnectStartCommand
)
{
mModel
.
connectStart
(
param
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doOnSubscribe
{
// override fun connectStart(param: ConnectStartCommand) {
// mModel.connectStart(param)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .doOnSubscribe {
//
// }
// .doAfterTerminate {
//// view.dismissProgressView()
// }
// .subscribe({
//// if (isSwitchAxb) {
//// //切换axb:跳到拨号界面
//// view.dialPhone()
//// }
// }, { e ->
// LogUtil.e(e.message)
// })
// }
}
.
doAfterTerminate
{
// view.dismissProgressView()
}
.
subscribe
({
// if (isSwitchAxb) {
// //切换axb:跳到拨号界面
// view.dialPhone()
// }
},
{
e
->
LogUtil
.
e
(
e
.
message
)
})
}
// override fun connectFinish(param: ConnectFinishCommand) {
// mModel.connectFinish(param)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .doOnSubscribe {
// //通知服务端专家已经接通时,此时用户已在界面通话中,不需要弹进度条
// mView.showProgressView()
// }
// .doAfterTerminate {
// mView.dismissProgressView()
// }
// .subscribe({
//// if (isSwitchAxb) {
//// //切换axb:跳到拨号界面
//// view.dialPhone()
//// }
// //挂断逻辑:不管接口调用成功与否,都关闭界面
// mView.finishActivity()
// }, { e ->
// LogUtil.e(e.message)
// //挂断逻辑:不管接口调用成功与否,都关闭界面
// mView.finishActivity()
// })
// }
override
fun
connect
Finish
(
param
:
ConnectFinish
Command
)
{
mModel
.
connect
Finish
(
param
)
override
fun
connect
Exception
(
param
:
ConnectException
Command
)
{
mModel
.
connect
Exception
(
param
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doOnSubscribe
{
//通知服务端专家已经接通时,此时用户已在界面通话中,不需要弹进度条
mView
.
showProgressView
()
}
.
doAfterTerminate
{
mView
.
dismissProgressView
()
}
.
subscribe
({
// if (isSwitchAxb) {
// //切换axb:跳到拨号界面
// view.dialPhone()
// }
//挂断逻辑:不管接口调用成功与否,都关闭界面
mView
.
finishActivity
()
},
{
e
->
LogUtil
.
e
(
e
.
message
)
//挂断逻辑:不管接口调用成功与否,都关闭界面
mView
.
finishActivity
()
})
}
...
...
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