|
|
@@ -12,10 +12,13 @@ import com.tencent.imsdk.v2.V2TIMConversation
|
|
|
import com.tencent.imsdk.v2.V2TIMManager
|
|
|
import com.tencent.qcloud.tuicore.TUIConstants
|
|
|
import com.tencent.qcloud.tuicore.TUICore
|
|
|
+import com.tencent.qcloud.tuicore.TUILogin
|
|
|
+import com.tencent.qcloud.tuicore.interfaces.TUICallback
|
|
|
import com.yingyang.healthconsultation.R
|
|
|
import com.yingyang.healthconsultation.adapter.ConsultationAdapter
|
|
|
import com.yingyang.healthconsultation.adapter.RecommendDoctorAdapter
|
|
|
import com.yingyang.healthconsultation.databinding.ActivityHealthConsultationBinding
|
|
|
+import com.yingyangfly.baselib.config.AccountConfig
|
|
|
import com.yingyangfly.baselib.db.DoctorBean
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
@@ -197,24 +200,25 @@ class HealthConsultationActivity :
|
|
|
*
|
|
|
*/
|
|
|
private fun loginIM(sign: String, bean: DoctorBean) {
|
|
|
- V2TIMManager.getInstance().login(User.getUserId(), sign, object : V2TIMCallback {
|
|
|
- override fun onError(p0: Int, p1: String?) {
|
|
|
- runOnUiThread {
|
|
|
- //用户登录IM失败
|
|
|
- CrashReport.postCatchedException(Throwable(User.getName() + "用户登录IM失败,错误码:" + p0 + " ,错误信息:" + p1))
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ TUILogin.login(mContext, AccountConfig.TENCENT_IM_APPID, User.getUserId(), sign, object :
|
|
|
+ TUICallback() {
|
|
|
override fun onSuccess() {
|
|
|
runOnUiThread {
|
|
|
+ "IM登陆成功".toast()
|
|
|
val param = Bundle()
|
|
|
param.putInt(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C)
|
|
|
param.putString(TUIConstants.TUIChat.CHAT_ID, bean.id)
|
|
|
- param.putString(TUIConstants.TUIChat.CHAT_NAME, "你好")
|
|
|
+ param.putString(TUIConstants.TUIChat.CHAT_NAME, bean.userName)
|
|
|
param.putString(TUIConstants.TUIChat.FACE_URL, bean.avatar)
|
|
|
TUICore.startActivity(TUIConstants.TUIChat.C2C_CHAT_ACTIVITY_NAME, param)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ override fun onError(errorCode: Int, errorMessage: String?) {
|
|
|
+ runOnUiThread {
|
|
|
+ "IM登陆失败".toast()
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|