Commit ffae3e1a by YKai

Merge remote-tracking branch 'origin/多端登录不互踢new' into 4.1.69(强绑手机号)

# Conflicts:
#	config.gradle
#	m-user/src/main/AndroidManifest.xml
#	m-user/src/main/java/com/yidianling/user/http/UserApi.kt
#	m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
parents 42ba75b0 841206a3
......@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.48.92",
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.65",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.16",
......@@ -33,14 +33,14 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.85",
"ydl-platform" : "0.0.39.86",
//第二步 若干
"ydl-webview" : "0.0.38.36",
"ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.13",
"m-audioim" : "0.0.49.29.22",
"ydl-flutter-base": "0.0.14.22",
"m-audioim" : "0.0.49.29.30",
"ydl-flutter-base": "0.0.14.20",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -88,16 +88,15 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.48.92",
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.65",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.16",
"m-home" : "0.0.22.54",
"m-im" : "0.0.18.39",
"m-im" : "0.0.18.34",
"m-dynamic" : "0.0.7.19",
"m-article" : "0.0.0.6",
"m-muse" : "0.0.20.7",
"m-tests" : "0.0.24.9",
"m-course" : "0.0.42.19",
......@@ -116,14 +115,14 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.85",
"ydl-platform" : "0.0.39.86",
//第二步 若干
"ydl-webview" : "0.0.38.36",
"ydl-media" : "0.0.21.6",
"ydl-pay" : "0.0.18.11",
"m-audioim" : "0.0.49.29.22",
"ydl-flutter-base": "0.0.14.22",
"m-audioim" : "0.0.49.29.30",
"ydl-flutter-base": "0.0.14.20",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -138,7 +137,7 @@ ext {
"cardview-v7" : "com.android.support:cardview-v7:${version["androidSupportSdkVersion"]}",
"annotations" : "com.android.support:support-annotations:${version["androidSupportSdkVersion"]}",
"recyclerview-v7" : "com.android.support:recyclerview-v7:${version["androidSupportSdkVersion"]}",
"constraint-layout" : "com.android.support.constraint:constraint-layout:2.0.4",
"constraint-layout" : "com.android.support.constraint:constraint-layout:1.1.3",
//network
"retrofit" : "com.squareup.retrofit2:retrofit:${version["retrofitSdkVersion"]}",
......
......@@ -75,7 +75,7 @@ dependencies {
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
api "com.alibaba:arouter-api:$arouter_api"
api ('com.ydl:ydl-av:1.2.5@aar'){
api ('com.ydl:ydl-av:1.2.8@aar'){
transitive = true
}
......
......@@ -22,10 +22,13 @@ import com.ydl.ydl_av.messge_service.callback.LoginCallback
import com.ydl.ydl_av.messge_service.request.LoginParam
import com.ydl.ydl_av.messge_service.response.CallLocalResponse
import com.ydl.ydl_av.messge_service.response.CallRemoteResponse
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.RxSPTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack
......@@ -34,6 +37,7 @@ import com.yidianling.user.api.event.UserLogoutEvent
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.agora.rtm.RtmStatusCode
import io.agora.rtm.RtmStatusCode.ConnectionChangeReason.CONNECTION_CHANGE_REASON_REMOTE_LOGIN
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
......@@ -52,6 +56,7 @@ class YDLavManager {
//当前sdk的登录状态
var sdkStatus = -1
var isOnlineRtm = true // 账号在多端登录情况下判断RTM否在线,仅仅用在RTM互踢情况下判断是否在线,其它场景慎用
val instances: YDLavManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
YDLavManager()
......@@ -156,7 +161,11 @@ class YDLavManager {
}
}
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> { //呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
if (act is AudioHomeActivity) {
/*
* 和IOS保持一致,当呼叫邀请为3的时候不处理
* */
/* if (act is AudioHomeActivity) {
act.runOnUiThread {
sendCustomNotification(response?.calleeId!!, response?.ChannelId!!, "5")
callEndStatusUpdate(response.ChannelId!!, 2, "被叫超时未接听")
......@@ -165,7 +174,7 @@ class YDLavManager {
// act.uploadLog()
// act.leaveChannel()
}
}
}*/
}
}
//呼叫失败日志输出
......@@ -246,51 +255,51 @@ class YDLavManager {
toUid: String,
content: String
) {
LogUtil.e("[agora]收到云信的通知消息:$content")
val agoraInvitationBean = Gson().fromJson(content, AgoraInvitationBean::class.java)
// LogUtil.e("[agora]收到云信的通知消息:$content")
// val agoraInvitationBean = Gson().fromJson(content, AgoraInvitationBean::class.java)
//1发起呼叫 2接受呼叫 3取消呼叫 4拒绝呼叫邀请 5呼叫超时
when (agoraInvitationBean.callType) {
"1" -> {
writeAgoraLog("1收到云信消息通知电话-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
receivedCall(agoraInvitationBean.data, "来自云信")
}
"2" -> {
writeAgoraLog("对方接受了通话邀请,主叫开始加入频道:callType${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
FILE_NAME
)
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) {
act.runOnUiThread {
act.joinChannel()
}
}
}
"3" -> {
writeAgoraLog("呼叫邀请被取消:主叫主动取消-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
closePage()
}
"4" -> {
writeAgoraLog("被叫拒绝了通话邀请-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) {
act.runOnUiThread {
ToastUtil.toastShort("对方已挂断")
//通话结束或挂断时,上传日志文件
act.uploadLog()
act.leaveChannel()
}
}
}
"5" -> {
writeAgoraLog("呼叫邀请被取消:呼叫邀请过期-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
//关闭页面
closePage()
}
else -> {
writeAgoraLog("其它AgoraInvitationBean,${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
}
}
// when (agoraInvitationBean.callType) {
// "1" -> {
// writeAgoraLog("1收到云信消息通知电话-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// receivedCall(agoraInvitationBean.data, "来自云信")
// }
// "2" -> {
// writeAgoraLog("对方接受了通话邀请,主叫开始加入频道:callType${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
// FILE_NAME
// )
// val act = ActivityManager.getInstance().getTopTaskActivity()
// if (act is AudioHomeActivity) {
// act.runOnUiThread {
// act.joinChannel()
// }
// }
// }
// "3" -> {
// writeAgoraLog("呼叫邀请被取消:主叫主动取消-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// closePage()
// }
// "4" -> {
// writeAgoraLog("被叫拒绝了通话邀请-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// val act = ActivityManager.getInstance().getTopTaskActivity()
// if (act is AudioHomeActivity) {
// act.runOnUiThread {
// ToastUtil.toastShort("对方已挂断")
// //通话结束或挂断时,上传日志文件
// act.uploadLog()
// act.leaveChannel()
// }
// }
// }
// "5" -> {
// writeAgoraLog("呼叫邀请被取消:呼叫邀请过期-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// //关闭页面
// closePage()
// }
// else -> {
// writeAgoraLog("其它AgoraInvitationBean,${agoraInvitationBean.callType}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", FILE_NAME)
// }
// }
}
})
}
......@@ -372,11 +381,12 @@ class YDLavManager {
LogUtil.e("[agora]login-uid:$userId")
return
}
isOnlineRtm = true
//登录实时消息
//获取token
AudioApiRequestUtil.getAgoraToken().subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe({
if ("200".equals(it.code)) {
if ("200" == it.code) {
LogUtil.e("[agora]登录av的login-uid:$userId")
YDLRTMClient.instances.login(
LoginParam(userId, it.data.token),
......@@ -460,13 +470,17 @@ class YDLavManager {
/**
* 退出登录
* @param
*/
fun logout() {
private fun logout(isReLogin:Boolean) {
EventBus.getDefault().unregister(this)
YDLRTMClient.instances.logout(object : LoginCallback {
override fun onSuccess() {
//退出登陆成功
LogUtil.d("[agora]实时消息退出成功")
if (isReLogin){
login(ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid)
}
}
override fun onFailure(msg: String?) {
......@@ -476,6 +490,13 @@ class YDLavManager {
}
/**
* 退出登录默认不重新登录
*/
fun logout(){
logout(false)
}
/**
* RTM登录异常,上传错误日志 msg
* 声网出现异常,上传错误日志 connectException
*/
......@@ -531,6 +552,19 @@ class YDLavManager {
sdkStatus = state
writeAgoraLog("声网rtm登录状态:${state}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}", "confide.log", true)
LogUtil.i("[agora]onConnectionStateChanged:state:${state} -->reason:$reason")
/*
* 当reason=CONNECTION_CHANGE_REASON_REMOTE_LOGIN的时候,是远端用户以相同UID登录RTM
* 如果正在通话中,则不进行退出操作
* */
if (reason==CONNECTION_CHANGE_REASON_REMOTE_LOGIN){
if (!activityIsExists(ConsultantAudioHomeActivity::class.java)&&!activityIsExists(AudioHomeActivity::class.java)){
isOnlineRtm = false
logout()
}else{
logout(true)
}
}
}
}
}
\ No newline at end of file
......@@ -17,6 +17,8 @@ import com.ydl.webview.TellData
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.common.tools.RxSPTool
import com.yidianling.common.tools.ToastUtil
/**
* Created by haorui on 2019-12-11 .
......@@ -50,7 +52,7 @@ class ConfdieServiceImpl : IConfideService {
}
override fun connectionJava(id: Int, type: Int, activity: Activity, tellData: String?, callType: String?) {
var myTellData: TellData? = if (tellData == null ) null else Gson().fromJson(tellData, TellData::class.java)
val myTellData: TellData? = if (tellData == null ) null else Gson().fromJson(tellData, TellData::class.java)
ConfideWebServiceImpl().connectionJava(id, type, activity, myTellData, callType)
}
......
......@@ -7,6 +7,7 @@ import android.net.Uri
import android.text.TextUtils
import com.alibaba.android.arouter.launcher.ARouter
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.ConnectParamJava
......@@ -16,9 +17,12 @@ import com.ydl.confide.home.util.ConfideNetworkUtil
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.TellData
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxSPTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.api.service.IUserService
import com.yidianling.ydl_pay.pay.payDialog.CallBack
import com.yidianling.ydl_pay.pay.payDialog.ConfidePayParams
......@@ -107,6 +111,10 @@ class ConfideWebServiceImpl {
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,
......
......@@ -6,7 +6,10 @@
<activity android:name=".mine.AccountUnRegisterActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"/>
<activity android:name=".ui.login.BindPhoneActivity"></activity>
<activity android:name=".ui.login.BindPhoneActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
/>
<activity
android:name=".ui.LoginActivity"
android:screenOrientation="portrait"
......
......@@ -142,9 +142,7 @@ interface UserApi {
@FormUrlEncoded
@POST("user/getNewUserJumpUrl")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getNewUserJumpUrl(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<String>>
fun getNewUserJumpUrl(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<String>> //获取新用户引导页面url
//第三方登录获取用户信息
@POST("login/v2/login_wechat_qq")
......
......@@ -375,14 +375,15 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
String openid = map.get("openid");
String unionid = map.get("unionid");
userHttp.bindWX(new BindWX(openid, unionid))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(o -> {
dismissProgressDialog();
if(o.code == 0 ) {
if (o.code == 0) {
UserHelper.INSTANCE.getUserInfo().getUserInfo().setBind_weixin(1);
jtv_wechat.setRightText("已绑定");
ToastUtil.toastShort("绑定成功");
}else{
} else {
ToastHelper.Companion.show(o.msg);
}
}, new ThrowableConsumer() {
......@@ -449,7 +450,7 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
if (flag != 2) {
//满足再次弹窗确认条件
noticeDialog(type);
} else {
}else{
unbindThirdLogin(type);
}
} else {
......@@ -523,7 +524,7 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
* 绑定手机
*/
private void bindPhone() {
RegisterAndLoginActivity.Companion.start(this, true);
RegisterAndLoginActivity.Companion.start(this,true);
}
private String isNullString(String str) {
......
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