2 Revize 160e9e59f4 ... de650569f1

Autor SHA1 Zpráva Datum
  Pq de650569f1 增加群设置页面-拒绝接收群成员私聊功能 před 2 měsíci
  Pq 779f58dae4 增加发送消息提示黑名单流程(UI提示待补充) před 2 měsíci

+ 3 - 0
TUIKit/TIMCommon/timcommon/src/main/java/com/tencent/qcloud/tuikit/timcommon/component/MessageProperties.java

@@ -1,5 +1,6 @@
 package com.tencent.qcloud.tuikit.timcommon.component;
 
+import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.widget.EditText;
 
@@ -285,5 +286,7 @@ public class MessageProperties implements IMessageProperties {
     public interface OnEventListener {
         boolean onMessageClick(TUIMessageBean messageBean);
         boolean onAvatarClick(TUIMessageBean messageBean);
+
+        boolean onParseError(Context context,String module, int errCode, String errMsg);
     }
 }

+ 5 - 0
TUIKit/TUIChat/tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/classicui/widget/ChatView.java

@@ -34,6 +34,7 @@ import com.tencent.qcloud.tuicore.TUICore;
 import com.tencent.qcloud.tuicore.TUIThemeManager;
 import com.tencent.qcloud.tuicore.util.ToastUtil;
 import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
+import com.tencent.qcloud.tuikit.timcommon.component.MessageProperties;
 import com.tencent.qcloud.tuikit.timcommon.component.TitleBarLayout;
 import com.tencent.qcloud.tuikit.timcommon.component.UnreadCountTextView;
 import com.tencent.qcloud.tuikit.timcommon.component.dialog.TUIKitDialog;
@@ -1157,6 +1158,10 @@ public class ChatView extends LinearLayout implements IChatLayout {
                             + getResources().getString(com.tencent.qcloud.tuicore.R.string.TUIKitErrorUnsupporInterfaceSuffix);
                     }
                 }
+                MessageProperties.OnEventListener eventListener = MessageProperties.getInstance().getEventListener();
+                if (eventListener != null && eventListener.onParseError(getContext(),module,errCode,errMsg)) {
+                    return;
+                }
                 ToastUtil.toastLongMessage(toastMsg);
             }
 

+ 9 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/api/IMApi.java

@@ -212,4 +212,13 @@ public interface IMApi {
      */
     @POST("{group_name}" + "/imGroup/updateIntroduce")
     Observable<BaseResponse<Object>> updateGroupIntroduce(@Body RequestBody body,@Path("group_name")String group_name);
+
+    /**
+     * 设置是否可以通过群成员单聊
+     *
+     * @return
+     */
+    @GET("{group_name}" + "/imGroupMember/allowPrivateChat")
+    Observable<BaseResponse<Object>> setSingleChatMode(@Path("group_name") String group_name,@Query("groupId") String groupId,@Query("allowPrivateChatFlag") boolean flag);
+
 }

+ 13 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/bean/IMGroupInfo.java

@@ -39,6 +39,18 @@ public class IMGroupInfo {
     private String createTime;
     private String configJson;
     private int groupMemberLimit;
+    private Boolean allowPrivateChatFlag;
+
+    public boolean isAllowPrivateChatFlag() {
+        if (allowPrivateChatFlag == null) {
+            return false;
+        }
+        return allowPrivateChatFlag;
+    }
+
+    public void setAllowPrivateChatFlag(boolean allowPrivateChatFlag) {
+        this.allowPrivateChatFlag = allowPrivateChatFlag;
+    }
 
     public int getGroupMemberLimit() {
         return groupMemberLimit;
@@ -47,6 +59,7 @@ public class IMGroupInfo {
     public void setGroupMemberLimit(int groupMemberLimit) {
         this.groupMemberLimit = groupMemberLimit;
     }
+
     public String getConfigJson() {
         return configJson;
     }

+ 15 - 1
chatModule/src/main/java/com/cooleshow/chatmodule/presenter/ChatGroupSettingPresenter.java

@@ -58,7 +58,7 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
 
             @Override
             public void onError(String module, int errCode, String errMsg) {
-                Log.i("pq","loadGroupInfo onError:"+"module="+module+"errCode:"+errCode+"errMsg:"+errMsg);
+                Log.i("pq", "loadGroupInfo onError:" + "module=" + module + "errCode:" + errCode + "errMsg:" + errMsg);
                 if (getView() != null) {
                     getView().getGroupInfoError();
                 }
@@ -275,4 +275,18 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
             }
         });
     }
+
+    public void setSingleChatMode(String targetId, boolean isChecked) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        addSubscribe(create(IMApi.class).setSingleChatMode(BaseConstant.CLIENT_API_GROUP_NAME, targetId, isChecked), new BaseObserver<Object>(getView()) {
+            @Override
+            protected void onSuccess(Object data) {
+                if (getView() != null) {
+//                    getView().setSingleChatModeSuccess();
+                }
+            }
+        });
+    }
 }

+ 14 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/ui/ChatFragment.java

@@ -1,5 +1,6 @@
 package com.cooleshow.chatmodule.ui;
 
+import android.content.Context;
 import android.graphics.Typeface;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -20,8 +21,10 @@ import com.cooleshow.chatmodule.databinding.TcFragmentChatLayoutBinding;
 import com.cooleshow.chatmodule.manager.IMCenter;
 import com.cooleshow.chatmodule.utils.helper.ChatAvatarClickHelper;
 import com.cooleshow.chatmodule.utils.helper.IMThemManager;
