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
42ec19d1
Commit
42ec19d1
authored
Apr 22, 2020
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
声网流程优化
parent
1ed4124c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
487 additions
and
246 deletions
+487
-246
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+2
-2
config.gradle
config.gradle
+5
-5
build.gradle
m-audioim/build.gradle
+2
-0
AudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
+71
-56
YDLavManager.kt
m-audioim/src/main/java/com/ydl/audioim/YDLavManager.kt
+47
-48
AudioImIn.kt
m-audioim/src/main/java/com/ydl/audioim/router/AudioImIn.kt
+35
-0
ConsultantAudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/consultantim/ConsultantAudioHomeActivity.kt
+70
-10
av_audio_wifi_better.png
m-audioim/src/main/res/drawable-xhdpi/av_audio_wifi_better.png
+0
-0
av_audio_wifi_normal.png
m-audioim/src/main/res/drawable-xhdpi/av_audio_wifi_normal.png
+0
-0
audioim_activity_audio_home.xml
m-audioim/src/main/res/layout/audioim_activity_audio_home.xml
+66
-16
audioim_cativity_consultant_audio_home.xml
m-audioim/src/main/res/layout/audioim_cativity_consultant_audio_home.xml
+23
-2
ExpertSearchActivity.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
+0
-0
ExpertSearchFragment.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
+1
-3
ExpertSearchAdapter.kt
m-consultant/src/main/java/com/yidianling/consultant/adapter/ExpertSearchAdapter.kt
+1
-11
ImObserversHelper.kt
m-im/src/main/java/com/yidianling/im/helper/ImObserversHelper.kt
+51
-51
IMServiceImpl.kt
m-im/src/main/java/com/yidianling/im/modular/service/IMServiceImpl.kt
+65
-40
IMRegisterObserverCustomNotificationCallBack.kt
m-im/src/main/modular_api/com/yidianling/im/api/bean/IMRegisterObserverCustomNotificationCallBack.kt
+14
-0
IMSendCustomNotificationResultCallBack.kt
m-im/src/main/modular_api/com/yidianling/im/api/bean/IMSendCustomNotificationResultCallBack.kt
+18
-0
IImService.kt
m-im/src/main/modular_api/com/yidianling/im/api/service/IImService.kt
+16
-2
No files found.
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
42ec19d1
...
@@ -20,8 +20,8 @@ import java.util.List;
...
@@ -20,8 +20,8 @@ import java.util.List;
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
String
APP_DOMAIN
=
"https://api.github.com/"
;
String
APP_DOMAIN
=
"https://api.github.com/"
;
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
//
public static String appEnv = YDLConstants.ENV_TEST;
public
static
String
appEnv
=
YDLConstants
.
ENV_TEST
;
public
static
String
appEnv
=
YDLConstants
.
ENV_PROD
;
//
public static String appEnv = YDLConstants.ENV_PROD;
@Override
@Override
public
void
injectAppLifecycle
(
@NotNull
Context
context
,
@NotNull
List
<
IAppLifecycles
>
lifecycles
)
{
public
void
injectAppLifecycle
(
@NotNull
Context
context
,
@NotNull
List
<
IAppLifecycles
>
lifecycles
)
{
...
...
config.gradle
View file @
42ec19d1
ext
{
ext
{
kotlin_version
=
"1.3.21"
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
appName
:
"心理咨询壹点灵"
,
...
@@ -42,8 +42,8 @@ ext {
...
@@ -42,8 +42,8 @@ ext {
ydlPublishVersion
=
[
ydlPublishVersion
=
[
// -------------- 业务模块 --------------
// -------------- 业务模块 --------------
//第三步 若干
//第三步 若干
"m-confide"
:
"0.0.48.2
2
"
,
"m-confide"
:
"0.0.48.2
6
"
,
"m-consultant"
:
"0.0.59.
8
"
,
"m-consultant"
:
"0.0.59.
14
"
,
"m-fm"
:
"0.0.29.3"
,
"m-fm"
:
"0.0.29.3"
,
"m-user"
:
"0.0.60.3"
,
"m-user"
:
"0.0.60.3"
,
"m-home"
:
"0.0.22.2"
,
"m-home"
:
"0.0.22.2"
,
...
@@ -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.49.
0
"
,
"m-audioim"
:
"0.0.49.
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.49.
0
"
,
"m-audioim"
:
"0.0.49.
5
"
,
"ydl-flutter-base"
:
"0.0.10.9"
,
"ydl-flutter-base"
:
"0.0.10.9"
,
//以下 几乎不会动
//以下 几乎不会动
...
...
m-audioim/build.gradle
View file @
42ec19d1
...
@@ -85,11 +85,13 @@ dependencies {
...
@@ -85,11 +85,13 @@ dependencies {
api
project
(
':ydl-webview'
)
api
project
(
':ydl-webview'
)
implementation
modularPublication
(
'com.ydl:m-user-api'
)
implementation
modularPublication
(
'com.ydl:m-user-api'
)
implementation
modularPublication
(
'com.ydl:m-audioim-api'
)
implementation
modularPublication
(
'com.ydl:m-audioim-api'
)
implementation
modularPublication
(
'com.ydl:m-im-api'
)
}
else
{
}
else
{
//发布时使用
//发布时使用
api
rootProject
.
ext
.
dependencies
[
"ydl-webview"
]
api
rootProject
.
ext
.
dependencies
[
"ydl-webview"
]
compileOnly
rootProject
.
ext
.
dependencies
[
"ydl-m-user-api"
]
compileOnly
rootProject
.
ext
.
dependencies
[
"ydl-m-user-api"
]
compileOnly
rootProject
.
ext
.
dependencies
[
"ydl-m-audioim-api"
]
compileOnly
rootProject
.
ext
.
dependencies
[
"ydl-m-audioim-api"
]
compileOnly
rootProject
.
ext
.
dependencies
[
"ydl-m-im-api"
]
api
(
rootProject
.
ext
.
dependencies
[
"ydl-platform"
])
{
api
(
rootProject
.
ext
.
dependencies
[
"ydl-platform"
])
{
transitive
=
true
transitive
=
true
}
}
...
...
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
View file @
42ec19d1
...
@@ -190,7 +190,7 @@ class AudioHomeActivity :
...
@@ -190,7 +190,7 @@ class AudioHomeActivity :
LogUtil
.
e
(
"[agora]发生警告回调$warn"
)
LogUtil
.
e
(
"[agora]发生警告回调$warn"
)
runOnUiThread
{
runOnUiThread
{
when
(
warn
)
{
when
(
warn
)
{
103
,
10
4
,
105
,
106
,
107
->
{
103
,
10
5
,
107
->
{
writeAgoraLog
(
"通话挂断:网络异常(${warn})"
)
writeAgoraLog
(
"通话挂断:网络异常(${warn})"
)
showToast
(
"当前网络较差,请更换网络!"
)
showToast
(
"当前网络较差,请更换网络!"
)
//通话结束或挂断时,上传日志文件
//通话结束或挂断时,上传日志文件
...
@@ -334,8 +334,47 @@ class AudioHomeActivity :
...
@@ -334,8 +334,47 @@ class AudioHomeActivity :
updateExpertStatus
(
false
,
1
)
updateExpertStatus
(
false
,
1
)
},
500
)
},
500
)
}
}
override
fun
onNetworkQuality
(
uid
:
Int
,
txQuality
:
Int
,
rxQuality
:
Int
)
{
super
.
onNetworkQuality
(
uid
,
txQuality
,
rxQuality
)
var
status
=
-
1
var
netStatus
=
when
(
uid
)
{
listenerUid
!!
.
toInt
()
->
{
if
(
txQuality
in
1
..
2
&&
rxQuality
in
1
..
2
)
{
""
}
else
if
(
txQuality
>=
5
||
rxQuality
>=
5
)
{
"对方的网络已断开"
}
else
{
status
=
if
(
txQuality
>=
4
||
rxQuality
>=
4
)
{
0
}
else
{
1
}
"对方的网络状况不佳"
}
}
0
->
{
if
(
txQuality
in
1
..
2
&&
rxQuality
in
1
..
2
)
{
""
}
else
if
(
txQuality
>=
5
||
rxQuality
>=
5
)
{
"您的网络已断开"
}
else
{
status
=
if
(
txQuality
>=
4
||
rxQuality
>=
4
)
{
0
}
else
{
1
}
"您的网络状况不佳"
}
}
else
->
{
""
}
}
showNetStatus
(
netStatus
,
status
)
}
}
}
//
override
fun
createPresenter
():
IAudioHomeActivityContract
.
Presenter
{
override
fun
createPresenter
():
IAudioHomeActivityContract
.
Presenter
{
return
AudioHomePresenterImpl
()
return
AudioHomePresenterImpl
()
...
@@ -524,7 +563,7 @@ class AudioHomeActivity :
...
@@ -524,7 +563,7 @@ class AudioHomeActivity :
}
}
}
}
@SuppressLint
(
"CheckResult"
)
@SuppressLint
(
"CheckResult"
,
"SetTextI18n"
)
private
fun
init
()
{
private
fun
init
()
{
wave_view
.
start
()
wave_view
.
start
()
//初始化声网
//初始化声网
...
@@ -551,9 +590,10 @@ class AudioHomeActivity :
...
@@ -551,9 +590,10 @@ class AudioHomeActivity :
//开始60s等待倒计时
//开始60s等待倒计时
waitDisposable
=
Observable
.
interval
(
0
,
100
,
TimeUnit
.
MILLISECONDS
)
waitDisposable
=
Observable
.
interval
(
0
,
100
,
TimeUnit
.
MILLISECONDS
)
.
subscribeOn
(
Schedulers
.
computation
())
.
subscribeOn
(
Schedulers
.
computation
())
.
take
(
60
3
)
.
take
(
60
0
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
.
subscribe
({
tv_change_time_counter
.
text
=
"${60 - it / 10}s"
var
result
=
it
.
toFloat
()
/
2.5f
var
result
=
it
.
toFloat
()
/
2.5f
progress_view
.
setProgress
(
result
)
progress_view
.
setProgress
(
result
)
if
(
result
>=
100f
&&
!
iv_hang_up
.
isEnabled
)
{
if
(
result
>=
100f
&&
!
iv_hang_up
.
isEnabled
)
{
...
@@ -594,7 +634,7 @@ class AudioHomeActivity :
...
@@ -594,7 +634,7 @@ class AudioHomeActivity :
}
}
fun
rtcCall
()
{
fun
rtcCall
()
{
YDL
RTMClient
.
instances
.
call
(
listenerUid
!!
,
channelId
,
sendDoctocrMsg
)
YDL
avManager
.
instances
.
rtcCall
(
listenerUid
,
channelId
,
sendDoctocrMsg
)
}
}
...
@@ -766,6 +806,7 @@ class AudioHomeActivity :
...
@@ -766,6 +806,7 @@ class AudioHomeActivity :
* 60s等待完成,专家未接听
* 60s等待完成,专家未接听
*/
*/
private
fun
waittingStatus
()
{
private
fun
waittingStatus
()
{
tv_change_time_counter
.
visibility
=
View
.
GONE
//挂断按钮可点击
//挂断按钮可点击
iv_hang_up
.
isEnabled
=
true
iv_hang_up
.
isEnabled
=
true
iv_hang_up
.
setImageResource
(
R
.
drawable
.
audioim_img_hang_up
)
iv_hang_up
.
setImageResource
(
R
.
drawable
.
audioim_img_hang_up
)
...
@@ -777,54 +818,9 @@ class AudioHomeActivity :
...
@@ -777,54 +818,9 @@ class AudioHomeActivity :
}
}
//切换线路按钮可见
//切换线路按钮可见
tv_change_route
.
isEnabled
=
true
tv_change_route
.
isEnabled
=
true
tv_change_route
.
text
=
"切换至传统电话"
tv_change_route
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
platform_white
))
tv_change_route
.
setTextColor
(
ContextCompat
.
getColor
(
this
,
R
.
color
.
platform_white
))
tv_change_route
.
setCompoundDrawablesWithIntrinsicBounds
(
null
,
null
,
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
audioim_img_choose_arrow
),
null
)
}
/**
* 加入语音聊天频道成功
*/
private
fun
onJoinChannelSuccess
()
{
dismissProgressView
()
playWaitingMusic
()
//45s倒计时逻辑
// disposable = Observable.interval(0, 1, TimeUnit.SECONDS)
// .subscribeOn(Schedulers.computation())
// .take(45)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe({
// }, {
// LogUtil.d(it.message)
// }, {
// if (!isConnectSuccess) {
// tv_change_doctor.visibility = View.VISIBLE
// }
// })
//60超时倒计时逻辑
// waitDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
// .subscribeOn(Schedulers.computation())
// .take(60)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe({
// }, {
// LogUtil.d(it.message)
// }, {
// if (!isConnectSuccess) {
// ActivityManager.getInstance().finishActivity(NewH5Activity::class.java!!)
// showToast("专家未接听")
// userCloseCalling()
// }
// })
}
}
/**
/**
...
@@ -1065,15 +1061,34 @@ class AudioHomeActivity :
...
@@ -1065,15 +1061,34 @@ class AudioHomeActivity :
*/
*/
private
fun
showToast
(
msg
:
String
?)
{
private
fun
showToast
(
msg
:
String
?)
{
runOnUiThread
{
runOnUiThread
{
// tv_toast.visibility = View.VISIBLE
//// tv_toast.text = msg
//// tv_toast.postDelayed({
//// tv_toast.visibility = View.GONE
//// }, 1000)
ToastHelper
.
show
(
msg
?:
""
)
ToastHelper
.
show
(
msg
?:
""
)
}
}
}
}
/**
* 网络状态
*/
private
fun
showNetStatus
(
msg
:
String
,
status
:
Int
=
0
)
{
runOnUiThread
{
if
(
TextUtils
.
isEmpty
(
msg
))
{
tv_nte_status
.
visibility
=
View
.
GONE
}
else
{
tv_nte_status
.
text
=
msg
if
(
status
==
0
)
{
tv_nte_status
.
setCompoundDrawablesWithIntrinsicBounds
(
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
av_audio_wifi_normal
),
null
,
null
,
null
)
}
if
(
status
==
1
)
{
tv_nte_status
.
setCompoundDrawablesWithIntrinsicBounds
(
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
av_audio_wifi_better
),
null
,
null
,
null
)
}
if
(
status
==
-
1
)
{
tv_nte_status
.
setCompoundDrawablesWithIntrinsicBounds
(
null
,
null
,
null
,
null
)
}
tv_nte_status
.
visibility
=
View
.
VISIBLE
}
}
}
override
fun
showProgressView
()
{
override
fun
showProgressView
()
{
try
{
try
{
showProgressDialog
()
showProgressDialog
()
...
...
m-audioim/src/main/java/com/ydl/audioim/YDLavManager.kt
View file @
42ec19d1
...
@@ -7,6 +7,7 @@ import android.text.TextUtils
...
@@ -7,6 +7,7 @@ import android.text.TextUtils
import
com.alibaba.android.arouter.launcher.ARouter
import
com.alibaba.android.arouter.launcher.ARouter
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.router.AudioImIn
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.messge_service.YDLRTMClient
import
com.ydl.ydl_av.messge_service.YDLRTMClient
...
@@ -22,6 +23,7 @@ import com.ydl.ydlcommon.utils.ActivityManager
...
@@ -22,6 +23,7 @@ import com.ydl.ydlcommon.utils.ActivityManager
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import
com.yidianling.user.api.service.IUserService
import
com.yidianling.user.api.service.IUserService
import
io.agora.rtm.RtmStatusCode
import
io.agora.rtm.RtmStatusCode
import
io.reactivex.Observable
import
io.reactivex.Observable
...
@@ -38,7 +40,7 @@ class YDLavManager {
...
@@ -38,7 +40,7 @@ class YDLavManager {
companion
object
{
companion
object
{
val
FILE_NAME
=
"consult"
const
val
FILE_NAME
=
"consult"
//当前sdk的登录状态
//当前sdk的登录状态
var
sdkStatus
=
-
1
var
sdkStatus
=
-
1
...
@@ -128,21 +130,20 @@ class YDLavManager {
...
@@ -128,21 +130,20 @@ class YDLavManager {
//专家离线或者30 秒后仍未收到专家响应,重新再邀请一次
//专家离线或者30 秒后仍未收到专家响应,重新再邀请一次
when
(
errorCode
)
{
when
(
errorCode
)
{
//被叫不在线 呼叫邀请发出 30 秒后被叫仍未 ACK 响应呼叫邀请
//被叫不在线 呼叫邀请发出 30 秒后被叫仍未 ACK 响应呼叫邀请
RtmStatusCode
.
LocalInvitationError
.
LOCAL_INVITATION_ERR_PEER_OFFLINE
,
RtmStatusCode
.
LocalInvitationError
.
LOCAL_INVITATION_ERR_PEER_OFFLINE
,
RtmStatusCode
.
LocalInvitationError
.
LOCAL_INVITATION_ERR_PEER_NO_RESPONSE
->
{
RtmStatusCode
.
LocalInvitationError
.
LOCAL_INVITATION_ERR_PEER_NO_RESPONSE
->
{
if
(
act
is
AudioHomeActivity
)
{
if
(
act
is
AudioHomeActivity
)
{
act
.
runOnUiThread
{
act
.
runOnUiThread
{
act
.
rtcCall
()
act
.
rtcCall
()
}
}
}
}
}
}
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()
}
}
}
}
}
}
...
@@ -175,7 +176,7 @@ class YDLavManager {
...
@@ -175,7 +176,7 @@ class YDLavManager {
override
fun
onRemoteInvitationFailure
(
response
:
CallRemoteResponse
?,
errorCode
:
Int
)
{
override
fun
onRemoteInvitationFailure
(
response
:
CallRemoteResponse
?,
errorCode
:
Int
)
{
//返回给被叫
//返回给被叫
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
)
...
@@ -188,8 +189,20 @@ class YDLavManager {
...
@@ -188,8 +189,20 @@ class YDLavManager {
LogUtil
.
e
(
"[agora]其它消息:${error}"
)
LogUtil
.
e
(
"[agora]其它消息:${error}"
)
}
}
})
})
AudioImIn
.
registerObserveCustomNotification
(
object
:
IMRegisterObserverCustomNotificationCallBack
{
override
fun
onObserverCustomNotification
(
content
:
String
)
{
}
})
}
}
fun
rtcCall
(
listenerUid
:
String
?,
channelId
:
String
?,
sendDoctocrMsg
:
String
?)
{
YDLRTMClient
.
instances
.
call
(
listenerUid
,
channelId
,
sendDoctocrMsg
)
}
fun
cancelCall
()
fun
login
(
userId
:
String
?)
{
fun
login
(
userId
:
String
?)
{
login
(
userId
)
{
_
,
_
->
login
(
userId
)
{
_
,
_
->
...
@@ -206,14 +219,10 @@ class YDLavManager {
...
@@ -206,14 +219,10 @@ class YDLavManager {
}
}
//登录实时消息
//登录实时消息
//获取token
//获取token
AudioApiRequestUtil
.
getAgoraToken
()
AudioApiRequestUtil
.
getAgoraToken
().
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
()).
subscribe
({
.
subscribeOn
(
Schedulers
.
io
())
if
(
"200"
.
equals
(
it
.
code
))
{
.
observeOn
(
AndroidSchedulers
.
mainThread
())
LogUtil
.
e
(
"[agora]登录av的login-uid:$userId"
)
.
subscribe
({
YDLRTMClient
.
instances
.
login
(
LoginParam
(
userId
,
it
.
data
.
token
),
object
:
LoginCallback
{
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
()
{
override
fun
onSuccess
()
{
//登陆成功,发起呼叫
//登陆成功,发起呼叫
LogUtil
.
e
(
"[agora]实时消息登录成功"
)
LogUtil
.
e
(
"[agora]实时消息登录成功"
)
...
@@ -226,14 +235,13 @@ class YDLavManager {
...
@@ -226,14 +235,13 @@ class YDLavManager {
}
}
})
})
}
else
{
}
else
{
LogUtil
.
e
(
"声网token获取失败uid:"
+
userId
+
" error:"
+
it
.
msg
)
LogUtil
.
e
(
"声网token获取失败uid:"
+
userId
+
" error:"
+
it
.
msg
)
LogHelper
.
getInstance
()
LogHelper
.
getInstance
().
writeLogSync
(
"声网token获取失败uid:"
+
userId
+
" error:"
+
it
.
msg
)
.
writeLogSync
(
"声网token获取失败uid:"
+
userId
+
" error:"
+
it
.
msg
)
}
}
},
{
},
{
LogUtil
.
e
(
"声网token获取异常uid:"
+
userId
+
" error:"
+
it
.
message
)
LogUtil
.
e
(
"声网token获取异常uid:"
+
userId
+
" error:"
+
it
.
message
)
})
})
}
}
...
@@ -244,22 +252,15 @@ class YDLavManager {
...
@@ -244,22 +252,15 @@ class YDLavManager {
fun
receivedCall
(
content
:
String
?,
from
:
String
=
""
)
{
fun
receivedCall
(
content
:
String
?,
from
:
String
=
""
)
{
if
(!
TextUtils
.
isEmpty
(
content
))
{
if
(!
TextUtils
.
isEmpty
(
content
))
{
//如果已经接听了用户电话 再有电话进来 是不能接听的
//如果已经接听了用户电话 再有电话进来 是不能接听的
if
(!
activityIsExists
(
ConsultantAudioHomeActivity
::
class
.
java
)
&&
!
activityIsExists
(
if
(!
activityIsExists
(
ConsultantAudioHomeActivity
::
class
.
java
)
&&
!
activityIsExists
(
AudioHomeActivity
::
class
.
java
))
{
AudioHomeActivity
::
class
.
java
)
)
{
//延时启动通话界面,防止刚打开就被main遮挡
//延时启动通话界面,防止刚打开就被main遮挡
Observable
.
timer
(
1000
,
TimeUnit
.
MILLISECONDS
).
subscribeOn
(
Schedulers
.
io
())
Observable
.
timer
(
1000
,
TimeUnit
.
MILLISECONDS
).
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
()).
subscribe
{
.
observeOn
(
AndroidSchedulers
.
mainThread
())
LogUtil
.
e
(
"[agora]启动通话界面"
)
.
subscribe
{
//邀请加入频道消息,跳转通话界面
LogUtil
.
e
(
"[agora]启动通话界面"
)
ARouter
.
getInstance
().
build
(
"/av/ConsultantAudioHomeActivity"
).
withString
(
"param"
,
content
).
navigation
()
//邀请加入频道消息,跳转通话界面
ARouter
.
getInstance
().
build
(
"/av/ConsultantAudioHomeActivity"
)
AudioLogUtils
.
writeAgoraLog
(
"收到主叫方通话邀请($from)"
,
FILE_NAME
,
false
)
.
withString
(
"param"
,
content
)
}
.
navigation
()
AudioLogUtils
.
writeAgoraLog
(
"收到主叫方通话邀请($from)"
,
FILE_NAME
,
false
)
}
}
else
{
}
else
{
LogUtil
.
d
(
"[agora]收到声网邀请,但界面实例已存在"
)
LogUtil
.
d
(
"[agora]收到声网邀请,但界面实例已存在"
)
}
}
...
@@ -316,15 +317,13 @@ class YDLavManager {
...
@@ -316,15 +317,13 @@ class YDLavManager {
*/
*/
@SuppressLint
(
"CheckResult"
)
@SuppressLint
(
"CheckResult"
)
fun
uploadException
(
connectException
:
ConnectExceptionCommand
,
callback
:
UploadExceptionCallback
?)
{
fun
uploadException
(
connectException
:
ConnectExceptionCommand
,
callback
:
UploadExceptionCallback
?)
{
AudioApiRequestUtil
.
connectException
(
connectException
)
AudioApiRequestUtil
.
connectException
(
connectException
).
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
callback
?.
onSuccess
()
.
subscribe
({
},
{
callback
?.
onSuccess
()
LogUtil
.
e
(
"agora"
,
"声网上传异常与错误日志接口调用失败:"
+
it
.
message
)
},
{
})
LogUtil
.
e
(
"agora"
,
"声网上传异常与错误日志接口调用失败:"
+
it
.
message
)
})
}
}
/**
/**
...
...
m-audioim/src/main/java/com/ydl/audioim/router/AudioImIn.kt
0 → 100644
View file @
42ec19d1
package
com.ydl.audioim.router
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import
com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack
import
com.yidianling.im.api.service.IImService
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/4/21
*/
object
AudioImIn
{
private
fun
getImService
():
IImService
{
return
ModularServiceManager
.
provide
(
IImService
::
class
.
java
)
}
/**
* 发送自定义通知
*/
fun
sendCustomNotification
(
toUid
:
String
,
content
:
String
,
callback
:
IMSendCustomNotificationResultCallBack
)
{
getImService
().
sendCustomNotification
(
toUid
,
content
,
callback
)
}
/**
* 注册自定通知接收器
*/
fun
registerObserveCustomNotification
(
callback
:
IMRegisterObserverCustomNotificationCallBack
)
{
getImService
().
registerObserveCustomNotification
(
callback
)
}
}
\ No newline at end of file
m-audioim/src/main/java/com/ydl/consultantim/ConsultantAudioHomeActivity.kt
View file @
42ec19d1
...
@@ -13,6 +13,7 @@ import android.hardware.SensorManager
...
@@ -13,6 +13,7 @@ import android.hardware.SensorManager
import
android.net.Uri
import
android.net.Uri
import
android.os.PowerManager
import
android.os.PowerManager
import
android.provider.Settings
import
android.provider.Settings
import
android.support.v4.content.ContextCompat
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
android.view.animation.AccelerateInterpolator
import
android.view.animation.AccelerateInterpolator
...
@@ -104,6 +105,7 @@ class ConsultantAudioHomeActivity :
...
@@ -104,6 +105,7 @@ class ConsultantAudioHomeActivity :
private
var
channelToken
:
String
?
=
null
private
var
channelToken
:
String
?
=
null
private
var
hasUpLoadLog
=
false
private
var
hasUpLoadLog
=
false
private
var
callStatus
:
Int
=
-
1
private
var
callStatus
:
Int
=
-
1
private
var
userId
=
-
1
/**
/**
* 是否连接成功
* 是否连接成功
...
@@ -241,14 +243,6 @@ class ConsultantAudioHomeActivity :
...
@@ -241,14 +243,6 @@ class ConsultantAudioHomeActivity :
}
}
}
}
/**
* 网络质量报告回调
* 报告本地用户的网络质量。当你调用 enableLastmileTest 之后,该回调函数每 2 秒触发一次
*/
override
fun
onLastmileQuality
(
quality
:
Int
)
{
super
.
onLastmileQuality
(
quality
)
}
override
fun
onWarning
(
warn
:
Int
)
{
override
fun
onWarning
(
warn
:
Int
)
{
super
.
onWarning
(
warn
)
super
.
onWarning
(
warn
)
// 过滤1031 录制声音模糊
// 过滤1031 录制声音模糊
...
@@ -263,7 +257,7 @@ class ConsultantAudioHomeActivity :
...
@@ -263,7 +257,7 @@ class ConsultantAudioHomeActivity :
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
runOnUiThread
{
runOnUiThread
{
when
(
warn
)
{
when
(
warn
)
{
103
,
10
4
,
105
,
106
,
107
->
{
103
,
10
5
,
107
->
{
writeAgoraLog
(
"通话挂断:网络异常($warn)"
)
writeAgoraLog
(
"通话挂断:网络异常($warn)"
)
showToast
(
"当前网络较差,请更换网络!"
)
showToast
(
"当前网络较差,请更换网络!"
)
//通话结束或挂断时,上传日志文件
//通话结束或挂断时,上传日志文件
...
@@ -316,6 +310,46 @@ class ConsultantAudioHomeActivity :
...
@@ -316,6 +310,46 @@ class ConsultantAudioHomeActivity :
}
}
}
}
}
}
override
fun
onNetworkQuality
(
uid
:
Int
,
txQuality
:
Int
,
rxQuality
:
Int
)
{
super
.
onNetworkQuality
(
uid
,
txQuality
,
rxQuality
)
var
status
=
-
1
var
netStatus
=
when
(
uid
)
{
userId
!!
.
toInt
()
->
{
if
(
txQuality
in
1
..
2
&&
rxQuality
in
1
..
2
)
{
""
}
else
if
(
txQuality
>=
5
||
rxQuality
>=
5
)
{
"对方的网络已断开"
}
else
{
status
=
if
(
txQuality
>=
4
||
rxQuality
>=
4
)
{
0
}
else
{
1
}
"对方的网络状况不佳"
}
}
0
->
{
if
(
txQuality
in
1
..
2
&&
rxQuality
in
1
..
2
)
{
""
}
else
if
(
txQuality
>=
5
||
rxQuality
>=
5
)
{
"您的网络已断开"
}
else
{
status
=
if
(
txQuality
>=
4
||
rxQuality
>=
4
)
{
0
}
else
{
1
}
"您的网络状况不佳"
}
}
else
->
{
""
}
}
showNetStatus
(
netStatus
,
status
)
}
}
}
...
@@ -419,6 +453,7 @@ class ConsultantAudioHomeActivity :
...
@@ -419,6 +453,7 @@ class ConsultantAudioHomeActivity :
}
else
{
}
else
{
iv_head
.
setBackgroundResource
(
R
.
drawable
.
audioim_head_place_hold_pic
)
iv_head
.
setBackgroundResource
(
R
.
drawable
.
audioim_head_place_hold_pic
)
}
}
userId
=
mAudioMessageBean
!!
.
userId
?.
toInt
()
?:
-
1
}
else
{
}
else
{
iv_head
.
setBackgroundResource
(
R
.
drawable
.
audioim_head_place_hold_pic
)
iv_head
.
setBackgroundResource
(
R
.
drawable
.
audioim_head_place_hold_pic
)
}
}
...
@@ -733,6 +768,31 @@ class ConsultantAudioHomeActivity :
...
@@ -733,6 +768,31 @@ class ConsultantAudioHomeActivity :
}
}
}
}
/**
* 网络状态
*/
private
fun
showNetStatus
(
msg
:
String
,
status
:
Int
=
0
)
{
runOnUiThread
{
if
(
TextUtils
.
isEmpty
(
msg
))
{
tv_nte_status
.
visibility
=
View
.
GONE
}
else
{
tv_nte_status
.
text
=
msg
if
(
status
==
0
)
{
tv_nte_status
.
setCompoundDrawablesWithIntrinsicBounds
(
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
av_audio_wifi_normal
),
null
,
null
,
null
)
}
if
(
status
==
1
)
{
tv_nte_status
.
setCompoundDrawablesWithIntrinsicBounds
(
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
av_audio_wifi_better
),
null
,
null
,
null
)
}
if
(
status
==
-
1
)
{
tv_nte_status
.
setCompoundDrawablesWithIntrinsicBounds
(
null
,
null
,
null
,
null
)
}
tv_nte_status
.
visibility
=
View
.
VISIBLE
}
}
}
//关闭本页面
//关闭本页面
fun
close
(
code
:
Int
,
msg
:
String
)
{
fun
close
(
code
:
Int
,
msg
:
String
)
{
runOnUiThread
{
runOnUiThread
{
...
@@ -802,7 +862,7 @@ class ConsultantAudioHomeActivity :
...
@@ -802,7 +862,7 @@ class ConsultantAudioHomeActivity :
.
subscribe
({},
{},
{
.
subscribe
({},
{},
{
if
(!
isConnectSuccess
)
{
if
(!
isConnectSuccess
)
{
writeAgoraLog
(
"通话未接通挂断:连接中的状态超过5s自动挂断"
)
writeAgoraLog
(
"通话未接通挂断:连接中的状态超过5s自动挂断"
)
showToast
(
"用户已挂断"
)
showToast
(
"用户已挂断"
)
close
(
RESULT_NOT_ANSWERED_CODE
,
""
)
close
(
RESULT_NOT_ANSWERED_CODE
,
""
)
}
}
})
})
...
...
m-audioim/src/main/res/drawable-xhdpi/av_audio_wifi_better.png
0 → 100644
View file @
42ec19d1
964 Bytes
m-audioim/src/main/res/drawable-xhdpi/av_audio_wifi_normal.png
0 → 100644
View file @
42ec19d1
996 Bytes
m-audioim/src/main/res/layout/audioim_activity_audio_home.xml
View file @
42ec19d1
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/platform_color_80353535"
>
android:background=
"@color/platform_color_80353535"
>
<TextView
<TextView
android:id=
"@+id/tv_change_route"
android:id=
"@+id/tv_change_route"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -14,21 +15,30 @@
...
@@ -14,21 +15,30 @@
android:layout_marginTop=
"25dp"
android:layout_marginTop=
"25dp"
android:layout_marginRight=
"10dp"
android:layout_marginRight=
"10dp"
android:background=
"?android:attr/selectableItemBackground"
android:background=
"?android:attr/selectableItemBackground"
android:drawableRight=
"@drawable/audioim_img_choose_arrow_unuse"
android:drawablePadding=
"6dp"
android:drawablePadding=
"6dp"
android:padding=
"5dp"
android:padding=
"5dp"
android:text=
"切换至传统电话"
android:text=
"
后可
切换至传统电话"
android:textColor=
"@color/platform_color_50FFFFFF"
android:textColor=
"@color/platform_color_50FFFFFF"
android:textSize=
"13sp"
android:textSize=
"13sp"
android:visibility=
"visible"
/>
android:visibility=
"visible"
/>
<TextView
android:id=
"@+id/tv_change_time_counter"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignBaseline=
"@+id/tv_change_route"
android:layout_toLeftOf=
"@+id/tv_change_route"
android:textColor=
"@color/white"
android:textSize=
"15dp"
tools:text=
"60s"
/>
<RelativeLayout
<RelativeLayout
android:id=
"@+id/rl_head"
android:id=
"@+id/rl_head"
android:layout_width=
"250dp"
android:layout_width=
"250dp"
android:layout_height=
"250dp"
android:layout_height=
"250dp"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"
74
dp"
>
android:layout_marginTop=
"
60
dp"
>
<com.ydl.ydlcommon.view.WaveView
<com.ydl.ydlcommon.view.WaveView
android:id=
"@+id/wave_view"
android:id=
"@+id/wave_view"
...
@@ -80,33 +90,53 @@
...
@@ -80,33 +90,53 @@
tools:text=
"你存在的本身就是值得被爱的你存在的本身就是值得被爱的"
/>
tools:text=
"你存在的本身就是值得被爱的你存在的本身就是值得被爱的"
/>
<!-- 倾诉剩余时间-->
<!-- 倾诉剩余时间-->
<
Relative
Layout
<
android.support.constraint.Constraint
Layout
android:id=
"@+id/rl_remain_time"
android:id=
"@+id/rl_remain_time"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_above=
"@+id/rl_hang_up"
android:layout_above=
"@+id/rl_hang_up"
android:layout_marginBottom=
"20dp"
android:layout_marginBottom=
"20dp"
android:visibility=
"gone"
>
android:visibility=
"gone"
tools:visibility=
"visible"
>
<TextView
<TextView
android:id=
"@+id/tv_notes"
android:id=
"@+id/tv_notes"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:text=
"剩余时长"
android:text=
"您的倾诉时间还有"
android:textColor=
"@color/white"
android:textColor=
"@color/platform_color_30FFFFFF"
android:textSize=
"15dp"
android:textSize=
"12sp"
/>
app:layout_constraintEnd_toStartOf=
"@+id/tv_remain_time"
app:layout_constraintHorizontal_chainStyle=
"packed"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
<TextView
android:id=
"@+id/tv_remain_time"
android:id=
"@+id/tv_remain_time"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_
below=
"@+id/tv_notes
"
android:layout_
marginStart=
"11dp
"
android:layout_
centerHorizontal=
"true
"
android:layout_
toRightOf=
"@+id/tv_notes
"
android:text=
"23:23"
android:text=
"23:23"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"20sp"
/>
android:textSize=
"16dp"
</RelativeLayout>
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/tv_notes"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_notes"
android:layout_marginTop=
"2dp"
android:text=
"(限24小时内拨打)"
android:textColor=
"#80FFFFFF"
android:textSize=
"15dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv_remain_time"
/>
</android.support.constraint.ConstraintLayout>
<TextView
<TextView
android:id=
"@+id/tv_change_doctor"
android:id=
"@+id/tv_change_doctor"
...
@@ -130,7 +160,8 @@
...
@@ -130,7 +160,8 @@
android:text=
"正在等待聆听者接受邀请…"
android:text=
"正在等待聆听者接受邀请…"
android:textColor=
"@color/platform_color_70FFFFFF"
android:textColor=
"@color/platform_color_70FFFFFF"
android:textSize=
"12sp"
android:textSize=
"12sp"
android:visibility=
"visible"
/>
android:visibility=
"visible"
tools:visibility=
"gone"
/>
<!--挂断按钮-->
<!--挂断按钮-->
<RelativeLayout
<RelativeLayout
...
@@ -212,8 +243,27 @@
...
@@ -212,8 +243,27 @@
android:paddingBottom=
"4dp"
android:paddingBottom=
"4dp"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:visibility=
"gone"
android:visibility=
"gone"
tools:visibility=
"visible"
tools:text=
"已接通"
tools:text=
"已接通"
/>
tools:visibility=
"visible"
/>
<TextView
android:id=
"@+id/tv_nte_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_tips"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"70dp"
android:background=
"@drawable/audioim_toast_view_background"
android:drawableLeft=
"@drawable/av_audio_wifi_better"
android:elevation=
"6dp"
android:paddingLeft=
"11dp"
android:paddingTop=
"4dp"
android:paddingRight=
"11dp"
android:paddingBottom=
"4dp"
android:textColor=
"@color/white"
android:visibility=
"gone"
tools:text=
"对方的网络状况不佳"
tools:visibility=
"visible"
/>
</RelativeLayout>
</RelativeLayout>
m-audioim/src/main/res/layout/audioim_cativity_consultant_audio_home.xml
View file @
42ec19d1
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"26sp"
android:textSize=
"26sp"
tools:text=
"用户"
/>
tools:text=
"用户"
/>
<TextView
<TextView
android:id=
"@+id/tv_tips"
android:id=
"@+id/tv_tips"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -59,9 +60,9 @@
...
@@ -59,9 +60,9 @@
android:ellipsize=
"end"
android:ellipsize=
"end"
android:gravity=
"center"
android:gravity=
"center"
android:maxLines=
"2"
android:maxLines=
"2"
android:text=
"向您发起语音通话请求"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"15sp"
android:textSize=
"15sp"
/>
android:text=
"向您发起语音通话请求"
/>
<!--自定义弹窗-->
<!--自定义弹窗-->
...
@@ -83,6 +84,26 @@
...
@@ -83,6 +84,26 @@
tools:text=
"连接中..."
tools:text=
"连接中..."
tools:visibility=
"visible"
/>
tools:visibility=
"visible"
/>
<TextView
android:id=
"@+id/tv_nte_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_tips"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"70dp"
android:background=
"@drawable/audioim_toast_view_background"
android:drawableLeft=
"@drawable/av_audio_wifi_better"
android:elevation=
"6dp"
android:paddingLeft=
"11dp"
android:paddingTop=
"4dp"
android:paddingRight=
"11dp"
android:paddingBottom=
"4dp"
android:textColor=
"@color/white"
android:visibility=
"gone"
tools:text=
"对方的网络状况不佳"
tools:visibility=
"visible"
/>
<!-- 倾诉剩余时间-->
<!-- 倾诉剩余时间-->
<RelativeLayout
<RelativeLayout
android:id=
"@+id/rl_remain_time"
android:id=
"@+id/rl_remain_time"
...
...
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
View file @
42ec19d1
This diff is collapsed.
Click to expand it.
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
View file @
42ec19d1
...
@@ -361,9 +361,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
...
@@ -361,9 +361,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
v_loading
.
visibility
=
View
.
VISIBLE
v_loading
.
visibility
=
View
.
VISIBLE
v_loading
.
setViewType
(
LogoLoadingView
.
TYPE_LOADING
,
null
)
v_loading
.
setViewType
(
LogoLoadingView
.
TYPE_LOADING
,
null
)
if
(
fromPageType
!=
-
1
)
{
doctorAdapter
.
setEntrance
(
0
)
doctorAdapter
.
setEntrance
(
fromPages
[
fromPageType
],
0
)
}
}
}
/**
/**
...
...
m-consultant/src/main/java/com/yidianling/consultant/adapter/ExpertSearchAdapter.kt
View file @
42ec19d1
...
@@ -59,11 +59,9 @@ class ExpertSearchAdapter(
...
@@ -59,11 +59,9 @@ class ExpertSearchAdapter(
var
hasMore
=
true
var
hasMore
=
true
var
entranceName
:
String
?
=
null
var
pageIndex
:
Int
=
0
var
pageIndex
:
Int
=
0
fun
setEntrance
(
entranceName
:
String
,
pageIndex
:
Int
)
{
fun
setEntrance
(
pageIndex
:
Int
)
{
this
.
entranceName
=
entranceName
this
.
pageIndex
=
pageIndex
this
.
pageIndex
=
pageIndex
}
}
...
@@ -465,14 +463,6 @@ class ExpertSearchAdapter(
...
@@ -465,14 +463,6 @@ class ExpertSearchAdapter(
}
else
{
}
else
{
ToastHelper
.
show
(
"请联系客服,专家参数错误!"
)
ToastHelper
.
show
(
"请联系客服,专家参数错误!"
)
}
}
if
(!
TextUtils
.
isEmpty
(
entranceName
))
{
LogUtil
.
d
(
"entrance name: $entranceName"
)
BuryPointUtils
.
getInstance
().
createMap
()
.
put
(
"expert_entrance"
,
entranceName
?:
""
)
.
put
(
"expert_ID"
,
doctor
.
doctorId
?:
0
)
.
put
(
"expert_name"
,
doctor
.
name
?:
""
)
.
burryPoint
(
"Chat_click"
)
}
}
}
}
}
}
}
...
...
m-im/src/main/java/com/yidianling/im/helper/ImObserversHelper.kt
View file @
42ec19d1
...
@@ -12,10 +12,13 @@ import com.netease.nimlib.sdk.msg.MsgServiceObserve
...
@@ -12,10 +12,13 @@ import com.netease.nimlib.sdk.msg.MsgServiceObserve
import
com.netease.nimlib.sdk.msg.constant.AttachStatusEnum
import
com.netease.nimlib.sdk.msg.constant.AttachStatusEnum
import
com.netease.nimlib.sdk.msg.constant.MsgDirectionEnum
import
com.netease.nimlib.sdk.msg.constant.MsgDirectionEnum
import
com.netease.nimlib.sdk.msg.constant.MsgTypeEnum
import
com.netease.nimlib.sdk.msg.constant.MsgTypeEnum
import
com.netease.nimlib.sdk.msg.model.CustomNotification
import
com.netease.nimlib.sdk.msg.model.IMMessage
import
com.netease.nimlib.sdk.msg.model.IMMessage
import
com.netease.nimlib.sdk.msg.model.RevokeMsgNotification
import
com.netease.nimlib.sdk.msg.model.RevokeMsgNotification
import
com.netease.nimlib.sdk.team.TeamServiceObserver
import
com.netease.nimlib.sdk.team.TeamServiceObserver
import
com.netease.nimlib.sdk.team.model.Team
import
com.netease.nimlib.sdk.team.model.Team
import
com.ydl.ydlcommon.utils.LogUtil
import
com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import
com.yidianling.im.api.event.AccountChangeEvent
import
com.yidianling.im.api.event.AccountChangeEvent
import
com.yidianling.im.event.MsgPushEvent
import
com.yidianling.im.event.MsgPushEvent
import
com.yidianling.im.event.TeamRemoveEvent
import
com.yidianling.im.event.TeamRemoveEvent
...
@@ -38,6 +41,10 @@ import java.util.concurrent.Executors
...
@@ -38,6 +41,10 @@ import java.util.concurrent.Executors
* Des:
* Des:
*/
*/
class
ImObserversHelper
{
class
ImObserversHelper
{
var
imCustomNotificationCallBack
:
IMRegisterObserverCustomNotificationCallBack
?
=
null
set
(
value
)
{
field
=
value
}
companion
object
{
companion
object
{
fun
getInstance
():
ImObserversHelper
{
fun
getInstance
():
ImObserversHelper
{
...
@@ -45,23 +52,22 @@ class ImObserversHelper {
...
@@ -45,23 +52,22 @@ class ImObserversHelper {
}
}
}
}
private
object
Holder
{
private
object
Holder
{
val
INSTANCE
=
ImObserversHelper
()
val
INSTANCE
=
ImObserversHelper
()
}
}
fun
registerObserver
(
register
:
Boolean
)
{
fun
registerObserver
(
register
:
Boolean
)
{
//注册`在线状态变化`观察者
//注册`在线状态变化`观察者
NIMClient
.
getService
(
AuthServiceObserver
::
class
.
java
)
NIMClient
.
getService
(
AuthServiceObserver
::
class
.
java
).
observeOnlineStatus
(
userStatusObserver
,
register
)
.
observeOnlineStatus
(
userStatusObserver
,
register
)
//注册`消息撤回`观察者
//注册`消息撤回`观察者
NIMClient
.
getService
(
MsgServiceObserve
::
class
.
java
)
NIMClient
.
getService
(
MsgServiceObserve
::
class
.
java
).
observeRevokeMessage
(
messageRevokeObserver
,
register
)
.
observeRevokeMessage
(
messageRevokeObserver
,
register
)
//注册`消息接收`观察者
//注册`消息接收`观察者
NIMClient
.
getService
(
MsgServiceObserve
::
class
.
java
)
NIMClient
.
getService
(
MsgServiceObserve
::
class
.
java
).
observeReceiveMessage
(
incomingMessageObserver
,
register
)
.
observeReceiveMessage
(
incomingMessageObserver
,
register
)
//注册`移出群`观察者通知
//注册`移出群`观察者通知
NIMClient
.
getService
(
TeamServiceObserver
::
class
.
java
)
NIMClient
.
getService
(
TeamServiceObserver
::
class
.
java
)
.
observeTeamRemove
(
teamObserver
,
register
)
.
observeTeamRemove
(
team
Observer
,
register
)
NIMClient
.
getService
(
MsgServiceObserve
::
class
.
java
).
observeCustomNotification
(
receiveSystemMessage
Observer
,
register
)
//注册`未读消息改变数量`观察者
//注册`未读消息改变数量`观察者
registerMsgUnreadInfoObserver
(
register
)
registerMsgUnreadInfoObserver
(
register
)
if
(
register
)
{
if
(
register
)
{
...
@@ -76,15 +82,13 @@ class ImObserversHelper {
...
@@ -76,15 +82,13 @@ class ImObserversHelper {
if
(
register
)
{
if
(
register
)
{
ReminderManager
.
getInstance
().
registerUnreadNumChangedCallback
(
unreadNumChangedCallback
)
ReminderManager
.
getInstance
().
registerUnreadNumChangedCallback
(
unreadNumChangedCallback
)
}
else
{
}
else
{
ReminderManager
.
getInstance
()
ReminderManager
.
getInstance
().
unregisterUnreadNumChangedCallback
(
unreadNumChangedCallback
)
.
unregisterUnreadNumChangedCallback
(
unreadNumChangedCallback
)
}
}
}
}
private
var
unreadNumChangedCallback
:
ReminderManager
.
UnreadNumChangedCallback
=
private
var
unreadNumChangedCallback
:
ReminderManager
.
UnreadNumChangedCallback
=
ReminderManager
.
UnreadNumChangedCallback
()
{
ReminderManager
.
UnreadNumChangedCallback
()
{
MsgReceiveHelper
.
onMessageReceived
()
MsgReceiveHelper
.
onMessageReceived
()
}
}
private
var
userStatusObserver
:
Observer
<
StatusCode
>
=
Observer
{
code
->
private
var
userStatusObserver
:
Observer
<
StatusCode
>
=
Observer
{
code
->
if
(
code
.
wontAutoLoginForever
())
{
if
(
code
.
wontAutoLoginForever
())
{
...
@@ -95,9 +99,7 @@ class ImObserversHelper {
...
@@ -95,9 +99,7 @@ class ImObserversHelper {
private
var
messageRevokeObserver
:
Observer
<
RevokeMsgNotification
>
=
NimMessageRevokeObserver
()
private
var
messageRevokeObserver
:
Observer
<
RevokeMsgNotification
>
=
NimMessageRevokeObserver
()
private
var
teamObserver
:
Observer
<
Team
>
=
Observer
<
Team
>
{
t
->
private
var
teamObserver
:
Observer
<
Team
>
=
Observer
<
Team
>
{
t
->
EventBus
.
getDefault
().
post
(
EventBus
.
getDefault
().
post
(
TeamRemoveEvent
(
1
,
t
.
id
))
TeamRemoveEvent
(
1
,
t
.
id
)
)
}
}
private
var
incomingMessageObserver
=
Observer
<
List
<
IMMessage
>>
{
messages
->
private
var
incomingMessageObserver
=
Observer
<
List
<
IMMessage
>>
{
messages
->
...
@@ -150,7 +152,7 @@ class ImObserversHelper {
...
@@ -150,7 +152,7 @@ class ImObserversHelper {
event
.
headUrl
=
userInfo
.
avatar
event
.
headUrl
=
userInfo
.
avatar
}
}
// LogUtil.e("发送事件:$event")
// LogUtil.e("发送事件:$event")
EventBus
.
getDefault
().
post
(
event
)
EventBus
.
getDefault
().
post
(
event
)
}
}
}
}
...
@@ -170,12 +172,13 @@ class ImObserversHelper {
...
@@ -170,12 +172,13 @@ class ImObserversHelper {
false
false
}
}
private
var
receiveSystemMessageObserver
:
Observer
<
CustomNotification
>
=
Observer
<
CustomNotification
>
{
LogUtil
.
e
(
it
.
content
)
imCustomNotificationCallBack
?.
onObserverCustomNotification
(
it
.
content
)
}
private
var
msgRevokeFilter
=
MsgRevokeFilter
{
message
->
private
var
msgRevokeFilter
=
MsgRevokeFilter
{
message
->
if
(
message
.
attachment
!=
null
if
(
message
.
attachment
!=
null
&&
message
.
attachment
is
AVChatAttachment
&&
message
.
attachment
is
CustomAttachRedPacket
)
{
&&
message
.
attachment
is
AVChatAttachment
&&
message
.
attachment
is
CustomAttachRedPacket
)
{
// 视频通话消息和白板消息 不允许撤回
// 视频通话消息和白板消息 不允许撤回
return
@MsgRevokeFilter
true
return
@MsgRevokeFilter
true
}
else
if
(
IMCache
.
getAccount
()
!=
null
&&
IMCache
.
getAccount
()
==
message
.
sessionId
)
{
}
else
if
(
IMCache
.
getAccount
()
!=
null
&&
IMCache
.
getAccount
()
==
message
.
sessionId
)
{
...
@@ -188,39 +191,36 @@ class ImObserversHelper {
...
@@ -188,39 +191,36 @@ class ImObserversHelper {
//如果是收款提醒消息 则更新历史收款消息的状态
//如果是收款提醒消息 则更新历史收款消息的状态
fun
flushReceivedMoney
(
m
:
IMMessage
)
{
fun
flushReceivedMoney
(
m
:
IMMessage
)
{
//跟新收款消息
//跟新收款消息
NIMClient
.
getService
(
MsgService
::
class
.
java
)
NIMClient
.
getService
(
MsgService
::
class
.
java
).
queryMessageListByType
(
MsgTypeEnum
.
custom
,
m
,
100
).
setCallback
(
object
:
RequestCallback
<
List
<
IMMessage
>>
{
.
queryMessageListByType
(
MsgTypeEnum
.
custom
,
m
,
100
)
override
fun
onSuccess
(
imMessages
:
List
<
IMMessage
>)
{
.
setCallback
(
object
:
RequestCallback
<
List
<
IMMessage
>>
{
for
(
im
in
imMessages
)
{
override
fun
onSuccess
(
imMessages
:
List
<
IMMessage
>)
{
if
(
im
.
attachment
is
CustomAttachReceivedMoney
)
{
for
(
im
in
imMessages
)
{
val
money
=
im
.
attachment
as
CustomAttachReceivedMoney
if
(
im
.
attachment
is
CustomAttachReceivedMoney
)
{
val
money
=
im
.
attachment
as
CustomAttachReceivedMoney
if
(
money
.
orPay
==
1
)
return
val
status
=
m
.
attachment
as
CustomAttachmentReceivedSuccess
if
(
money
.
orPay
==
1
)
return
if
(
money
.
orderId
==
null
||
status
.
orderid
==
null
)
return
val
status
=
m
.
attachment
as
CustomAttachmentReceivedSuccess
if
(
money
.
orderId
==
status
.
orderid
)
{
if
(
money
.
orderId
==
null
||
status
.
orderid
==
null
)
return
if
(
money
.
orderId
==
status
.
orderid
)
{
money
.
orPay
=
1
//设置为已支付
im
.
attachment
=
money
money
.
orPay
=
1
//设置为已支付
//更新此消息到sdk
im
.
attachment
=
money
NIMClient
.
getService
(
MsgService
::
class
.
java
).
updateIMMessageStatus
(
im
)
//更新此消息到sdk
//更新私聊界面聊天信息
NIMClient
.
getService
(
MsgService
::
class
.
java
)
MessageListPanelHelper
.
getInstance
().
notifyModifyMessage
(
im
)
.
updateIMMessageStatus
(
im
)
return
//更新私聊界面聊天信息
MessageListPanelHelper
.
getInstance
().
notifyModifyMessage
(
im
)
return
}
}
}
}
}
}
}
}
override
fun
onFailed
(
i
:
Int
)
{
override
fun
onFailed
(
i
:
Int
)
{
// Log.e("hzs","跟新收款消息失败");
// Log.e("hzs","跟新收款消息失败");
}
}
override
fun
onException
(
throwable
:
Throwable
)
{
override
fun
onException
(
throwable
:
Throwable
)
{
// Log.e("hzs","跟新收款消息异常:"+throwable);
// Log.e("hzs","跟新收款消息异常:"+throwable);
}
}
})
})
}
}
}
}
m-im/src/main/java/com/yidianling/im/modular/service/IMServiceImpl.kt
View file @
42ec19d1
...
@@ -11,14 +11,19 @@ import com.netease.nimlib.sdk.auth.LoginInfo
...
@@ -11,14 +11,19 @@ import com.netease.nimlib.sdk.auth.LoginInfo
import
com.netease.nimlib.sdk.msg.MessageBuilder
import
com.netease.nimlib.sdk.msg.MessageBuilder
import
com.netease.nimlib.sdk.msg.MsgService
import
com.netease.nimlib.sdk.msg.MsgService
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
import
com.netease.nimlib.sdk.msg.model.CustomNotification
import
com.netease.nimlib.sdk.msg.model.CustomNotificationConfig
import
com.ydl.ydlcommon.router.YdlCommonOut
import
com.ydl.ydlcommon.router.YdlCommonOut
import
com.ydl.ydlcommon.utils.StringUtils
import
com.ydl.ydlcommon.utils.StringUtils
import
com.yidianling.im.R
import
com.yidianling.im.R
import
com.yidianling.im.api.bean.IMLoginInfo
import
com.yidianling.im.api.bean.IMLoginInfo
import
com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import
com.yidianling.im.api.bean.IMRequestCallback
import
com.yidianling.im.api.bean.IMRequestCallback
import
com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack
import
com.yidianling.im.api.service.IImService
import
com.yidianling.im.api.service.IImService
import
com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import
com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import
com.yidianling.im.helper.IMUtil
import
com.yidianling.im.helper.IMUtil
import
com.yidianling.im.helper.ImObserversHelper
import
com.yidianling.im.helper.MsgReceiveHelper
import
com.yidianling.im.helper.MsgReceiveHelper
import
com.yidianling.im.preference.IMCache
import
com.yidianling.im.preference.IMCache
import
com.yidianling.im.router.ImIn
import
com.yidianling.im.router.ImIn
...
@@ -53,9 +58,7 @@ class IMServiceImpl : IImService {
...
@@ -53,9 +58,7 @@ class IMServiceImpl : IImService {
context
.
startActivity
(
ImIn
.
loginWayIntent
(
context
))
context
.
startActivity
(
ImIn
.
loginWayIntent
(
context
))
return
return
}
}
SessionHelper
.
startP2PSession
(
context
,
-
1
,
"14"
,
null
,
SessionHelper
.
startP2PSession
(
context
,
-
1
,
"14"
,
null
,
P2PCustomActionHandlerImpl
(
"14"
,
"客服小壹"
,
"https://static.ydlcdn.com/mobile/images/avatar_girl_app.png"
))
P2PCustomActionHandlerImpl
(
"14"
,
"客服小壹"
,
"https://static.ydlcdn.com/mobile/images/avatar_girl_app.png"
))
}
}
override
fun
imLogin
(
info
:
IMLoginInfo
)
{
override
fun
imLogin
(
info
:
IMLoginInfo
)
{
...
@@ -109,43 +112,39 @@ class IMServiceImpl : IImService {
...
@@ -109,43 +112,39 @@ class IMServiceImpl : IImService {
override
fun
createTextMessage
(
sessionId
:
String
?,
content
:
String
,
callback
:
IMRequestCallback
<
Void
>)
{
override
fun
createTextMessage
(
sessionId
:
String
?,
content
:
String
,
callback
:
IMRequestCallback
<
Void
>)
{
val
message
=
MessageBuilder
.
createTextMessage
(
sessionId
,
SessionTypeEnum
.
P2P
,
content
)
val
message
=
MessageBuilder
.
createTextMessage
(
sessionId
,
SessionTypeEnum
.
P2P
,
content
)
NIMClient
.
getService
(
MsgService
::
class
.
java
)
NIMClient
.
getService
(
MsgService
::
class
.
java
).
sendMessage
(
message
,
false
).
setCallback
(
object
:
RequestCallback
<
Void
>
{
.
sendMessage
(
message
,
false
)
override
fun
onSuccess
(
param
:
Void
?)
{
.
setCallback
(
object
:
RequestCallback
<
Void
>
{
callback
.
onSuccess
(
param
)
override
fun
onSuccess
(
param
:
Void
?)
{
MessageListPanelHelper
.
getInstance
().
notifyAddMessage
(
message
)
callback
.
onSuccess
(
param
)
}
MessageListPanelHelper
.
getInstance
().
notifyAddMessage
(
message
)
}
override
fun
onException
(
exception
:
Throwable
?)
{
override
fun
onException
(
exception
:
Throwable
?)
{
callback
.
onException
(
exception
)
callback
.
onException
(
exception
)
}
}
override
fun
onFailed
(
code
:
Int
)
{
override
fun
onFailed
(
code
:
Int
)
{
callback
.
onFailed
(
code
)
callback
.
onFailed
(
code
)
}
}
})
})
}
}
override
fun
sendSubscriptionTimeMessage
(
sessionId
:
String
?,
content
:
String
,
callback
:
IMRequestCallback
<
Void
>)
{
override
fun
sendSubscriptionTimeMessage
(
sessionId
:
String
?,
content
:
String
,
callback
:
IMRequestCallback
<
Void
>)
{
val
customTime
=
CustomAttachSubScriptTime
(
content
)
val
customTime
=
CustomAttachSubScriptTime
(
content
)
val
message
=
MessageBuilder
.
createCustomMessage
(
sessionId
,
SessionTypeEnum
.
P2P
,
content
,
customTime
)
val
message
=
MessageBuilder
.
createCustomMessage
(
sessionId
,
SessionTypeEnum
.
P2P
,
content
,
customTime
)
NIMClient
.
getService
(
MsgService
::
class
.
java
)
NIMClient
.
getService
(
MsgService
::
class
.
java
).
sendMessage
(
message
,
false
).
setCallback
(
object
:
RequestCallback
<
Void
>
{
.
sendMessage
(
message
,
false
)
override
fun
onSuccess
(
param
:
Void
?)
{
.
setCallback
(
object
:
RequestCallback
<
Void
>
{
callback
.
onSuccess
(
param
)
override
fun
onSuccess
(
param
:
Void
?)
{
MessageListPanelHelper
.
getInstance
().
notifyAddMessage
(
message
)
callback
.
onSuccess
(
param
)
}
MessageListPanelHelper
.
getInstance
().
notifyAddMessage
(
message
)
}
override
fun
onException
(
exception
:
Throwable
?)
{
override
fun
onException
(
exception
:
Throwable
?)
{
callback
.
onException
(
exception
)
callback
.
onException
(
exception
)
}
}
override
fun
onFailed
(
code
:
Int
)
{
override
fun
onFailed
(
code
:
Int
)
{
callback
.
onFailed
(
code
)
callback
.
onFailed
(
code
)
}
}
})
})
}
}
...
@@ -157,20 +156,13 @@ class IMServiceImpl : IImService {
...
@@ -157,20 +156,13 @@ class IMServiceImpl : IImService {
option
.
crop
=
false
option
.
crop
=
false
option
.
cropOutputImageWidth
=
720
option
.
cropOutputImageWidth
=
720
option
.
cropOutputImageHeight
=
720
option
.
cropOutputImageHeight
=
720
// option.outputPath = StorageUtil.getWritePath(StringUtils.get32UUID() + ".jpg", StorageType.TYPE_TEMP)
// option.outputPath = StorageUtil.getWritePath(StringUtils.get32UUID() + ".jpg", StorageType.TYPE_TEMP)
option
.
outputPath
=
YdlCommonOut
.
getApp
().
externalCacheDir
.
absolutePath
+
"/"
+
StringUtils
.
get32UUID
()
+
".jpg"
option
.
outputPath
=
YdlCommonOut
.
getApp
().
externalCacheDir
.
absolutePath
+
"/"
+
StringUtils
.
get32UUID
()
+
".jpg"
PickImageHelper
.
pickImage
(
activity
,
requestCode
,
option
)
PickImageHelper
.
pickImage
(
activity
,
requestCode
,
option
)
}
}
override
fun
sendTestResultMessage
(
uid
:
String
,
content
:
String
,
title
:
String
?,
head
:
String
?,
url
:
String
?,
id
:
Int
,
share_url
:
String
?,
callback
:
IMRequestCallback
<
Void
>)
{
override
fun
sendTestResultMessage
(
uid
:
String
,
content
:
String
,
title
:
String
?,
head
:
String
?,
url
:
String
?,
id
:
Int
,
share_url
:
String
?,
callback
:
IMRequestCallback
<
Void
>)
{
val
customAttachmentTest
=
CustomAttachmentTest
(
val
customAttachmentTest
=
CustomAttachmentTest
(
CustomAttachmentTest
.
FLAG_RESULT
,
title
,
head
,
url
,
id
,
share_url
)
CustomAttachmentTest
.
FLAG_RESULT
,
title
,
head
,
url
,
id
,
share_url
)
val
message
=
MessageBuilder
.
createCustomMessage
(
uid
,
SessionTypeEnum
.
P2P
,
"测试结果"
,
customAttachmentTest
)
val
message
=
MessageBuilder
.
createCustomMessage
(
uid
,
SessionTypeEnum
.
P2P
,
"测试结果"
,
customAttachmentTest
)
NIMClient
.
getService
(
MsgService
::
class
.
java
).
sendMessage
(
message
,
false
).
setCallback
(
object
:
RequestCallback
<
Void
>
{
NIMClient
.
getService
(
MsgService
::
class
.
java
).
sendMessage
(
message
,
false
).
setCallback
(
object
:
RequestCallback
<
Void
>
{
...
@@ -205,4 +197,36 @@ class IMServiceImpl : IImService {
...
@@ -205,4 +197,36 @@ class IMServiceImpl : IImService {
override
fun
getAllUnReadNum
():
Int
{
override
fun
getAllUnReadNum
():
Int
{
return
MsgReceiveHelper
.
getAllUnNum
()
return
MsgReceiveHelper
.
getAllUnNum
()
}
}
/**
* 发送自定义通知: 不推送、不计入未读消息
*/
override
fun
sendCustomNotification
(
toUid
:
String
,
content
:
String
,
callback
:
IMSendCustomNotificationResultCallBack
)
{
val
config
=
CustomNotificationConfig
()
config
.
enablePush
=
false
config
.
enablePushNick
=
false
config
.
enableUnreadCount
=
false
val
customNotification
=
CustomNotification
()
customNotification
.
sessionType
=
SessionTypeEnum
.
P2P
customNotification
.
sessionId
=
toUid
customNotification
.
config
=
config
customNotification
.
content
=
content
NIMClient
.
getService
(
MsgService
::
class
.
java
).
sendCustomNotification
(
customNotification
).
setCallback
(
object
:
RequestCallback
<
Void
?>
{
override
fun
onSuccess
(
param
:
Void
?)
{
callback
.
onSuccess
()
}
override
fun
onFailed
(
code
:
Int
)
{
callback
.
onFailed
(
code
)
}
override
fun
onException
(
exception
:
Throwable
)
{
callback
.
onException
(
exception
)
}
})
}
override
fun
registerObserveCustomNotification
(
callback
:
IMRegisterObserverCustomNotificationCallBack
)
{
ImObserversHelper
.
getInstance
().
imCustomNotificationCallBack
=
callback
}
}
}
\ No newline at end of file
m-im/src/main/modular_api/com/yidianling/im/api/bean/IMRegisterObserverCustomNotificationCallBack.kt
0 → 100644
View file @
42ec19d1
package
com.yidianling.im.api.bean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/4/21
*/
interface
IMRegisterObserverCustomNotificationCallBack
{
fun
onObserverCustomNotification
(
content
:
String
)
}
\ No newline at end of file
m-im/src/main/modular_api/com/yidianling/im/api/bean/IMSendCustomNotificationResultCallBack.kt
0 → 100644
View file @
42ec19d1
package
com.yidianling.im.api.bean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/4/21
*/
interface
IMSendCustomNotificationResultCallBack
{
fun
onSuccess
()
fun
onFailed
(
code
:
Int
)
fun
onException
(
throwable
:
Throwable
)
}
\ No newline at end of file
m-im/src/main/modular_api/com/yidianling/im/api/service/IImService.kt
View file @
42ec19d1
...
@@ -4,7 +4,9 @@ import android.app.Activity
...
@@ -4,7 +4,9 @@ import android.app.Activity
import
android.content.Context
import
android.content.Context
import
com.alibaba.android.arouter.facade.template.IProvider
import
com.alibaba.android.arouter.facade.template.IProvider
import
com.yidianling.im.api.bean.IMLoginInfo
import
com.yidianling.im.api.bean.IMLoginInfo
import
com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import
com.yidianling.im.api.bean.IMRequestCallback
import
com.yidianling.im.api.bean.IMRequestCallback
import
com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack
/**
/**
* author : Zhangwenchao
* author : Zhangwenchao
...
@@ -25,7 +27,7 @@ interface IImService : IProvider {
...
@@ -25,7 +27,7 @@ interface IImService : IProvider {
fun
setChattingAccountNone
()
fun
setChattingAccountNone
()
fun
isHasUnread
():
Boolean
fun
isHasUnread
():
Boolean
fun
login
(
info
:
IMLoginInfo
,
callback
:
IMRequestCallback
<
IMLoginInfo
>?)
fun
login
(
info
:
IMLoginInfo
,
callback
:
IMRequestCallback
<
IMLoginInfo
>?)
...
@@ -50,7 +52,7 @@ interface IImService : IProvider {
...
@@ -50,7 +52,7 @@ interface IImService : IProvider {
fun
sendTestResultMessage
(
uid
:
String
,
content
:
String
,
title
:
String
?,
head
:
String
?,
url
:
String
?,
id
:
Int
,
share_url
:
String
?,
callback
:
IMRequestCallback
<
Void
>)
fun
sendTestResultMessage
(
uid
:
String
,
content
:
String
,
title
:
String
?,
head
:
String
?,
url
:
String
?,
id
:
Int
,
share_url
:
String
?,
callback
:
IMRequestCallback
<
Void
>)
fun
startChat
(
context
:
Activity
,
toUid
:
String
,
flag
:
Int
,
canTalk
:
Int
)
fun
startChat
(
context
:
Activity
,
toUid
:
String
,
flag
:
Int
,
canTalk
:
Int
)
/**
/**
* 根据对方uid获取未读数
* 根据对方uid获取未读数
...
@@ -62,4 +64,15 @@ interface IImService : IProvider {
...
@@ -62,4 +64,15 @@ interface IImService : IProvider {
* 获取自己的所有未读数
* 获取自己的所有未读数
*/
*/
fun
getAllUnReadNum
():
Int
fun
getAllUnReadNum
():
Int
/**
* 发送自定义通知
*/
fun
sendCustomNotification
(
toUid
:
String
,
content
:
String
,
callback
:
IMSendCustomNotificationResultCallBack
)
/**
* 注册自定通知接收器
*/
fun
registerObserveCustomNotification
(
callback
:
IMRegisterObserverCustomNotificationCallBack
)
}
}
\ No newline at end of file
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