1:修改所有接口返回提示,只是添加了返回错误的提示,不涉及功能
2:给所有网络请求添加网络判断,添加拦截器 3:启动页添加启动视频,添加跳过功能 4:去掉抱麦弹框,直接跳转到用户列表 5:修改拍卖房,当抱人上麦后,没有选择关系,然后退出房间再次进来后,显示立即竞拍的按钮 6:修改我的歌单,添加和修改的时候,选择了不能使用的礼物,让dialog不关闭 7:修改点唱房,点一个人同一首歌,右侧下一首歌的作者不显示的问题 8:修改互娱房,选择关系的时候,会出现两次选择关系的问题 9:修改在送背包礼物的时候,最后一个送出,页面没有刷新 10:修改房间设置里面,点击了抽盘,设置页面不关闭的问题 11:修改个性装扮中,购买的装扮展示的时候,出现图片裁剪
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.xscm.moduleutil.http;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.http.NetworkException;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2025/12/23 16:58
|
||||
* 用途:网络状态检查拦截器,会在每次请求前检查网络状态。
|
||||
*/
|
||||
public class NetworkCheckInterceptor implements Interceptor {
|
||||
|
||||
private final Context context;
|
||||
|
||||
public NetworkCheckInterceptor(Context context) {
|
||||
this.context = context.getApplicationContext(); // 使用 Application Context 避免内存泄漏
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
// 检查网络连接状态
|
||||
if (!isNetworkAvailable()) {
|
||||
// 如果没有网络,抛出我们自定义的异常
|
||||
ToastUtils.showLong("网络连接不可用,请检查您的网络设置");
|
||||
}
|
||||
|
||||
// 如果有网络,继续执行请求
|
||||
return chain.proceed(chain.request());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查网络是否可用
|
||||
* @return true if network is available, false otherwise.
|
||||
*/
|
||||
private boolean isNetworkAvailable() {
|
||||
ConnectivityManager connectivityManager =
|
||||
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
if (connectivityManager != null) {
|
||||
// 获取所有网络信息
|
||||
NetworkInfo[] networkInfos = connectivityManager.getAllNetworkInfo();
|
||||
if (networkInfos != null) {
|
||||
for (NetworkInfo info : networkInfos) {
|
||||
if (info.getState() == NetworkInfo.State.CONNECTED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -208,9 +208,6 @@ public class RewardGiftPresenter extends BasePresenter<RewardGiftContacts.View>
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
if (giftPackBeans == null) {
|
||||
return;
|
||||
}
|
||||
MvpRef.get().giftPack(giftPackBeans);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user