This commit is contained in:
2025-12-06 16:49:23 +08:00
parent 1c9452d1fa
commit b90d1c0c98
6 changed files with 87 additions and 52 deletions

View File

@@ -74,6 +74,15 @@ public class RetrofitClient {
boolean isNetworkAvailable = checkNetworkConnection(); // 实现这个方法来检查网络状态
String cacheControl = isNetworkAvailable ? "max-age=0" : "only-if-cached, max-stale=86400";
private JoinRoomLoadListener joinRoomLoadListener;
public interface JoinRoomLoadListener {
void onJoinRoomLoad(String result);
}
public void setJoinRoomLoadListener(JoinRoomLoadListener joinRoomLoadListener) {
this.joinRoomLoadListener = joinRoomLoadListener;
}
private boolean checkNetworkConnection() {
ConnectivityManager connectivityManager = (ConnectivityManager) CommonAppContext.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
@@ -2248,6 +2257,9 @@ public class RetrofitClient {
}
} else if (roomInfoRespBaseModel.getCode() == 0) {
ToastUtils.showShort(roomInfoRespBaseModel.getMsg());
if (joinRoomLoadListener != null){
joinRoomLoadListener.onJoinRoomLoad(roomInfoRespBaseModel.getMsg());
}
}else if (roomInfoRespBaseModel.getCode() == 202){
observer.onNext(roomInfoRespBaseModel.getData());
} else {