diff --git a/app/src/main/java/com/gh/common/databind/BindingAdapters.java b/app/src/main/java/com/gh/common/databind/BindingAdapters.java index a306ceecd8..7d8b3acaad 100644 --- a/app/src/main/java/com/gh/common/databind/BindingAdapters.java +++ b/app/src/main/java/com/gh/common/databind/BindingAdapters.java @@ -580,6 +580,7 @@ public class BindingAdapters { case uncertificated: case unqualified: case unavailable: + case banned: break; default: break; diff --git a/app/src/main/java/com/gh/common/simulator/SimulatorDownloadManager.kt b/app/src/main/java/com/gh/common/simulator/SimulatorDownloadManager.kt index 7c5bd38bab..5d2f7bad6f 100644 --- a/app/src/main/java/com/gh/common/simulator/SimulatorDownloadManager.kt +++ b/app/src/main/java/com/gh/common/simulator/SimulatorDownloadManager.kt @@ -97,6 +97,9 @@ class SimulatorDownloadManager private constructor() { DownloadStatus.unavailable == downloadEntity.status -> { ToastUtils.showToast("该游戏未接入防沉迷系统,暂不支持下载") } + DownloadStatus.banned == downloadEntity.status -> { + ToastUtils.showToast("网络异常") + } DownloadStatus.hijack == downloadEntity.status -> { ToastUtils.showToast("网络劫持,请稍后重试") } diff --git a/app/src/main/java/com/gh/common/util/DetailDownloadUtils.java b/app/src/main/java/com/gh/common/util/DetailDownloadUtils.java index dd1d3586dd..d331b0e362 100644 --- a/app/src/main/java/com/gh/common/util/DetailDownloadUtils.java +++ b/app/src/main/java/com/gh/common/util/DetailDownloadUtils.java @@ -202,6 +202,7 @@ public class DetailDownloadUtils { case uncertificated: case unqualified: case unavailable: + case banned: detailInitDownload(viewHolder, false); break; default: diff --git a/app/src/main/java/com/gh/common/util/DownloadNotificationHelper.kt b/app/src/main/java/com/gh/common/util/DownloadNotificationHelper.kt index af208da26f..e5cbafa9bb 100644 --- a/app/src/main/java/com/gh/common/util/DownloadNotificationHelper.kt +++ b/app/src/main/java/com/gh/common/util/DownloadNotificationHelper.kt @@ -119,6 +119,7 @@ object DownloadNotificationHelper { || entity.status == DownloadStatus.hijack || entity.status == DownloadStatus.unqualified || entity.status == DownloadStatus.unavailable + || entity.status == DownloadStatus.banned || entity.status == DownloadStatus.uncertificated || entity.status == DownloadStatus.notfound || entity.status == DownloadStatus.overflow diff --git a/app/src/main/java/com/gh/common/util/DownloadObserver.kt b/app/src/main/java/com/gh/common/util/DownloadObserver.kt index f0c577ca65..3868df9878 100644 --- a/app/src/main/java/com/gh/common/util/DownloadObserver.kt +++ b/app/src/main/java/com/gh/common/util/DownloadObserver.kt @@ -18,6 +18,7 @@ import com.gh.gamecenter.common.utils.* import com.gh.gamecenter.core.utils.GsonUtils import com.gh.gamecenter.core.utils.MtaHelper import com.gh.gamecenter.core.utils.StringUtils +import com.gh.gamecenter.core.utils.ToastUtils import com.gh.gamecenter.entity.GameEntity import com.gh.gamecenter.entity.SimpleGameEntity import com.gh.gamecenter.entity.SimulatorEntity @@ -131,6 +132,11 @@ object DownloadObserver { // 未实名 RealNameHelper.showRealNameUncertificatedDialog(downloadEntity) + // 删除任务 + downloadEntity.status = DownloadStatus.cancel + downloadManager.cancel(downloadEntity.url) + }else if (DownloadStatus.banned == downloadEntity.status) { + ToastUtils.showToast("网络异常") // 删除任务 downloadEntity.status = DownloadStatus.cancel downloadManager.cancel(downloadEntity.url) diff --git a/app/src/main/java/com/gh/common/util/ErrorHelper.kt b/app/src/main/java/com/gh/common/util/ErrorHelper.kt index 9349cded95..8448d49842 100644 --- a/app/src/main/java/com/gh/common/util/ErrorHelper.kt +++ b/app/src/main/java/com/gh/common/util/ErrorHelper.kt @@ -187,8 +187,10 @@ object ErrorHelper { "前往实名认证", "以后再说", uiModificationCallback = { binding -> binding.hintTv.visibility = View.VISIBLE - binding.hintTv.layoutParams = (binding.hintTv.layoutParams as ViewGroup.MarginLayoutParams).apply { setMargins(0, 8F.dip2px(), 0, 0) } - binding.lineView.layoutParams = (binding.lineView.layoutParams as ViewGroup.MarginLayoutParams).apply { setMargins(0, 23F.dip2px(), 0, 0) } + binding.hintTv.layoutParams = + (binding.hintTv.layoutParams as ViewGroup.MarginLayoutParams).apply { setMargins(0, 8F.dip2px(), 0, 0) } + binding.lineView.layoutParams = + (binding.lineView.layoutParams as ViewGroup.MarginLayoutParams).apply { setMargins(0, 23F.dip2px(), 0, 0) } binding.hintTv.text = errorEntity.data?.text binding.hintTv.setTextColor(R.color.theme_font.toColor(context)) binding.hintTv.setOnClickListener { @@ -303,6 +305,9 @@ object ErrorHelper { errorEntity?.code == 403099 -> { Utils.toast(context, "当前账号正在注销,禁止登录") } + errorEntity?.code == 403401 -> {//禁止登录 + Utils.toast(context, "网络异常") + } errorEntity?.toast?.isNotEmpty() == true -> { Utils.toast(context, errorEntity.toast) } diff --git a/app/src/main/java/com/gh/download/DownloadDataHelper.kt b/app/src/main/java/com/gh/download/DownloadDataHelper.kt index 4e1a6b2649..5624883246 100644 --- a/app/src/main/java/com/gh/download/DownloadDataHelper.kt +++ b/app/src/main/java/com/gh/download/DownloadDataHelper.kt @@ -88,6 +88,8 @@ object DownloadDataHelper { "未成年" } else if (status == DownloadStatus.unavailable) { "未接入防沉迷系统,暂不支持下载" + }else if (status == DownloadStatus.banned) { + "网络异常" } else if (status == DownloadStatus.redirected) { "重定向至最终地址" } else { diff --git a/app/src/main/java/com/gh/gamecenter/manager/UserManager.java b/app/src/main/java/com/gh/gamecenter/manager/UserManager.java index 051a08c94e..e2b4e6bc15 100644 --- a/app/src/main/java/com/gh/gamecenter/manager/UserManager.java +++ b/app/src/main/java/com/gh/gamecenter/manager/UserManager.java @@ -7,10 +7,14 @@ import android.text.TextUtils; import androidx.annotation.Nullable; +import com.gh.common.repository.ReservationRepository; +import com.gh.common.util.ErrorHelper; import com.gh.gamecenter.common.base.activity.BaseActivity; import com.gh.gamecenter.common.constant.Constants; +import com.gh.gamecenter.common.eventbus.EBShowDialog; import com.gh.gamecenter.common.exposure.meta.MetaUtil; -import com.gh.common.repository.ReservationRepository; +import com.gh.gamecenter.common.retrofit.BiResponse; +import com.gh.gamecenter.common.retrofit.Response; import com.gh.gamecenter.common.utils.DeviceUtils; import com.gh.gamecenter.common.utils.EnvHelper; import com.gh.gamecenter.core.utils.GsonUtils; @@ -19,9 +23,6 @@ import com.gh.gamecenter.entity.CommunityEntity; import com.gh.gamecenter.entity.LoginTokenEntity; import com.gh.gamecenter.entity.TokenEntity; import com.gh.gamecenter.entity.UserInfoEntity; -import com.gh.gamecenter.common.eventbus.EBShowDialog; -import com.gh.gamecenter.common.retrofit.BiResponse; -import com.gh.gamecenter.common.retrofit.Response; import com.gh.gamecenter.retrofit.RetrofitManager; import com.gh.gamecenter.retrofit.service.ApiService; import com.gh.gamecenter.user.UserRepository; @@ -187,7 +188,7 @@ public class UserManager { public void onFailure(HttpException e) { super.onFailure(e); String errorMessage = "null"; - if (e != null && (e.code() == 401 || e.code() == 400)) { + if (e != null && (e.code() == 401 || e.code() == 403 || e.code() == 400)) { int code = -1; try { errorMessage = e.response().errorBody().string(); @@ -200,6 +201,11 @@ public class UserManager { if (code == 400401 || code == 400802) { // 自动注销 UserRepository.getInstance().logout(); } + + if (code == 403401) { + UserRepository.getInstance().logout(); + ErrorHelper.handleLoginError(HaloApp.getInstance().getApplicationContext(), e); + } } catch (Exception e1) { e1.printStackTrace(); } diff --git a/libraries/LGLibrary b/libraries/LGLibrary index 2fb219f6c0..753db733db 160000 --- a/libraries/LGLibrary +++ b/libraries/LGLibrary @@ -1 +1 @@ -Subproject commit 2fb219f6c06a14cb78341c14f5b8c847484df6cf +Subproject commit 753db733dbcda292bb4eed40a1cb6cf0b595cc76