From f5d1c6c2abeb208d91bc3b7d8c4944433276e6e3 Mon Sep 17 00:00:00 2001 From: ningwenqiang Date: Tue, 5 Nov 2024 16:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=A4=E5=A4=84=E5=9B=BE=E7=89=87=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/share/AbsShareInterface.java | 6 +++--- app/src/main/AndroidManifest.xml | 1 + .../main/res/xml/network_security_config.xml | 6 ++++++ .../com/yunbao/common/upload/UploadQnImpl.java | 17 ++++++++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/xml/network_security_config.xml diff --git a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java index 141191dbb..d82b80c92 100644 --- a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java +++ b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java @@ -26,11 +26,11 @@ public abstract class AbsShareInterface { TwitterResultReceiver receiver = new TwitterResultReceiver(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - // Android 12 (API 33) 及以上版本 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { // API 33+ + // Android 13 (API 33) 及以上版本使用导出标志 context.registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED); } else { - // Android 12 (API 33) 以下版本 + // Android 12 (API 32) 以下版本 context.registerReceiver(receiver, filter); } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f9b149de5..f490e6707 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -104,6 +104,7 @@ + + + upload-z0.qiniup.com + + \ No newline at end of file diff --git a/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java index af19dc222..0f4f31185 100644 --- a/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java +++ b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java @@ -54,14 +54,29 @@ public class UploadQnImpl implements UploadStrategy { public void complete(String key, ResponseInfo info, JSONObject response) { System.out.println("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null)); //L.e("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null)); - try { + /* try { assert response != null; mList.get(mIndex).setRemoteAccessUrl(response.getString("key")); } catch (JSONException e) { // throw new RuntimeException(e); L.e(e); return; + }*/ + + if (response == null) { + // Handle the null case, e.g., log an error, throw a specific exception, etc. + L.e("Response is null"); + return; } + try { + mList.get(mIndex).setRemoteAccessUrl(response.getString("key")); + } catch (JSONException e) { + L.e(e); + return; + } + + + if (mList == null || mList.size() == 0) { if (mUploadCallback != null) { mUploadCallback.onFinish(mList, false);