管理添加

显示管理尾巴
多选转发
This commit is contained in:
guozhen
2025-02-06 17:36:44 +08:00
committed by xuhuixiang
parent 9d1e398c58
commit 425bc1475e
39 changed files with 594 additions and 186 deletions

View File

@@ -246,7 +246,14 @@ public class ChatUtils {
.withContext(context)
.navigate(launcher);
}
public static void startTeamListByZhuanFa(
Context context, String pagePath, ActivityResultLauncher<Intent> launcher) {
XKitRouter.withKey(pagePath)
.withParam(RouterConstant.KEY_TEAM_LIST_SELECT, true)
.withParam("zhuanfa",true)
.withContext(context)
.navigate(launcher);
}
public static void startP2PSelector(
Context context, String pagePath, String filterId, ActivityResultLauncher<Intent> launcher) {
ArrayList<String> filterList = new ArrayList<>();

View File

@@ -49,7 +49,7 @@ public class ChatMessageForwardConfirmDialog extends BaseDialog {
boolean showInput;
int forwardType;
ArrayList<String> listsession;
public static ChatMessageForwardConfirmDialog createForwardConfirmDialog(
SessionTypeEnum type,
ArrayList<String> sessionIds,
@@ -97,7 +97,7 @@ public class ChatMessageForwardConfirmDialog extends BaseDialog {
// String action= getArguments().getString(FORWARD_ACTION, ActionConstants.POP_ACTION_TRANSMIT);
//adapter.setForwardType(getArguments().getInt(FORWARD_TYPE));
// adapter.append(getArguments().getStringArrayList(FORWARD_SESSION_LIST));
ArrayList<String> listsession = getArguments().getStringArrayList(FORWARD_SESSION_LIST);
listsession = getArguments().getStringArrayList(FORWARD_SESSION_LIST);
setData(listsession.get(0));
// String sendUser = getArguments().getString(FORWARD_MESSAGE_SEND); //发送人的名字
@@ -182,6 +182,11 @@ public class ChatMessageForwardConfirmDialog extends BaseDialog {
binding.avatar.setData(avatar, "");
}
binding.tvNickname.setText(nickname);
if(listsession!=null&&listsession.size()>1){
binding.tvTitle.setText(String.format(getString(R.string.chat_message_forward_to2),nickname+"",listsession.size()));
}
}
}
@@ -196,6 +201,10 @@ public class ChatMessageForwardConfirmDialog extends BaseDialog {
binding.avatar.setData(avatar, "");
}
binding.tvNickname.setText(nickname + "");
if(listsession!=null&&listsession.size()>1){
binding.tvTitle.setText(String.format(getString(R.string.chat_message_forward_to1),nickname+"",listsession.size()));
}
}
public void setCallback(ForwardCallback callback) {

View File

@@ -83,8 +83,8 @@ public class FunChatPinActivity extends ChatPinBaseActivity {
new ChatBaseForwardSelectDialog.ForwardTypeSelectedCallback() {
@Override
public void onTeamSelected() {
ChatUtils.startTeamList(
FunChatPinActivity.this, RouterConstant.PATH_FUN_MY_TEAM_PAGE, forwardTeamLauncher);
ChatUtils.startTeamListByZhuanFa(
FunChatPinActivity.this, RouterConstant.PATH_FUN_MY_TEAM_PAGE, forwardTeamLauncher1);
}
@Override

View File

@@ -477,8 +477,8 @@ public abstract class FunChatFragment extends ChatBaseFragment {
@Override
protected void forwardTeam() {
ChatUtils.startTeamList(
getContext(), RouterConstant.PATH_FUN_MY_TEAM_PAGE, forwardTeamLauncher);
ChatUtils.startTeamListByZhuanFa(
getContext(), RouterConstant.PATH_FUN_MY_TEAM_PAGE, forwardTeamLauncher1);
}

View File

@@ -49,12 +49,12 @@ public interface ApiService {
/**
* 正式环境
*/
String URL = "https://api.letschat2023.com/";
// String URL = "https://api.letschat2023.com/";
/**
* 测试环境
*/
// String URL = "https://api-test.letschat2023.com/";
String URL = "https://api-test.letschat2023.com/";
// String URL = "https://8.217.244.135:8001/";

View File

@@ -58,6 +58,7 @@ public abstract class ChatPinBaseActivity extends BaseActivity {
protected ActivityResultLauncher<Intent> forwardP2PLauncher;
protected ActivityResultLauncher<Intent> forwardTeamLauncher;
protected ActivityResultLauncher<Intent> forwardTeamLauncher1;
public static final String ACTION_CHECK_PIN = "check_pin";
public static final String ACTION_CANCEL_PIN = "cancel_pin";
@@ -163,6 +164,25 @@ public abstract class ChatPinBaseActivity extends BaseActivity {
}
});
forwardTeamLauncher1 =
registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() != Activity.RESULT_OK || forwardMessage == null) {
return;
}
ALog.d(LIB_TAG, TAG, "forward Team result");
Intent data = result.getData();
if (data != null) {
ArrayList<String> friends =
data.getStringArrayListExtra(REQUEST_CONTACT_SELECTOR_KEY);
if (friends != null && !friends.isEmpty()) {
showForwardConfirmDialog(SessionTypeEnum.Team, friends);
}
}
});
if (TextUtils.isEmpty(mSessionId) || mSessionType == SessionTypeEnum.None) {
showEmptyView(true);
} else {

View File

@@ -63,6 +63,7 @@ import com.luck.picture.lib.style.SelectMainStyle;
import com.luck.picture.lib.style.TitleBarStyle;
import com.netease.nim.highavailable.LogUtils;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.StatusCode;
import com.netease.nimlib.sdk.auth.AuthServiceObserver;
import com.netease.nimlib.sdk.friend.FriendService;
@@ -79,7 +80,10 @@ import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.netease.nimlib.sdk.msg.model.MsgPinOption;
import com.netease.nimlib.sdk.msg.model.QueryDirectionEnum;
import com.netease.nimlib.sdk.msg.model.RecentContact;
import com.netease.nimlib.sdk.team.TeamService;
import com.netease.nimlib.sdk.team.constant.TeamMemberType;
import com.netease.nimlib.sdk.team.model.Team;
import com.netease.nimlib.sdk.team.model.TeamMember;
import com.netease.nimlib.sdk.uinfo.UserService;
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.netease.yunxin.kit.alog.ALog;
@@ -225,6 +229,7 @@ public abstract class ChatBaseFragment extends BaseFragment {
protected ActivityResultLauncher<Intent> forwardP2PLauncher;
protected ActivityResultLauncher<Intent> forwardTeamLauncher;
protected ActivityResultLauncher<Intent> forwardTeamLauncher1;
protected ActivityResultLauncher<String[]> permissionLauncher;
@@ -1646,6 +1651,38 @@ public abstract class ChatBaseFragment extends BaseFragment {
&& isAllowAd == 0
&& teamInfo != null && !teamInfo.getCreator().equals(IMKitClient.account())
&& !teamInfo.getCreator().equals(messageBean.getMessageData().getMessage().getFromAccount())) {
NIMClient.getService(TeamService.class).queryTeamMember(teamInfo.getId(), messageBean.getMessageData().getMessage().getFromAccount()).setCallback(new RequestCallback<TeamMember>() {
@Override
public void onSuccess(TeamMember members) {
if(members!=null){
if(members.getType() == TeamMemberType.Manager){
XKitRouter.withKey(getUserInfoRoutePath())
.withContext(view.getContext())
.withParam(
"uid",
messageBean.getMessageData().getMessage().getFromAccount())
.withParam("userId", messageBean.getMessageData().getMessage().getFromAccount())
.withParam("isGroup", (sessionType == SessionTypeEnum.Team || sessionType == SessionTypeEnum.SUPER_TEAM))
.withParam("teamId", (sessionType == SessionTypeEnum.Team || sessionType == SessionTypeEnum.SUPER_TEAM) ? messageBean.getMessageData().getMessage().getSessionId() : "")
.navigate();
}
}
}
@Override
public void onFailed(int code) {
// 撤销群管理员失败
}
@Override
public void onException(Throwable exception) {
// 错误
}
});
return false;
}
XKitRouter.withKey(getUserInfoRoutePath())
@@ -1965,6 +2002,7 @@ public abstract class ChatBaseFragment extends BaseFragment {
&& isAllowAd == 0
&& teamInfo != null && !teamInfo.getCreator().equals(IMKitClient.account())
&& !teamInfo.getCreator().equals(businessShareBean.data.getAccout())) {
return;
}
XKitRouter.withKey(RouterConstant.PATH_USER_INFO_PAGE)
@@ -2450,6 +2488,13 @@ public abstract class ChatBaseFragment extends BaseFragment {
new ActivityResultContracts.StartActivityForResult(),
result -> onForwardMessage(result, SessionTypeEnum.Team));
forwardTeamLauncher1 =
registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> onForwardMessage1(result, SessionTypeEnum.Team));
locationLauncher =
registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(), this::onSelectLocation);
@@ -2680,6 +2725,23 @@ public abstract class ChatBaseFragment extends BaseFragment {
}
}
protected void onForwardMessage1(ActivityResult result, SessionTypeEnum sessionType) {
if (result.getResultCode() != Activity.RESULT_OK) {
return;
}
ALog.d(LIB_TAG, LOG_TAG, "forward Team result");
Intent data = result.getData();
if (data != null) {
ArrayList<String> sessionList = new ArrayList<>();
sessionList.addAll(data.getStringArrayListExtra(REQUEST_CONTACT_SELECTOR_KEY));
if (sessionList.size() > 0) {
showForwardConfirmDialog(sessionType, sessionList);
}
}
}
protected void clearMessageMultiSelectStatus() {
chatView.showMultiSelect(false);
ChatMsgCache.clear();

View File

@@ -323,5 +323,7 @@
<string name="push_content_location">Received a location</string>
<string name="push_content_file">Received a file</string>
<string name="push_content_audio">Received an audio</string>
<string name="chat_message_forward_to1">Forward to %s and other %d people</string>
<string name="chat_message_forward_to2">Forward to %s and other %d group</string>
</resources>

View File

@@ -324,5 +324,7 @@
<string name="push_content_location">位置情報が届きました</string>
<string name="push_content_file">ファイルが届きました</string>
<string name="push_content_audio">音声が届きました</string>
<string name="chat_message_forward_to1">轉發給:%s等%d人</string>
<string name="chat_message_forward_to2">轉發給:%s等%d群</string>
</resources>

View File

@@ -324,4 +324,7 @@
<string name="push_content_location">发来了一个地理位置</string>
<string name="push_content_file">发来了一个文件</string>
<string name="push_content_audio">发来了一段语音</string>
<string name="chat_message_forward_to1">转发给:%s等%d人</string>
<string name="chat_message_forward_to2">转发给:%s等%d群</string>
</resources>

View File

@@ -323,4 +323,6 @@
<string name="push_content_location">發來了一個地理位置</string>
<string name="push_content_file">發來了一個文件</string>
<string name="push_content_audio">發來了一段語音</string>
<string name="chat_message_forward_to1">轉發給:%s等%d人</string>
<string name="chat_message_forward_to2">轉發給:%s等%d群</string>
</resources>