+import com.cooleshow.chatmodule.widget.CommonConfirmDialog2;
 import com.google.android.material.tabs.TabLayout;
 import com.google.android.material.tabs.TabLayoutMediator;
+import com.tencent.imsdk.BaseConstants;
 import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
 import com.tencent.qcloud.tuikit.timcommon.component.MessageProperties;
 
@@ -111,6 +114,17 @@ public class ChatFragment extends BaseFragment<TcFragmentChatLayoutBinding> impl
                 }
                 return false;
             }
+
+            @Override
+            public boolean onParseError(Context context, String module, int errCode, String errMsg) {
+                if(errCode == BaseConstants.ERR_SVR_MSG_IN_PEER_BLACKLIST){
+                    //黑名单
+                    CommonConfirmDialog2 commonConfirmDialog2 =new CommonConfirmDialog2(context);
+                    commonConfirmDialog2.show();
+                    return true;
+                }
+                return false;
+            }
         });
     }
 

+ 14 - 0
chatModule/src/main/java/com/cooleshow/chatmodule/ui/ChatGroupSettingActivity.java

@@ -243,6 +243,7 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<TcActivityChatGrou
         viewBinding.llGroupIntroduce.setOnClickListener(this);
 
         IMThemManager.getInstance().setCheckButtonDrawable(viewBinding.cbMessage);
+        IMThemManager.getInstance().setCheckButtonDrawable(viewBinding.cbRefuseSingleChat);
         IMThemManager.getInstance().setMainButtonStyles(viewBinding.btnConfirm);
 
         if (BaseApplication.Companion.isTeacherClient()) {
@@ -290,6 +291,17 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<TcActivityChatGrou
         presenter.loadGroup(targetId);
 //        presenter.conversationGet(Conversation.ConversationType.GROUP, targetId);
 
+        viewBinding.cbRefuseSingleChat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                if (buttonView.isPressed()) {
+                    if (presenter != null) {
+                        presenter.setSingleChatMode(targetId, !isChecked);
+                    }
+                }
+            }
+        });
+
         cb_message.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
             @Override
             public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@@ -441,6 +453,8 @@ public class ChatGroupSettingActivity extends BaseMVPActivity<TcActivityChatGrou
                 viewBinding.cbMute.setChecked(false);
             }
 
+            viewBinding.cbRefuseSingleChat.setChecked(!data.isAllowPrivateChatFlag());
+
             checkTeacherCanAddMember(data.getType());
 
             presenter.queryGroupMembers(targetId);

+ 16 - 1
chatModule/src/main/res/layout/tc_activity_chat_group_setting.xml

@@ -363,7 +363,22 @@
                 android:drawableEnd="@drawable/tc_switch_selector"
                 android:paddingStart="@dimen/dp_13"
                 android:paddingEnd="@dimen/dp_15"
-                android:text="消息接收但不提醒"
+                android:text="群消息接收但不提醒"
+                android:textColor="@color/color_333333"
+                android:textSize="@dimen/sp_16" />
+
+            <CheckBox
+                android:id="@+id/cb_refuse_single_chat"
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/dp_50"
+                android:layout_marginTop="@dimen/dp_15"
+                android:background="@color/white"
+                android:button="@null"
+                android:checked="false"
+                android:drawableEnd="@drawable/tc_switch_selector"
+                android:paddingStart="@dimen/dp_13"
+                android:paddingEnd="@dimen/dp_15"
+                android:text="拒绝接收群成员私聊"
                 android:textColor="@color/color_333333"
                 android:textSize="@dimen/sp_16" />
 

+ 1 - 1
chatModule/src/main/res/layout/tc_fragment_contact_list_layout.xml

@@ -63,7 +63,7 @@
         android:includeFontPadding="false"
         android:theme="@style/MyEditText"
         android:textCursorDrawable="@drawable/shape_2dc7aa_1dp"
-        android:textColor="@color/color_999999"
+        android:textColor="@color/color_aaaaaa"
         android:textSize="@dimen/sp_14"
         app:layout_constraintBottom_toBottomOf="@+id/view_search_bg"
         app:layout_constraintLeft_toRightOf="@+id/iv_search_icon"

+ 1 - 1
chatModule/src/main/res/layout/tc_fragment_contact_room_list.xml

@@ -39,7 +39,7 @@
         android:hint="请输入群聊/学员名称"
         android:maxLines="1"
         android:paddingStart="8dp"
-        android:textColor="@color/color_999999"
+        android:textColor="@color/color_aaaaaa"
         android:textSize="@dimen/sp_14"
         android:theme="@style/MyEditText"
         app:layout_constraintBottom_toBottomOf="@+id/view_search_bg"

+ 1 - 1
chatModule/src/main/res/layout/tc_fragment_conversation_list_layout.xml

@@ -36,7 +36,7 @@
         android:paddingStart="8dp"
         android:text="查找聊天记录"
         android:includeFontPadding="false"
-        android:textColor="@color/color_999999"
+        android:textColor="@color/color_aaaaaa"
         android:textSize="@dimen/sp_14"
         app:layout_constraintBottom_toBottomOf="@+id/view_search_bg"
         app:layout_constraintLeft_toRightOf="@+id/iv_search_icon"