Commit 3b6b36d7 by ydl

Merge branch '声网通话流程优化' of…

Merge branch '声网通话流程优化' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into 声网通话流程优化
parents 134cdc1c 6e4790e1
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = true dev_mode = false
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.23", "m-confide" : "0.0.48.43",
"m-consultant" : "0.0.59.10", "m-consultant" : "0.0.59.10",
"m-fm" : "0.0.29.9", "m-fm" : "0.0.29.9",
"m-user" : "0.0.60.8", "m-user" : "0.0.60.8",
"m-home" : "0.0.22.3", "m-home" : "0.0.22.3",
"m-im" : "0.0.18.4", "m-im" : "0.0.18.5",
"m-dynamic" : "0.0.7.7", "m-dynamic" : "0.0.7.7",
"m-article" : "0.0.0.5", "m-article" : "0.0.0.5",
...@@ -28,7 +28,7 @@ ext { ...@@ -28,7 +28,7 @@ ext {
"m-tests-api" : "0.0.2", "m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.15", "m-user-api" : "0.0.10.15",
"m-home-api" : "0.0.4.1", "m-home-api" : "0.0.4.1",
"m-im-api" : "0.0.12.19", "m-im-api" : "0.0.12.20",
"m-dynamic-api" : "0.0.3.7", "m-dynamic-api" : "0.0.3.7",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
...@@ -39,7 +39,7 @@ ext { ...@@ -39,7 +39,7 @@ ext {
"ydl-webview" : "0.0.38.31", "ydl-webview" : "0.0.38.31",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.9", "ydl-pay" : "0.0.18.9",
"m-audioim" : "0.0.49.2", "m-audioim" : "0.0.49.16",
"ydl-flutter-base": "0.0.14.14", "ydl-flutter-base": "0.0.14.14",
//以下 几乎不会动 //以下 几乎不会动
...@@ -111,7 +111,7 @@ ext { ...@@ -111,7 +111,7 @@ ext {
"m-tests-api" : "0.0.2", "m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.15", "m-user-api" : "0.0.10.15",
"m-home-api" : "0.0.4.1", "m-home-api" : "0.0.4.1",
"m-im-api" : "0.0.12.18", "m-im-api" : "0.0.12.20",
"m-dynamic-api" : "0.0.3.7", "m-dynamic-api" : "0.0.3.7",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
...@@ -122,7 +122,7 @@ ext { ...@@ -122,7 +122,7 @@ ext {
"ydl-webview" : "0.0.38.31", "ydl-webview" : "0.0.38.31",
"ydl-media" : "0.0.21.6", "ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.9", "ydl-pay" : "0.0.18.9",
"m-audioim" : "0.0.49.2", "m-audioim" : "0.0.49.16",
"ydl-flutter-base": "0.0.14.14", "ydl-flutter-base": "0.0.14.14",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -84,10 +84,14 @@ dependencies { ...@@ -84,10 +84,14 @@ dependencies {
api project(':ydl-platform') api project(':ydl-platform')
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-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-im-api"]
api(rootProject.ext.dependencies["ydl-platform"]) { api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true transitive = true
} }
......
...@@ -21,4 +21,5 @@ public interface IntentConstants { ...@@ -21,4 +21,5 @@ public interface IntentConstants {
String INTENT_TOTAL_DURATION= "intent_total_duration"; String INTENT_TOTAL_DURATION= "intent_total_duration";
String INTENT_LISTEN_ID= "intent_listen_id"; String INTENT_LISTEN_ID= "intent_listen_id";
String INTENT_COMMENT_URL= "intent_comment_url"; String INTENT_COMMENT_URL= "intent_comment_url";
String INTENT_ISSHOWAXB= "intent_isshowaxb";
} }
package com.ydl.audioim.bean;
/**
* @author jiucheng
* @描述:自定义的Invitation
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/4/23
*/
public class AgoraInvitationBean {
public String data;
public String business="agora";
public String callType;//1发起呼叫 2接受呼叫 3取消呼叫 4拒绝呼叫邀请 5呼叫超时
}
...@@ -3,7 +3,9 @@ package com.ydl.audioim.http ...@@ -3,7 +3,9 @@ package com.ydl.audioim.http
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraTokenResponse import com.ydl.audioim.bean.AgoraTokenResponse
import com.ydl.audioim.bean.ConnectBean import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.http.command.* import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.consultantim.bean.ListenTokenBean import com.ydl.consultantim.bean.ListenTokenBean
import com.ydl.consultantim.command.ListenTokenCmd import com.ydl.consultantim.command.ListenTokenCmd
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
...@@ -29,8 +31,7 @@ class AudioApiRequestUtil { ...@@ -29,8 +31,7 @@ class AudioApiRequestUtil {
*/ */
fun connectListen(cmd: ConnectCommand): Observable<BaseAPIResponse<ConnectBean>> { fun connectListen(cmd: ConnectCommand): Observable<BaseAPIResponse<ConnectBean>> {
return RxUtils.mapObservable(cmd) return RxUtils.mapObservable(cmd)
.flatMap { .flatMap { it ->
it->
YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectListen(it) YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectListen(it)
} }
} }
...@@ -85,15 +86,19 @@ class AudioApiRequestUtil { ...@@ -85,15 +86,19 @@ class AudioApiRequestUtil {
/** /**
* 获取声网登录token * 获取声网登录token
*/ */
fun getAgoraToken(): Observable<BaseAPIResponse<AgoraTokenResponse>>{ fun getAgoraToken(): Observable<BaseAPIResponse<AgoraTokenResponse>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).getAgoraToken() return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).getAgoraToken()
} }
/** /**
* 获取声网登录token * 获取声网登录token
*/ */
fun listenToken(cmd: ListenTokenCmd): Observable<BaseResponse<ListenTokenBean>>{ fun listenToken(cmd: ListenTokenCmd): Observable<BaseResponse<ListenTokenBean>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).listenToken(NetworkParamsUtils.getMaps(cmd)) return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).listenToken(NetworkParamsUtils.getMaps(cmd))
} }
fun callEndStatusUpdate(channelId: String, endStatus: Int, msg: String): Observable<BaseResponse<Any>> {
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).callEndStatusUpdate(channelId, endStatus, msg)
}
} }
} }
\ No newline at end of file
...@@ -69,4 +69,7 @@ interface AudioNetAPi { ...@@ -69,4 +69,7 @@ interface AudioNetAPi {
fun listenToken(@FieldMap map: Map<String, String>): Observable<BaseResponse<ListenTokenBean>> fun listenToken(@FieldMap map: Map<String, String>): Observable<BaseResponse<ListenTokenBean>>
@GET("message/call-end/agora")
fun callEndStatusUpdate(channelId:String,endStatus:Int,msg:String): Observable<BaseResponse<Any>>
} }
\ No newline at end of file
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
...@@ -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="74dp"> android:layout_marginTop="60dp">
<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="你存在的本身就是值得被爱的你存在的本身就是值得被爱的" />
<!-- 倾诉剩余时间--> <!-- 倾诉剩余时间-->
<RelativeLayout <android.support.constraint.ConstraintLayout
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>
...@@ -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"
......
...@@ -6,34 +6,35 @@ import com.ydl.audioim.bean.ExpertInfoBean ...@@ -6,34 +6,35 @@ import com.ydl.audioim.bean.ExpertInfoBean
/** /**
* 倾诉连接响应数据 * 倾诉连接响应数据
*/ */
class ConfideConnectResponse{ class ConfideConnectResponse {
var dialDetail : DialDetail? = null var dialDetail: DialDetail? = null
var listenOrderId : Long? = 0 //订单ID var listenOrderId: Long? = 0 //订单ID
var callId : String? = null // var callId: String? = null //
var payId : String?=null //支付ID var payId: String? = null //支付ID
var payTitle : String? = null //支付标题 var payTitle: String? = null //支付标题
var listenOrderPrice : Double? = null //订单金额 var listenOrderPrice: Double? = null //订单金额
var userBaseInfoRespDto : UserBaseInfoRespDto?=null var userBaseInfoRespDto: UserBaseInfoRespDto? = null
var coupon : CouponData? = null //优惠信息 var coupon: CouponData? = null //优惠信息
var isShowAxb = true
} }
class DialDetail{ class DialDetail {
var agoraExpertInfo: ExpertInfoBean? = null var agoraExpertInfo: ExpertInfoBean? = null
var callConnectType :Int ? = null var callConnectType: Int? = null
var dialReason : String? = null //连接失败原因 var dialReason: String? = null //连接失败原因
var dialStatus : Int? = null //连接状态 var dialStatus: Int? = null //连接状态
var phoneNu : String ?= null //axb号码 var phoneNu: String? = null //axb号码
} }
class UserBaseInfoRespDto{ class UserBaseInfoRespDto {
var availableMoney : Double ? = null var availableMoney: Double? = null
var companyMoney : Double ? = null var companyMoney: Double? = null
var doctorId : Long ? = null var doctorId: Long? = null
var phone : Long ? = null var phone: Long? = null
var userType : String?=null var userType: String? = null
} }
class CouponData{ class CouponData {
var couponMoney:Double? = 0.00 var couponMoney: Double? = 0.00
} }
\ No newline at end of file
...@@ -84,7 +84,7 @@ class ConfideWebServiceImpl{ ...@@ -84,7 +84,7 @@ class ConfideWebServiceImpl{
if (it.data?.dialDetail?.callConnectType?:-1==3){ if (it.data?.dialDetail?.callConnectType?:-1==3){
//声网 //声网
it.data?.dialDetail?.agoraExpertInfo?:return@subscribe it.data?.dialDetail?.agoraExpertInfo?:return@subscribe
callAgora(activity,id,it.data!!.dialDetail!!.agoraExpertInfo!!,it.data.callId?:"0",it.data.listenOrderId?:0L,tellData) callAgora(activity,id,it.data!!.dialDetail!!.agoraExpertInfo!!,it.data.callId?:"0",it.data.listenOrderId?:0L,tellData,it.data.isShowAxb)
}else{ }else{
//axb //axb
val dialog = AxbConfirmDialog(activity,1,object :AxbConfirmDialog.OnClickEnsureListener{ val dialog = AxbConfirmDialog(activity,1,object :AxbConfirmDialog.OnClickEnsureListener{
...@@ -114,7 +114,7 @@ class ConfideWebServiceImpl{ ...@@ -114,7 +114,7 @@ class ConfideWebServiceImpl{
} }
//启动声网电话 //启动声网电话
private fun callAgora(activity: Activity, confideId:Int, expertInfo : ExpertInfoBean, call_id:String, relation_id:Long, tellData: TellData?){ private fun callAgora(activity: Activity, confideId:Int, expertInfo : ExpertInfoBean, call_id:String, relation_id:Long, tellData: TellData?,isShowAXB:Boolean){
//3G以下或者其他不确定异常能判断出来的 //3G以下或者其他不确定异常能判断出来的
if (!ConfideNetworkUtil.isWifiOr3G(activity)) { if (!ConfideNetworkUtil.isWifiOr3G(activity)) {
CommonDialog.create(activity) CommonDialog.create(activity)
...@@ -156,6 +156,7 @@ class ConfideWebServiceImpl{ ...@@ -156,6 +156,7 @@ class ConfideWebServiceImpl{
.withString(IntentConstants.INTENT_TOTAL_DURATION, expertInfo.totalDuration) .withString(IntentConstants.INTENT_TOTAL_DURATION, expertInfo.totalDuration)
.withString(IntentConstants.INTENT_COMMENT_URL, expertInfo.commentUrl) .withString(IntentConstants.INTENT_COMMENT_URL, expertInfo.commentUrl)
.withString(IntentConstants.INTENT_LISTEN_ID, confideId.toString()) .withString(IntentConstants.INTENT_LISTEN_ID, confideId.toString())
.withBoolean(IntentConstants.INTENT_ISSHOWAXB,isShowAXB)
.navigation(activity) .navigation(activity)
} }
} }
......
...@@ -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)
}
} }
/** /**
......
...@@ -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
} }
...@@ -466,14 +464,6 @@ class ExpertSearchAdapter( ...@@ -466,14 +464,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")
}
} }
} }
} }
......
...@@ -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.api.event.MsgPushEvent import com.yidianling.im.api.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(teamObserver, register) NIMClient.getService(MsgServiceObserve::class.java).observeCustomNotification(receiveSystemMessageObserver, 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.fromAccount, it.sessionId, 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);
} }
}) })
} }
} }
...@@ -14,6 +14,8 @@ import com.netease.nimlib.sdk.auth.LoginInfo ...@@ -14,6 +14,8 @@ 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.ydl.ydlcommon.utils.remind.HttpErrorUtils import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
...@@ -22,13 +24,16 @@ import com.yidianling.common.tools.ToastUtil ...@@ -22,13 +24,16 @@ import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R import com.yidianling.im.R
import com.yidianling.im.api.bean.IMInitConfigBean import com.yidianling.im.api.bean.IMInitConfigBean
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.listener.ApiStringResponseCallback import com.yidianling.im.api.listener.ApiStringResponseCallback
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.config.NimApplication import com.yidianling.im.config.NimApplication
import com.yidianling.im.helper.IMChatUtil import com.yidianling.im.helper.IMChatUtil
import com.yidianling.im.helper.LogoutHelper import com.yidianling.im.helper.LogoutHelper
import com.yidianling.im.helper.ImObserversHelper
import com.yidianling.im.helper.MsgReceiveHelper import com.yidianling.im.helper.MsgReceiveHelper
import com.yidianling.im.http.ImRetrofitApi import com.yidianling.im.http.ImRetrofitApi
import com.yidianling.im.preference.IMCache import com.yidianling.im.preference.IMCache
...@@ -68,9 +73,7 @@ class IMServiceImpl : IImService { ...@@ -68,9 +73,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) {
...@@ -124,43 +127,39 @@ class IMServiceImpl : IImService { ...@@ -124,43 +127,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)
} }
}) })
} }
...@@ -172,20 +171,13 @@ class IMServiceImpl : IImService { ...@@ -172,20 +171,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> {
...@@ -226,6 +218,38 @@ class IMServiceImpl : IImService { ...@@ -226,6 +218,38 @@ class IMServiceImpl : IImService {
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
}
override fun getMultiMessageFragment(): Fragment { override fun getMultiMessageFragment(): Fragment {
return NewMultiMessageFragment() return NewMultiMessageFragment()
} }
......
package com.yidianling.im.api.bean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/4/21
*/
interface IMRegisterObserverCustomNotificationCallBack {
fun onObserverCustomNotification(fromUid:String,toUid:String,content: String)
}
\ No newline at end of file
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
...@@ -7,7 +7,9 @@ import android.support.v4.app.Fragment ...@@ -7,7 +7,9 @@ import android.support.v4.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider import com.alibaba.android.arouter.facade.template.IProvider
import com.yidianling.im.api.bean.IMInitConfigBean import com.yidianling.im.api.bean.IMInitConfigBean
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.listener.ApiStringResponseCallback import com.yidianling.im.api.listener.ApiStringResponseCallback
/** /**
...@@ -29,7 +31,7 @@ interface IImService : IProvider { ...@@ -29,7 +31,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>?)
...@@ -54,7 +56,7 @@ interface IImService : IProvider { ...@@ -54,7 +56,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)
fun startChat(context : Activity ,toUid : String ,flag : Int , canTalk : Int, isFramQingsu: Int, isFromMessageList: Boolean) fun startChat(context : Activity ,toUid : String ,flag : Int , canTalk : Int, isFramQingsu: Int, isFromMessageList: Boolean)
...@@ -69,6 +71,17 @@ interface IImService : IProvider { ...@@ -69,6 +71,17 @@ interface IImService : IProvider {
*/ */
fun getAllUnReadNum(): Int fun getAllUnReadNum(): Int
/**
* 发送自定义通知
*/
fun sendCustomNotification(toUid: String, content: String, callback: IMSendCustomNotificationResultCallBack)
/**
* 注册自定通知接收器
*/
fun registerObserveCustomNotification(callback: IMRegisterObserverCustomNotificationCallBack)
fun getMultiMessageFragment(): Fragment fun getMultiMessageFragment(): Fragment
// 跳转下一个未读数 // 跳转下一个未读数
......
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