fix [找回密码无法登陆问题]

This commit is contained in:
zlzw 2024-04-02 13:19:23 +08:00
parent 1f21d447e7
commit 41874a5073
7 changed files with 35 additions and 6 deletions

View File

@ -39,7 +39,6 @@ import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.AnchorStartLiveBean;
import com.yunbao.common.bean.CrashSaveBean;
import com.yunbao.common.dialog.DebugDialog;
import com.yunbao.common.event.SudGameSocketImEvent;
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
@ -297,6 +296,7 @@ public class AppContext extends CommonAppContext {
} else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息
EventBus.getDefault().post(message);
MessageIMManager.get(sInstance).resetImUnReadMessageCount(sInstance);
if (AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity) {
return false;
}
@ -307,7 +307,6 @@ public class AppContext extends CommonAppContext {
RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, message.getTargetId(), new RongIMClient.ResultCallback<Integer>() {
@Override
public void onSuccess(Integer integer) {
DebugDialog.getInstance(AppManager.getActivity(MainActivity.class)).setParams("推送" + message.getTargetId(), "是否已读:" + message.getReceivedStatus().isRead() + "|未读数" + integer);
if (integer > 0) {
Log.i("聊天推送", message.getTargetId() + "是否已读:" + message.getReceivedStatus().isRead() + "|未读数" + integer);
MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity()

View File

@ -11,11 +11,13 @@ import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.dialog.DebugDialog;
import com.yunbao.common.dialog.MessageLongClickPopuwindow;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.RouteUtil;
import org.greenrobot.eventbus.EventBus;
@ -26,6 +28,7 @@ import java.util.List;
import io.rong.imkit.IMCenter;
import io.rong.imkit.config.ConversationClickListener;
import io.rong.imkit.manager.UnReadMessageManager;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.UserInfo;
@ -74,6 +77,7 @@ public class MessageIMManager {
UnReadMessageManager.getInstance().addObserver(conversationTypes, new UnReadMessageManager.IUnReadMessageObserver() {
@Override
public void onCountChanged(int integer) {
if (!IMLoginManager.get(mContext).hintChat()) {
imNumber = integer;
//发送通知
@ -83,6 +87,24 @@ public class MessageIMManager {
}
});
}
public void resetImUnReadMessageCount(Context mContext){
RongIMClient.getInstance().getUnreadCount(new Conversation.ConversationType[]{
Conversation.ConversationType.PRIVATE
}, new RongIMClient.ResultCallback<Integer>() {
@Override
public void onSuccess(Integer integer) {
imNumber = integer;
//发送通知
unreadMessagesHandler.post(essagesRunnable);
}
@Override
public void onError(RongIMClient.ErrorCode e) {
}
});
}
public MessageIMManager setSystemNumber(int systemNumber) {

View File

@ -20,6 +20,15 @@ public class AppManager {
return SingleApp.INSTANCE;
}
public Activity getMainActivity() {
for (Activity activity : activityStack) {
if(activity.getClass().getSimpleName().contains("MainActivity")){
return activity;
}
}
return getLastActivity();
}
public static class SingleApp {
public static AppManager INSTANCE = new AppManager();
}

View File

@ -55,10 +55,9 @@ public class MessageChatNotifyManager {
private synchronized void notifyLiveFlot(Context mContext) {
String simpleName = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
if (clazzList.contains(simpleName)) {
ToastUtil.showDebug("屏蔽类,不展示");
// ToastUtil.showDebug("屏蔽类,不展示");
return;
}
DebugDialog.getInstance((Activity) mContext).setParams("待推送通知数", startListNotifyList.size() + "");
if (startListNotifyList.iterator().hasNext()) {
MessageUserInfoBean bean = startListNotifyList.iterator().next();
RongIMClient.getInstance().getUnreadCount(Conversation.ConversationType.PRIVATE, bean.getUser().getId() + "", new RongIMClient.ResultCallback<Integer>() {

View File

@ -368,6 +368,7 @@ public class FindPwdActivity extends AbsActivity {
String uid = obj.getString("id");
String token = obj.getString("token");
IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class);
IMLoginManager.get(mContext).setupLoginUser(model);
CommonAppConfig.getInstance().setLoginInfo(uid, token, true);
getBaseUserInfo();
} else {

View File

@ -234,7 +234,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
.postDelayed(new Runnable() {
@Override
public void run() {
DebugDialog.getInstance(mContext).setParams("Debug", "悬浮层");
}
}, 1000);
UserInfoManager.updateMyInfo(this, null);

View File

@ -113,6 +113,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
public void onResume() {
super.onResume();
initData();
MessageIMManager.get(mContext).resetImUnReadMessageCount(mContext);
search.setText("");
}
@ -230,7 +231,6 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
@Override
public void run() {
netHandler.post(imUserInfoRunnable);
IMLoginManager.get(mContext).initChat("1");
if (IMLoginManager.get(mContext).hintChat()) {
container.setVisibility(View.GONE);
ltNodataMsg.setVisibility(View.VISIBLE);