84 师徒任务添加容错
This commit is contained in:
@@ -2,6 +2,7 @@ package com.xscm.modulemain
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.blankj.utilcode.util.AppUtils
|
||||
@@ -39,7 +40,7 @@ open class Application : CommonAppContext() {
|
||||
|
||||
var isAgoraStop = false
|
||||
var inviteDialog: InviteDialog? = null
|
||||
var currDialogActivity:Activity? = null
|
||||
var currDialogActivity: Activity? = null
|
||||
|
||||
// 单例实例
|
||||
companion object {
|
||||
@@ -85,34 +86,44 @@ open class Application : CommonAppContext() {
|
||||
when (event.msgType) {
|
||||
CustomMsgCode.CODE_TASK_APPRENTICE_JOIN_ROOM -> {
|
||||
TimerManager.cancelTimer(CustomMsgCode.CODE_TASK_APPRENTICE_JOIN_ROOM_TIMER_ID)
|
||||
val json = JSONObject(event.text.text)
|
||||
event.text.status = json.getString("status")
|
||||
when (event.text.status) {
|
||||
"1" -> {//1:邀请
|
||||
event.text.room_id = json.getString("room_id")
|
||||
if (event?.text?.room_id.isNullOrEmpty())
|
||||
return@setOnMsgTaskListener
|
||||
customDialog(
|
||||
event.text.room_id,
|
||||
CustomMsgCode.CODE_TASK_APPRENTICE_JOIN_ROOM_MSG,
|
||||
5,
|
||||
1,
|
||||
event.text
|
||||
)
|
||||
try {
|
||||
val json = JSONObject(event.text.text)
|
||||
if (!json.isNull("status")) {
|
||||
event.text.status = json.getString("status")
|
||||
}
|
||||
if (TextUtils.isEmpty(event.text.status))
|
||||
return@setOnMsgTaskListener
|
||||
when (event.text.status) {
|
||||
"1" -> {//1:邀请
|
||||
if (!json.isNull("room_id"))
|
||||
event.text.room_id = json.getString("room_id")
|
||||
if (event?.text?.room_id.isNullOrEmpty())
|
||||
return@setOnMsgTaskListener
|
||||
customDialog(
|
||||
event.text.room_id,
|
||||
CustomMsgCode.CODE_TASK_APPRENTICE_JOIN_ROOM_MSG,
|
||||
5,
|
||||
1,
|
||||
event.text
|
||||
)
|
||||
}
|
||||
|
||||
"2" -> {//2:拒绝
|
||||
customDialog(
|
||||
"",
|
||||
CustomMsgCode.CODE_TASK_APPRENTICE_JOIN_ROOM_MSG_REFUSE,
|
||||
5,
|
||||
3,
|
||||
null,
|
||||
"",
|
||||
"知道了"
|
||||
)
|
||||
"2" -> {//2:拒绝
|
||||
customDialog(
|
||||
"",
|
||||
CustomMsgCode.CODE_TASK_APPRENTICE_JOIN_ROOM_MSG_REFUSE,
|
||||
5,
|
||||
3,
|
||||
null,
|
||||
"",
|
||||
"知道了"
|
||||
)
|
||||
}
|
||||
}
|
||||
}catch (E: Exception){
|
||||
LogUtils.e("Exception",E.message.toString())
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,10 +148,14 @@ open class Application : CommonAppContext() {
|
||||
{ v: View? ->
|
||||
when (status) {
|
||||
1 -> {
|
||||
if (roomId == CommonAppContext.getInstance().playId)
|
||||
if (!TextUtils.isEmpty(CommonAppContext.getInstance().playId)
|
||||
&& roomId == CommonAppContext.getInstance().playId
|
||||
&& ActivityUtils.getTopActivity() is RoomActivity
|
||||
) {
|
||||
return@ConfirmDialog
|
||||
}
|
||||
|
||||
if (ActivityUtils.getTopActivity() is RoomActivity){
|
||||
if (ActivityUtils.getTopActivity() is RoomActivity) {
|
||||
(ActivityUtils.getTopActivity() as RoomActivity).refreshRoomInfo(roomId)
|
||||
return@ConfirmDialog
|
||||
}
|
||||
@@ -172,7 +187,7 @@ open class Application : CommonAppContext() {
|
||||
fun inviteApprenticeTaskTimer() {
|
||||
TimerManager.scheduleTimer(
|
||||
CustomMsgCode.CODE_TASK_APPRENTICE_JOIN_ROOM_TIMER_ID,
|
||||
15,
|
||||
20,
|
||||
TimeUnit.SECONDS,
|
||||
onTimeUp = {
|
||||
customDialog(
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.xscm.modulemain.activity.user.presenter.DailyTasksPresenter;
|
||||
import com.xscm.modulemain.BaseMvpActivity;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.TaskDataBean;
|
||||
import com.xscm.moduleutil.utils.CustomMsgCode;
|
||||
@@ -234,6 +235,11 @@ public class DailyTasksActivity extends BaseMvpActivity<DailyTasksPresenter, Act
|
||||
break;
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(CommonAppContext.getInstance().playId) && CommonAppContext.getInstance().playId.equals(roomId)){
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
for (Activity activity : ActivityUtils.getActivityList()) {
|
||||
if (activity instanceof RoomActivity) {
|
||||
((RoomActivity) activity).refreshRoomInfo(roomId);
|
||||
|
||||
Reference in New Issue
Block a user