增加网络调试信息

0515
panqihua 5 years ago
parent 4eb0edaab6
commit e60c4ef863
  1. 5
      app/src/main/java/com/community/pocket/util/HttpUtil.java
  2. 1
      app/src/main/res/values-en-rUS/strings.xml
  3. 1
      app/src/main/res/values-zh-rCN/strings.xml
  4. 1
      app/src/main/res/values/strings.xml

@ -66,8 +66,13 @@ public class HttpUtil {
public void onFailure(@NotNull Call call, @NotNull IOException e) { public void onFailure(@NotNull Call call, @NotNull IOException e) {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Looper.prepare(); Looper.prepare();
if (BuildConfig.API_HOST.contains("http")) {
new AlertDialog.Builder(context) new AlertDialog.Builder(context)
.setMessage(context.getString(R.string.check_server_fail, BuildConfig.API_HOST)).show(); .setMessage(context.getString(R.string.check_server_fail, BuildConfig.API_HOST)).show();
} else {
new AlertDialog.Builder(context)
.setMessage(context.getString(R.string.error_api_host, BuildConfig.API_HOST)).show();
}
Looper.loop(); Looper.loop();
} }
} }

@ -177,4 +177,5 @@
<string name="forum_status_uncheck">uncheck</string> <string name="forum_status_uncheck">uncheck</string>
<string name="check_server_ok">connect server ok</string> <string name="check_server_ok">connect server ok</string>
<string name="check_server_fail">connect server:%1s fail</string> <string name="check_server_fail">connect server:%1s fail</string>
<string name="error_api_host">api error%1s</string>
</resources> </resources>

@ -177,4 +177,5 @@
<string name="forum_status_uncheck">未审核</string> <string name="forum_status_uncheck">未审核</string>
<string name="check_server_ok">连接服务端成功</string> <string name="check_server_ok">连接服务端成功</string>
<string name="check_server_fail">调试信息:无法连接到服务端:%1s</string> <string name="check_server_fail">调试信息:无法连接到服务端:%1s</string>
<string name="error_api_host">非法服务端配置:%1s</string>
</resources> </resources>

@ -178,6 +178,7 @@
<string name="forum_status_uncheck">uncheck</string> <string name="forum_status_uncheck">uncheck</string>
<string name="check_server_ok">connect server ok</string> <string name="check_server_ok">connect server ok</string>
<string name="check_server_fail">connect server:%1s fail</string> <string name="check_server_fail">connect server:%1s fail</string>
<string name="error_api_host">api error%1s</string>
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save