加入公会申请逻辑
This commit is contained in:
@@ -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);
|
||||
//瓜分钻石 三级
|
||||
|
@@ -371,7 +371,6 @@ public class ModuleHallActivity extends BaseMvpActivity<IModuleHallView, ModuleH
|
||||
|
||||
private void moreOption(List<AuthInfo> authInfoList) {
|
||||
if (authInfoList != null && authInfoList.size() > 0) {
|
||||
|
||||
List<ButtonItem> list_adapter = new ArrayList<>();
|
||||
for (AuthInfo authInfo : authInfoList) {
|
||||
if (authInfo.getCode().equals(AuthInfo.AUTH_APPLY_HALL_EXIT)) {
|
||||
|
@@ -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<String, Object> localExtension = ClanImMsgInfo.convertToMap(info);
|
||||
message.setLocalExtension(localExtension);
|
||||
NIMClient.getService(MsgService.class)
|
||||
.updateIMMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**云信sdk获取群信息*/
|
||||
public static <E> Single<Team> getTeamById(LifecycleProvider<E> provider, String tid) {
|
||||
if (TextUtils.isEmpty(tid)) {
|
||||
|
@@ -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<HallMsgComponent> 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<ApplyResult>() {
|
||||
@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<String, Object> 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/cl_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:paddingStart="@dimen/dp_20"
|
||||
android:paddingEnd="@dimen/dp_20"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/layout_layout_hall_msg_view_holder_01" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:paddingStart="@dimen/dp_30"
|
||||
android:paddingEnd="@dimen/dp_30"
|
||||
android:gravity="center"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title"
|
||||
tools:text="@string/layout_layout_hall_msg_view_holder_02" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_space"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_17" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_op_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_space">
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/stv_reject"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/lu_reject"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:corner="@dimen/dp_4"
|
||||
app:solid="@color/color_E6E6F0" />
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/stv_agree"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="24dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/lu_agree"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:corner="@dimen/dp_4"
|
||||
app:shaderMode="leftToRight"
|
||||
app:shaderEnable="true"
|
||||
app:shaderStartColor="@color/color_13E2F5"
|
||||
app:shaderEndColor="@color/color_CC66FF"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -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);
|
||||
|
@@ -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;//成为模厅厅主
|
||||
|
@@ -111,7 +111,7 @@ public class HallModel extends BaseModel implements IHallModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
* 模厅审核
|
||||
*/
|
||||
@Override
|
||||
public Single<ApplyResult> dealApply(String url, int type) {
|
||||
@@ -119,6 +119,15 @@ public class HallModel extends BaseModel implements IHallModel {
|
||||
.compose(RxHelper.handleCommon(ApplyResult::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公会审核
|
||||
*/
|
||||
@Override
|
||||
public Single<ApplyResult> dealApplyClan(String url, int type) {
|
||||
return api.dealApply(url, type, String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.compose(RxHelper.handleCommon(ApplyResult::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取厅成员
|
||||
*/
|
||||
|
@@ -31,10 +31,15 @@ public interface IHallModel {
|
||||
Single<String> applyJoinHall(long hallId);
|
||||
|
||||
/**
|
||||
* 审核
|
||||
* 模厅审核
|
||||
*/
|
||||
Single<ApplyResult> dealApply(String url, int type);
|
||||
|
||||
/**
|
||||
* 公会审核
|
||||
*/
|
||||
Single<ApplyResult> dealApplyClan(String url, int type);
|
||||
|
||||
/**
|
||||
* 获取厅成员
|
||||
* @param hallId 厅Id
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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<String, Object> convertToMap(ClanImMsgInfo info) {
|
||||
Map<String, Object> 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<String, Object> 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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user