diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/ImInitHelper.java b/app/src/main/java/com/yizhuan/erban/ui/im/ImInitHelper.java index 82523079c..614f34e48 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/im/ImInitHelper.java +++ b/app/src/main/java/com/yizhuan/erban/ui/im/ImInitHelper.java @@ -14,6 +14,8 @@ import com.yizhuan.erban.community.im.WorldDynamicShareViewHolder; import com.yizhuan.erban.luckymoney.viewholder.LuckyMoneyMsgViewHolder; import com.yizhuan.erban.luckymoney.viewholder.LuckyMoneyTipsViewHolder; import com.yizhuan.erban.module_hall.HallDataManager; +import com.yizhuan.erban.module_hall.im.msgholder.ClanMsgViewHolder; +import com.yizhuan.erban.module_hall.im.msgholder.HallMsgViewHolder; import com.yizhuan.erban.public_chat_hall.msg.viewholder.MsgViewHolderAitMe; import com.yizhuan.erban.share.viewholder.InAppSharingMsgViewHolder; import com.yizhuan.erban.ui.im.actions.GiftAction; @@ -61,6 +63,8 @@ import com.yizhuan.xchat_android_core.im.custom.bean.SkillMsgAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgV2Attachment; import com.yizhuan.xchat_android_core.miniworld.bean.OpenAudioPartyAttachment; +import com.yizhuan.xchat_android_core.module_hall.im.ClanAttachment; +import com.yizhuan.xchat_android_core.module_hall.im.HallAttachment; import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitMeAttachment; import java.util.ArrayList; @@ -146,6 +150,8 @@ public class ImInitHelper { NimUIKit.registerMsgItemViewHolder(RedPackageAttachment.class, MsgViewHolderRedPackage.class); //模厅模块 HallDataManager.get().mainNimOnCreate(); + //公会模块 + NimUIKit.registerMsgItemViewHolder(ClanAttachment.class, ClanMsgViewHolder.class); //签到 NimUIKit.registerMsgItemViewHolder(OpenSignInAttachment.class, SignInNoticeMsgViewHolder.class); //瓜分钻石 三级 diff --git a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java index 7a68fe1db..2990e153c 100644 --- a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java +++ b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java @@ -371,7 +371,6 @@ public class ModuleHallActivity extends BaseMvpActivity authInfoList) { if (authInfoList != null && authInfoList.size() > 0) { - List list_adapter = new ArrayList<>(); for (AuthInfo authInfo : authInfoList) { if (authInfo.getCode().equals(AuthInfo.AUTH_APPLY_HALL_EXIT)) { diff --git a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/im/NimHelper.java b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/im/NimHelper.java index 8be617d17..a0104034c 100644 --- a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/im/NimHelper.java +++ b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/im/NimHelper.java @@ -10,6 +10,7 @@ import com.netease.nimlib.sdk.team.model.Team; import com.trello.rxlifecycle3.LifecycleProvider; import com.yizhuan.erban.R; import com.yizhuan.xchat_android_core.manager.IMNetEaseManager; +import com.yizhuan.xchat_android_core.module_hall.im.ClanImMsgInfo; import com.yizhuan.xchat_android_core.module_hall.im.HallImMsgInfo; import com.yizhuan.xchat_android_library.utils.ResUtil; @@ -40,6 +41,22 @@ public class NimHelper { } } + /** + * 更新公会消息到本地数据库 + * + * @param uuid 消息 UUID + * @param info 模厅消息实体 + */ + public static void updateClanMsgInfoMessage(String uuid, ClanImMsgInfo info) { + IMMessage message = IMNetEaseManager.get().queryMessageByUuid(uuid); + if (message != null) { + Map localExtension = ClanImMsgInfo.convertToMap(info); + message.setLocalExtension(localExtension); + NIMClient.getService(MsgService.class) + .updateIMMessage(message); + } + } + /**云信sdk获取群信息*/ public static Single getTeamById(LifecycleProvider provider, String tid) { if (TextUtils.isEmpty(tid)) { diff --git a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/im/msgholder/ClanMsgViewHolder.java b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/im/msgholder/ClanMsgViewHolder.java new file mode 100644 index 000000000..bf621c0ac --- /dev/null +++ b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/im/msgholder/ClanMsgViewHolder.java @@ -0,0 +1,251 @@ +package com.yizhuan.erban.module_hall.im.msgholder; + +import android.graphics.Color; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.TextPaint; +import android.text.TextUtils; +import android.text.style.ForegroundColorSpan; +import android.text.style.MetricAffectingSpan; +import android.util.TypedValue; +import android.view.View; +import android.widget.TextView; + +import androidx.constraintlayout.widget.ConstraintLayout; + +import com.alibaba.fastjson.JSON; +import com.coorchice.library.SuperTextView; +import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase; +import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter; +import com.netease.nim.uikit.common.util.sys.ScreenUtil; +import com.netease.nimlib.sdk.msg.model.IMMessage; +import com.orhanobut.logger.Logger; +import com.yizhuan.erban.R; +import com.yizhuan.erban.module_hall.im.NimHelper; +import com.yizhuan.erban.ui.im.RouterHandler; +import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment; +import com.yizhuan.xchat_android_core.manager.IMNetEaseManager; +import com.yizhuan.xchat_android_core.manager.event.HallInfoChangeEvent; +import com.yizhuan.xchat_android_core.module_hall.hall.HallModel; +import com.yizhuan.xchat_android_core.module_hall.hall.bean.ApplyResult; +import com.yizhuan.xchat_android_core.module_hall.im.ClanAttachment; +import com.yizhuan.xchat_android_core.module_hall.im.ClanImMsgInfo; +import com.yizhuan.xchat_android_core.module_hall.im.HallImMsgInfo; +import com.yizhuan.xchat_android_core.module_hall.im.bean.HallMsgComponent; +import com.yizhuan.xchat_android_core.module_hall.im.bean.HallMsgLayout; +import com.yizhuan.xchat_android_core.utils.net.BeanObserver; +import com.yizhuan.xchat_android_library.utils.SingleToastUtil; + +import org.greenrobot.eventbus.EventBus; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + + +/** + * 公会im消息展示 + * Created by wushaocheng on 2019/1/7. + */ + +public class ClanMsgViewHolder extends MsgViewHolderBase{ + + private ConstraintLayout clContainer; + private TextView tvTitle; + private SuperTextView stvAgree; + private TextView tvContent; + private View llOpLayout; + private SuperTextView stvReject; + + public ClanMsgViewHolder(BaseMultiItemFetchLoadAdapter adapter) { + super(adapter); + } + + @Override + protected int getContentResId() { + return R.layout.layout_clan_msg_view_holder; + } + + @Override + protected void inflateContentView() { + tvTitle = findViewById(R.id.tv_title); + stvAgree = findViewById(R.id.stv_agree); + stvReject = findViewById(R.id.stv_reject); + llOpLayout = findViewById(R.id.ll_op_layout); + tvContent = findViewById(R.id.tv_content); + clContainer = findViewById(R.id.cl_container); + } + + @Override + protected void bindContentView() { + clContainer.getLayoutParams().width = ScreenUtil.screenWidth * 240 / 375; + clContainer.setVisibility(View.GONE); + clContainer.setClickable(false); + if (message == null) { + return; + } + IMMessage imMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid()); + if (imMessage == null || imMessage.getAttachment() == null) { + return; + } + if (!(imMessage.getAttachment() instanceof ClanAttachment)) { + return; + } + ClanAttachment attachment = (ClanAttachment) imMessage.getAttachment(); + ClanImMsgInfo info = attachment.getClanImMsgInfo(); + if (info == null) { + return; + } + if (message.getLocalExtension() != null) { + info = ClanImMsgInfo.convertMapToObject(message.getLocalExtension()); + } + Logger.i("infoType:" + info.getType()); + clContainer.setVisibility(View.VISIBLE); + if (info.getRouterType() > 0) { + final int routerType = info.getRouterType(); + final String routerValue = info.getRouterValue(); + clContainer.setClickable(true); + clContainer.setOnClickListener(v -> + RouterHandler.handle(context, routerType, routerValue)); + } + stvReject.setVisibility(View.VISIBLE); + int second = attachment.getSecond(); + if (second == CustomAttachment.CUSTOM_MSG_SUB_CLANAPPLY) { //申请加入 + llOpLayout.setVisibility(View.VISIBLE); + handleClick(info, second); + } else if (second == CustomAttachment.CUSTOM_MSG_SUB_CLANNORMAL) {//其它文本通知 + llOpLayout.setVisibility(View.GONE); + } else { + llOpLayout.setVisibility(View.GONE); + } + + HallMsgLayout hallMsgLayout = null; + try { + String layout = info.getLayout(); + if (!TextUtils.isEmpty(layout)) { + hallMsgLayout = JSON.parseObject(layout, HallMsgLayout.class); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + if (hallMsgLayout == null) { + tvTitle.setText(""); + tvContent.setText(""); + return; + } + // title + tvTitle.setText(hallMsgLayout.getTitle().getContent()); + // content + List erbanSysMsgLayoutContent = hallMsgLayout.getContents(); + if (erbanSysMsgLayoutContent != null) { + SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); + for (HallMsgComponent component : erbanSysMsgLayoutContent) { + int start = spannableStringBuilder.length(); + String msgBody = component.getContent(); + if (Objects.equals(msgBody, "/r/n")) { + msgBody = "\r\n"; + spannableStringBuilder.append(msgBody); + continue; + } + spannableStringBuilder.append(msgBody); + if (component.getFontColor() != null) { + try { + spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(component.getFontColor())), + start, spannableStringBuilder.length(), + Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + if (component.getFontSize() > 0) { + spannableStringBuilder.setSpan( + new MetricAffectingSpan() { + @Override + public void updateMeasureState(TextPaint p) { + + } + + @Override + public void updateDrawState(TextPaint tp) { + tp.setTextSize(TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_SP, + component.getFontSize(), + tvContent.getContext().getResources().getDisplayMetrics())); + } + }, + start, spannableStringBuilder.length(), + Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + } + spannableStringBuilder.setSpan( + new MetricAffectingSpan() { + @Override + public void updateMeasureState(TextPaint p) { + + } + + @Override + public void updateDrawState(TextPaint tp) { + tp.setFakeBoldText(component.isFontBold()); + } + }, + start, spannableStringBuilder.length(), + Spanned.SPAN_INCLUSIVE_EXCLUSIVE); + } + tvContent.setText(spannableStringBuilder); + } + + } + + + private void handleClick(ClanImMsgInfo info, int second) { + stvAgree.setOnClickListener(v -> handleApply(info, second, 1)); + stvReject.setOnClickListener(v -> handleApply(info, second, 0)); + } + + /** + * + * @param type 1同意,0拒绝 + */ + private void handleApply(ClanImMsgInfo info, int second, int type) { + HallModel.get().dealApplyClan(info.getUrl(), type) + .subscribe(new BeanObserver() { + @Override + public void onErrorMsg(String error) { + SingleToastUtil.showToast(error); + } + + @Override + public void onSuccess(ApplyResult result) { + if (result.getCode() == ApplyResult.CODE_MSG_OUT_OF_DATE) { + info.setType(ClanImMsgInfo.MSG_TYPE_OUT_OF_DATE); + } else if (result.getCode() == ApplyResult.CODE_MSG_HAS_HANDLE) { + info.setType(ClanImMsgInfo.MSG_TYPE_HAS_HANDLE); + } else { + info.setType(type == 1 ? ClanImMsgInfo.MSG_TYPE_HAS_AGREE : + ClanImMsgInfo.MSG_TYPE_HAS_REJECT); + } + setMsgTypeView(info, second); + Map localExtension = ClanImMsgInfo.convertToMap(info); + message.setLocalExtension(localExtension); + updateMessageToLocal(info); + } + }); + } + + private void updateMessageToLocal(ClanImMsgInfo info) { + NimHelper.updateClanMsgInfoMessage(message.getUuid(), info); + } + + private void setMsgTypeView(ClanImMsgInfo info, int second) { + llOpLayout.setVisibility(View.GONE); + if (info.getType() == ClanImMsgInfo.MSG_TYPE_HAS_AGREE) {//已同意 + } else if (info.getType() == ClanImMsgInfo.MSG_TYPE_HAS_REJECT) {//已拒绝 + } else if (info.getType() == ClanImMsgInfo.MSG_TYPE_OUT_OF_DATE) {//已过期 + } else if (info.getType() == ClanImMsgInfo.MSG_TYPE_HAS_HANDLE) {//已处理 + } else { + llOpLayout.setVisibility(View.VISIBLE); + handleClick(info, second); + } + } + +} \ No newline at end of file diff --git a/app/src/module_labour_union/res/layout/layout_clan_msg_view_holder.xml b/app/src/module_labour_union/res/layout/layout_clan_msg_view_holder.xml new file mode 100644 index 000000000..c9fd4697c --- /dev/null +++ b/app/src/module_labour_union/res/layout/layout_clan_msg_view_holder.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachParser.java b/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachParser.java index 9a96f9064..578bb3908 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachParser.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachParser.java @@ -13,6 +13,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHATTER_BOX_ASK; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHATTER_BOX_DROP; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CHATTER_BOX_INIT; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_CLAN; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAGON_BAR; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAW_GIFT_EFFECT; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP; @@ -44,6 +45,8 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SHARE_ROOM; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SHARE_TEAM; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SIGN_IN; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CLANAPPLY; +import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_CLANNORMAL; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_APPLY_EXIT; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_APPLY_JOIN; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_HALL_MANAGER_INVITE; @@ -101,6 +104,7 @@ import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.Mentorin import com.yizhuan.xchat_android_core.miniworld.bean.MWChatMemberCountAttachment; import com.yizhuan.xchat_android_core.miniworld.bean.MWChatTopicAttachment; import com.yizhuan.xchat_android_core.miniworld.bean.OpenAudioPartyAttachment; +import com.yizhuan.xchat_android_core.module_hall.im.ClanAttachment; import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitFriendsAttachment; import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitMeAttachment; import com.yizhuan.xchat_android_core.room.bean.LeaveModeAttachment; @@ -364,6 +368,14 @@ public class CustomAttachParser implements MsgAttachmentParser { break; } + break; + case CUSTOM_MSG_CLAN: + switch (second) { + case CUSTOM_MSG_SUB_CLANAPPLY: + case CUSTOM_MSG_SUB_CLANNORMAL: + attachment = new ClanAttachment(second); + break; + } break; case CUSTOM_MSG_IM_TIP: attachment = new ImTipAttachment(CUSTOM_MSG_IM_TIP, second); diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java b/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java index 38c4a8b60..76847db66 100644 --- a/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java +++ b/core/src/main/java/com/yizhuan/xchat_android_core/im/custom/bean/CustomAttachment.java @@ -188,6 +188,13 @@ public class CustomAttachment implements MsgAttachment { public static final int CUSTOM_MSG_SUB_HALL_MANAGER_INVITE = 322;//管理邀请入厅 public static final int CUSTOM_MSG_SUB_HALL_APPLY_EXIT = 323;//申请退出厅 + /** + * 公会消息 + */ + public static final int CUSTOM_MSG_CLAN = 33;// 家族消息 + public static final int CUSTOM_MSG_SUB_CLANAPPLY = 331;// 申请加入家族 + public static final int CUSTOM_MSG_SUB_CLANNORMAL = 332;// 其他文本消息 + //模厅 public static final int CUSTOM_MSG_SUB_HALL_NOTICE = 324;//模厅通知 public static final int CUSTOM_MSG_SUB_HALL_TO_BE_OWNER = 325;//成为模厅厅主 diff --git a/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/HallModel.java b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/HallModel.java index e92fefc79..9f9fa025d 100644 --- a/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/HallModel.java +++ b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/HallModel.java @@ -111,7 +111,7 @@ public class HallModel extends BaseModel implements IHallModel { } /** - * 审核 + * 模厅审核 */ @Override public Single dealApply(String url, int type) { @@ -119,6 +119,15 @@ public class HallModel extends BaseModel implements IHallModel { .compose(RxHelper.handleCommon(ApplyResult::new)); } + /** + * 公会审核 + */ + @Override + public Single dealApplyClan(String url, int type) { + return api.dealApply(url, type, String.valueOf(AuthModel.get().getCurrentUid())) + .compose(RxHelper.handleCommon(ApplyResult::new)); + } + /** * 获取厅成员 */ diff --git a/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/IHallModel.java b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/IHallModel.java index 35bc57a56..fcb4dac9b 100644 --- a/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/IHallModel.java +++ b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/hall/IHallModel.java @@ -31,10 +31,15 @@ public interface IHallModel { Single applyJoinHall(long hallId); /** - * 审核 + * 模厅审核 */ Single dealApply(String url, int type); + /** + * 公会审核 + */ + Single dealApplyClan(String url, int type); + /** * 获取厅成员 * @param hallId 厅Id diff --git a/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/im/ClanAttachment.java b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/im/ClanAttachment.java new file mode 100644 index 000000000..5ea50b438 --- /dev/null +++ b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/im/ClanAttachment.java @@ -0,0 +1,38 @@ +package com.yizhuan.xchat_android_core.module_hall.im; + +import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment; + +/** + * 公会消息 + * Created by wushaocheng on 2022/11/9. + */ + +public class ClanAttachment extends CustomAttachment { + + private ClanImMsgInfo clanImMsgInfo; + + public ClanAttachment() { + this(CUSTOM_MSG_CLAN); + } + + public ClanAttachment(int second) { + super(CUSTOM_MSG_CLAN, second); + } + + @Override + protected void parseData(JSONObject data) { + clanImMsgInfo = new Gson().fromJson(data.toJSONString(), ClanImMsgInfo.class); + } + + @Override + protected JSONObject packData() { + String jsonStr = new Gson().toJson(clanImMsgInfo); + return JSONObject.parseObject(jsonStr); + } + + public ClanImMsgInfo getClanImMsgInfo() { + return clanImMsgInfo; + } +} diff --git a/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/im/ClanImMsgInfo.java b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/im/ClanImMsgInfo.java new file mode 100644 index 000000000..5f6c60dfe --- /dev/null +++ b/core/src/model_labour_union/java/com/yizhuan/xchat_android_core/module_hall/im/ClanImMsgInfo.java @@ -0,0 +1,69 @@ +package com.yizhuan.xchat_android_core.module_hall.im; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import lombok.Data; + +/** + * Created by lvzebiao on 2019/1/8. + */ +@Data +public class ClanImMsgInfo implements Serializable{ + + /** + * 已过期 + */ + public final static int MSG_TYPE_OUT_OF_DATE = 1; + /** + * 已处理 + */ + public final static int MSG_TYPE_HAS_HANDLE = 2; + /** + * 已同意 + */ + public final static int MSG_TYPE_HAS_AGREE = 3; + /** + * 已拒绝 + */ + public final static int MSG_TYPE_HAS_REJECT = 4; + + private String url; + private int type; + /**后台给的显示内容*/ + private String layout; + /**{@link com.yizhuan.xchat_android_core.im.custom.bean.RouterType}*/ + private int routerType; + + private String routerValue; + + public static Map convertToMap(ClanImMsgInfo info) { + Map localExtension = new HashMap<>(); + localExtension.put("url", info.getUrl()); + localExtension.put("type", info.getType()); + localExtension.put("layout", info.getLayout()); + localExtension.put("routerType", info.getRouterType()); + localExtension.put("routerValue", info.getRouterValue()); + return localExtension; + } + + public static ClanImMsgInfo convertMapToObject(Map localExtension) { + ClanImMsgInfo info = new ClanImMsgInfo(); + if (localExtension != null) { + info.setUrl((String) localExtension.get("url")); + info.setType((Integer) localExtension.get("type")); + info.setLayout((String) localExtension.get("layout")); + Object routerType = localExtension.get("routerType"); + if (routerType != null) { + info.setRouterType((Integer) routerType); + } + Object routerValue = localExtension.get("routerValue"); + if (routerValue != null) { + info.setRouterValue((String) routerValue); + } + } + return info; + } + +}