From 67cca1b4fb7ea80d9887693985ad79e9d0485914 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sun, 7 Apr 2024 17:50:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/shayu/phonelive/AppContext.java | 2 ++ .../yunbao/common/interfaces/ImageResultCallback.java | 2 +- .../common/manager/imrongcloud/MessageIMManager.java | 9 +++++---- .../common/manager/imrongcloud/RongcloudIMManager.java | 2 +- .../main/java/com/yunbao/main/activity/MainActivity.java | 1 + 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 6d804b727..58f0a0dc7 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -34,6 +34,7 @@ import com.tencent.imsdk.v2.V2TIMSimpleMsgListener; import com.tencent.imsdk.v2.V2TIMUserInfo; import com.umeng.analytics.MobclickAgent; import com.umeng.commonsdk.UMConfigure; +import com.yalantis.ucrop.UCropActivity; import com.yunbao.common.BuildConfig; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; @@ -266,6 +267,7 @@ public class AppContext extends CommonAppContext { MessageChatNotifyManager.getInstance().addShieldClass(EntryActivity.class); MessageChatNotifyManager.getInstance().addShieldClass(LoginActivity.class); MessageChatNotifyManager.getInstance().addShieldClass(RegisterActivity.class); + MessageChatNotifyManager.getInstance().addShieldClass(UCropActivity.class); RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() { diff --git a/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java b/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java index 4ebb50f2d..f253123e7 100644 --- a/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java +++ b/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java @@ -31,7 +31,7 @@ public abstract class ImageResultCallback { @Override public void onError(String error) { - listener.onItemClick(null, -1); + listener.onItemClick(error, -1); } }); } diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java index 0d23a095b..29773c398 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java @@ -112,7 +112,7 @@ public class MessageIMManager { ToastUtil.showDebug(e.getMessage()); } }); - + getSystemMessages(); } public MessageIMManager setSystemNumber(int systemNumber) { @@ -126,7 +126,7 @@ public class MessageIMManager { * 获取系统消息(有未读数展示红点) */ public void getSystemMessages() { - systemNumber = 0; + IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); if (userInfo == null) { return; @@ -138,6 +138,7 @@ public class MessageIMManager { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { + systemNumber = 0; List listUserBean = JSON.parseArray(Arrays.toString(info), IMLoginModel.class); if (listUserBean != null && listUserBean.size() >= 2) { //目前就三条消息,需求判断前两条消息是否有未读消息 @@ -217,7 +218,7 @@ public class MessageIMManager { //整合未读消息数目并且发送出去 private final Runnable essagesRunnable = () -> { number = imNumber + systemNumber; - /*if(AppManager.getInstance().getMainActivity()==null){ + /* if(AppManager.getInstance().getMainActivity()==null){ new Handler(Looper.getMainLooper()).postDelayed(() -> { DebugDialog.getInstance(AppManager.getInstance().getMainActivity()).setParams("消息", imNumber + ""); DebugDialog.getInstance(AppManager.getInstance().getMainActivity()).setParams("系統", systemNumber + ""); @@ -227,7 +228,7 @@ public class MessageIMManager { DebugDialog.getInstance(AppManager.getInstance().getMainActivity()).setParams("系統", systemNumber + ""); }*/ Log.i("未读消息", "消息: "+imNumber+" | 系统: "+systemNumber); - EventBus.getDefault().post(new MessageIMEvent().setNumber(number).setMessage(imNumber)); + EventBus.getDefault().post(new MessageIMEvent().setNumber(imNumber).setMessage(imNumber)); }; /** diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java index 82f4b9a82..c7641c707 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/RongcloudIMManager.java @@ -119,7 +119,7 @@ public class RongcloudIMManager { */ public static void connectIM(Context context) { // MessageIMManager.get(context).addImRongCloudObserver(); - MessageIMManager.get(context).getSystemMessages(); + // MessageIMManager.get(context).getSystemMessages(); IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo(); String IMToken = userInfo.getTokenRong(); Log.e(CLASSNAME, "connectIM:" + IMToken); diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 5d07dc0a2..f95e0ffb1 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -235,6 +235,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene .postDelayed(new Runnable() { @Override public void run() { + // DebugDialog.getInstance(mContext).setParams("测试版本","1.00"); ConversationIMListManager.get(mContext).addUserInfoProvider(); MessageIMManager.get(mContext).resetImUnReadMessageCount(mContext); }