优化401,以及部分中英文显示调整
This commit is contained in:
@@ -17,6 +17,7 @@ import com.ckkj.water.login.entity.LoginEntity;
|
||||
import com.ckkj.water.network.NetWorkManager;
|
||||
import com.ckkj.water.utils.dataUtil.SharePreUtil;
|
||||
import com.ckkj.water.utils.manager.LanguageManager;
|
||||
import com.ckkj.water.utils.manager.ThemeManager;
|
||||
import com.ckkj.water.utils.manager.WaterUserInfoManager;
|
||||
|
||||
import java.util.List;
|
||||
@@ -71,6 +72,9 @@ public class MyApplication extends Application {
|
||||
// 恢复应用语言设置
|
||||
applyStoredLocale();
|
||||
|
||||
// 检查并设置默认主题色(如果之前没有设置过,默认设为白色主题)
|
||||
applyDefaultTheme();
|
||||
|
||||
boolean isUserAgreed = SharePreUtil.getBoolean(ConstantUtil.SHARE_PRE_NAME,context,ConstantUtil.PRIVACY_POLICY_AGREED);
|
||||
if(isUserAgreed){
|
||||
initializeUmengSDK();
|
||||
@@ -190,4 +194,18 @@ public class MyApplication extends Application {
|
||||
private void applyStoredLocale() {
|
||||
LanguageManager.applyStoredLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查并设置默认主题色
|
||||
* 如果之前没有设置过主题(默认为 MODE_FOLLOW_SYSTEM),则设置为白色主题(MODE_LIGHT)
|
||||
*/
|
||||
private void applyDefaultTheme() {
|
||||
int currentTheme = ThemeManager.getCurrentTheme(context);
|
||||
if (currentTheme == ThemeManager.MODE_FOLLOW_SYSTEM) {
|
||||
ThemeManager.setCurrentTheme(context, ThemeManager.MODE_LIGHT);
|
||||
ThemeManager.applyTheme(ThemeManager.MODE_LIGHT);
|
||||
} else {
|
||||
ThemeManager.applyTheme(currentTheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class DeviceControlActivity extends BaseActivity<DeviceControlLayoutBindi
|
||||
case R.id.linear_bt:
|
||||
showDialogtext(null, false, false, true,
|
||||
getString(R.string.tip_text),
|
||||
getString(R.string.device_binding_conflict_message),
|
||||
getString(R.string.reset_device_provision),
|
||||
getString(R.string.cancel_text),
|
||||
getString(R.string.confirm_text),
|
||||
new BaseFragment.OnDialogClick() {
|
||||
|
||||
@@ -93,7 +93,6 @@ public class NetWorkManager {
|
||||
okhttp3.Request request = chain.request();
|
||||
String requestUrl = request.url().toString();
|
||||
String requestMethod = request.method();
|
||||
|
||||
okhttp3.Response response = chain.proceed(request);
|
||||
|
||||
int httpCode = response.code();
|
||||
@@ -103,6 +102,29 @@ public class NetWorkManager {
|
||||
+ " | 请求URL=" + requestUrl);
|
||||
}
|
||||
|
||||
try {
|
||||
String responseBody = response.peekBody(1024 * 1024).string();
|
||||
if (responseBody != null && !responseBody.trim().isEmpty()) {
|
||||
JSONObject jsonObject = new JSONObject(responseBody);
|
||||
String businessCode = jsonObject.optString("code");
|
||||
if ("401".equals(businessCode)) {
|
||||
Log.e("TEST", "业务401拦截 -> method=" + requestMethod
|
||||
+ " | url=" + requestUrl
|
||||
+ " | body=" + jsonObject.toString());
|
||||
} else if ("406".equals(businessCode)) {
|
||||
Log.e("TEST", "业务406拦截 -> method=" + requestMethod
|
||||
+ " | url=" + requestUrl
|
||||
+ " | body=" + jsonObject.toString());
|
||||
} else if ("499".equals(businessCode)) {
|
||||
Log.e("TEST", "业务499拦截 -> method=" + requestMethod
|
||||
+ " | url=" + requestUrl
|
||||
+ " | body=" + jsonObject.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("TEST", "响应体解析失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user