Commit 923450d3 by 万齐军

ConfideWebServiceImpl重构

parent f65fca61
......@@ -11,13 +11,14 @@ import com.ydl.audioim.IntentConstants
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.bean.ExpertInfoBean
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.home.bean.ConfideConnectResponse
import com.ydl.confide.home.bean.ConnectParamJava
import com.ydl.confide.home.constants.FinalString
import com.ydl.confide.home.http.ConfideHomeDataManager
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.TellData
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.ui.Loading
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
......@@ -37,7 +38,7 @@ import io.reactivex.schedulers.Schedulers
class ConfideWebServiceImpl {
//倾诉支付弹窗
fun confidePayDialog(
private fun confidePayDialog(
id: Int?,
type: Int?,
activity: Activity,
......@@ -64,6 +65,80 @@ class ConfideWebServiceImpl {
.show(confidePay)
}
private fun needPay(
id: Int,
type: Int,
activity: Activity,
callType: String?,
data: ConfideConnectResponse?
) {
//支付弹窗
//参数转换
val confidePay = ConfidePayParams(
data?.payTitle ?: "倾诉服务",
data?.listenOrderPrice,
data?.coupon?.couponMoney ?: 0.00,
data?.userBaseInfoRespDto?.availableMoney ?: 0.00,
data?.payId ?: "",
"",
""
)
confidePayDialog(id, type, activity, confidePay, callType)
}
private fun needBindPhone(activity: Activity) {
CommonDialog(activity)
.setCancelAble(false)
.setMessage(FinalString.TEL_BINDPHONE)
.setLeftOnclick("忍痛放弃", null)
.setRightClick("果断绑定") {
findRouteService(IUserService::class.java).wxBindToInputhonePage(activity)
}
.show()
}
private fun agora(
id: Int,
type: Int,
activity: Context,
callType: String?,
tellData: TellData?,
data: ConfideConnectResponse?){
val expertInfo = data?.dialDetail?.agoraExpertInfo ?: return
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return
}
callAgora(
activity,
id,
expertInfo,
data.callId ?: "0",
data.listenOrderId ?: 0L,
tellData,
data.isShowAxb,
data.dialDetail?.dialStatus.toString()
)
}
private fun axb(activity: Activity,phone:String?){
if(phone.isNullOrEmpty())return
val dialog = AxbConfirmDialog(
activity,
1,
object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:${phone}"))
activity.startActivity(phoneIntent)
}
override fun onClose() {
}
})
dialog.show()
}
//java版axb和声网接口
@SuppressLint("CheckResult")
fun connectionJava(
......@@ -79,77 +154,23 @@ class ConfideWebServiceImpl {
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if ("200" == it.code) {
if (it.data?.dialDetail?.dialStatus != null) {
if (100007 == it.data?.dialDetail?.dialStatus) {
//支付弹窗
//参数转换
var confidePay = ConfidePayParams(
it.data?.payTitle ?: "倾诉服务",
it.data?.listenOrderPrice,
it.data?.coupon?.couponMoney ?: 0.00,
it.data?.userBaseInfoRespDto?.availableMoney ?: 0.00,
it.data?.payId ?: "",
"",
""
)
confidePayDialog(id, type, activity, confidePay, callType)
} else if (100008 == it.data?.dialDetail?.dialStatus) {
CommonDialog(activity)
.setCancelAble(false)
.setMessage(FinalString.TEL_BINDPHONE)
.setLeftOnclick("忍痛放弃", null)
.setRightClick("果断绑定") { view ->
try {
ModularServiceManager.provide(IUserService::class.java)
.wxBindToInputhonePage(activity)
} catch (e: Exception) {
}
}
.show()
} else if (0 == it.data?.dialDetail?.dialStatus) {
//连接成功
if (it.data?.dialDetail?.callConnectType ?: -1 == 3) {
//声网
it.data?.dialDetail?.agoraExpertInfo ?: return@subscribe
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return@subscribe
}
callAgora(
activity,
id,
it.data!!.dialDetail!!.agoraExpertInfo!!,
it.data.callId ?: "0",
it.data.listenOrderId ?: 0L,
tellData,
it.data.isShowAxb,
it.data?.dialDetail?.dialStatus.toString()
)
when (it.data?.dialDetail?.dialStatus) {
0 -> {//连接成功
if (it.data?.dialDetail?.callConnectType == 3) {
agora(id, type, activity, callType, tellData, it.data)
} else {
//axb
val dialog = AxbConfirmDialog(
activity,
1,
object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
var phoneIntent = Intent(
Intent.ACTION_DIAL,
Uri.parse("tel:${it.data?.dialDetail?.phoneNu ?: 0}")
)
activity.startActivity(phoneIntent)
}
override fun onClose() {
}
})
dialog.show()
axb(activity, it.data?.dialDetail?.phoneNu)
}
} else {
}
100007 -> {
needPay(id, type, activity, callType, it.data)
}
100008 -> {
needBindPhone(activity)
}
else -> {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.msg)
......@@ -173,46 +194,24 @@ class ConfideWebServiceImpl {
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Loading.close()
if ("200" == it.code) {
if (it.data?.dialDetail?.dialStatus != null) {
if (100007 == it.data?.dialDetail?.dialStatus) {
//支付弹窗
when (it.data?.dialDetail?.dialStatus) {
0 -> {//连接成功
if (it.data?.dialDetail?.callConnectType == 3) {
agora(id, type, activity, callType, null, it.data)
}
}
100007 -> {
otherwise?.invoke()
} else if (100008 == it.data?.dialDetail?.dialStatus) {
CommonDialog(activity)
.setCancelAble(false)
.setMessage(FinalString.TEL_BINDPHONE)
.setLeftOnclick("忍痛放弃", null)
.setRightClick("果断绑定") { view ->
try {
ModularServiceManager.provide(IUserService::class.java)
.wxBindToInputhonePage(activity as Activity)
} catch (e: Exception) {
}
}
.show()
} else if (0 == it.data?.dialDetail?.dialStatus && it.data?.dialDetail?.callConnectType == 3) {
it.data?.dialDetail?.agoraExpertInfo ?: return@subscribe
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return@subscribe
}
100008 -> {
if (activity is Activity) {
needBindPhone(activity)
}
callAgora(
activity,
id,
it.data!!.dialDetail!!.agoraExpertInfo!!,
it.data.callId ?: "0",
it.data.listenOrderId ?: 0L,
null,
it.data.isShowAxb,
it.data?.dialDetail?.dialStatus.toString()
)
} else {
}
else -> {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.msg)
......
......@@ -3,7 +3,8 @@ apply plugin: 'maven'
def mavenRepositoryUrl = "http://nexus.yidianling.com/repository/AndroidReleases/"
def getVersionName() {
return rootProject.ext.ydl2PublishVersion
def publishVersion = rootProject.ext.ydl2PublishVersion
return isLocal() ? publishVersion + "-LOCAL" : publishVersion
}
def isLocal(){
Properties properties = new Properties()
......@@ -47,7 +48,7 @@ afterEvaluate { project ->
, project.getName()
, getVersionName()
, "aar"
, "release"
, isLocal() ? "Local" : "release"
)
}
// rootProject.getTasksByName("aa",false).forEach{println(it)}
......
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