修改群内是否允许添加好友
This commit is contained in:
@@ -47,8 +47,8 @@ android {
|
||||
applicationId = "com.dskj.rbchat"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 195
|
||||
versionName = "1.9.5"
|
||||
versionCode = 196
|
||||
versionName = "1.9.6"
|
||||
multiDexEnabled = true
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
manifestPlaceholders["IMAPPKEY"] = "c38c8bbebf7d12992d2a361bfceb6c6f" //正式
|
||||
@@ -126,8 +126,8 @@ android {
|
||||
"\"AIzaSyB7P1o1EIA02eWoNP_7QJ9XwWe3WkSZb9k\""
|
||||
)
|
||||
//测试APPKEY
|
||||
// manifestPlaceholders["IMAPPKEY"] = "4cb6b0998f9e7af9d7673963e429959a"
|
||||
manifestPlaceholders["IMAPPKEY"] = "c38c8bbebf7d12992d2a361bfceb6c6f"
|
||||
manifestPlaceholders["IMAPPKEY"] = "4cb6b0998f9e7af9d7673963e429959a"
|
||||
// manifestPlaceholders["IMAPPKEY"] = "c38c8bbebf7d12992d2a361bfceb6c6f"
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ContactGroupSettingActivity extends FunBaseSelectorDataActivity imp
|
||||
FunContactSelectorSettingActivityBinding binding;
|
||||
protected FunContactMembersAdapter membersAdapter;
|
||||
protected boolean isChecked = true;
|
||||
protected boolean isAllow = true;
|
||||
protected boolean isAllow = false;
|
||||
protected ArrayList<String> listkey;
|
||||
protected ArrayList<String> listname;
|
||||
protected ArrayList<String> listavat;
|
||||
|
||||
@@ -118,10 +118,10 @@ public class TeamMembersListActivity extends BaseTeamQrSettingActivity {
|
||||
if (!TextUtils.isEmpty(teamInfo.getExtension())) {
|
||||
extensionBean = GsonUtils.getObjFromJSON(teamInfo.getExtension(), TeamExtensionBean.class);
|
||||
if (extensionBean == null) {
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(teamInfo.getExtension()), 1);
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(teamInfo.getExtension()), 0);
|
||||
}
|
||||
} else {
|
||||
extensionBean = new TeamExtensionBean(1, 1);
|
||||
extensionBean = new TeamExtensionBean(1, 0);
|
||||
}
|
||||
isAllowAdd = extensionBean.getAllowAddFriends();
|
||||
}
|
||||
|
||||
@@ -173,14 +173,15 @@ public class TeamOtherSettingActivity extends BaseSettingOtherActivity {
|
||||
if (!TextUtils.isEmpty(extension)) {
|
||||
extensionBean = GsonUtils.getObjFromJSON(extension, TeamExtensionBean.class);
|
||||
if (extensionBean == null) {
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(extension), 1);
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(extension), 0);
|
||||
}
|
||||
binding.swichTeamqr.setChecked(extensionBean.getShowQrCode() == 1);
|
||||
} else {
|
||||
extensionBean = new TeamExtensionBean(1, 1);
|
||||
extensionBean = new TeamExtensionBean(1, 0);
|
||||
}
|
||||
binding.swichTeamqr.setChecked(extensionBean.getShowQrCode() == 1);
|
||||
binding.swichTeamallowaddfriends.setChecked(extensionBean.getAllowAddFriends() == 1);
|
||||
binding.swichAddtype.setChecked(team.getTeamBeInviteMode().getValue() == 1);
|
||||
binding.tvTeamallowaddfriends.setText(extensionBean.getAllowAddFriends() == 1 ? getString(R.string.teamsetting_other_teamallow) : getString(R.string.teamsetting_other_teamallow_not));
|
||||
// binding.tvTeamallowaddfriends.setText(extensionBean.getAllowAddFriends() == 1 ? getString(R.string.teamsetting_other_teamallow) : getString(R.string.teamsetting_other_teamallow_not));
|
||||
Map<TeamFieldEnum, Serializable> map = new HashMap<>();
|
||||
binding.swichTeamqr.setOnClickListener(view -> {
|
||||
//onclick check 变更
|
||||
@@ -189,6 +190,11 @@ public class TeamOtherSettingActivity extends BaseSettingOtherActivity {
|
||||
map.put(TeamFieldEnum.Extension, GsonUtils.beanToJSONString(extensionBean));
|
||||
teammodel.UpdateTeamFilesExtension(team.getId(), map);
|
||||
});
|
||||
binding.swichTeamallowaddfriends.setOnClickListener(v -> {
|
||||
extensionBean.setAllowAddFriends(binding.swichTeamallowaddfriends.isChecked() ? 1 : 0);
|
||||
map.put(TeamFieldEnum.Extension, GsonUtils.beanToJSONString(extensionBean));
|
||||
teammodel.UpdateTeamFilesExtension(team.getId(), map);
|
||||
});
|
||||
|
||||
binding.swichAddtype.setOnClickListener(view -> {
|
||||
map.put(TeamFieldEnum.BeInviteMode, binding.swichAddtype.isChecked() ? TeamBeInviteModeEnum.NoAuth : TeamBeInviteModeEnum.NeedAuth);
|
||||
|
||||
@@ -346,10 +346,10 @@ public class TeamSettingActivity extends BaseTeamQrSettingActivity {
|
||||
if (!TextUtils.isEmpty(teamInfo.getExtension())) {
|
||||
extensionBean = GsonUtils.getObjFromJSON(teamInfo.getExtension(), TeamExtensionBean.class);
|
||||
if (extensionBean == null) {
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(teamInfo.getExtension()), 1);
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(teamInfo.getExtension()), 0);
|
||||
}
|
||||
} else {
|
||||
extensionBean = new TeamExtensionBean(1, 1);
|
||||
extensionBean = new TeamExtensionBean(1, 0);
|
||||
}
|
||||
isTeamShow = (extensionBean.getShowQrCode() == 1);
|
||||
// if (!TextUtils.isEmpty(teamInfo.getExtension()) && teamInfo.getExtension().equals("0")) {
|
||||
|
||||
@@ -650,9 +650,6 @@ public class MainActivity extends BaseActivity {
|
||||
ALog.d(Constant.PROJECT_TAG, "MainActivity:initView");
|
||||
loadConfig();
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
shareDateUtils = new ShareDateUtils();
|
||||
shareDateUtils.getAllSessionList();
|
||||
shareDateUtils.getLocFriends();
|
||||
// index2Fragment = new HomeFragment();
|
||||
chatTabFragment = new ChatTabFragment();
|
||||
// voomFragment = new VoomFragment();
|
||||
@@ -671,6 +668,9 @@ public class MainActivity extends BaseActivity {
|
||||
mCurrentTab = activityMainBinding.contactBtnGroup;
|
||||
resetTabSkin(isCommonSkin);
|
||||
checkZhiWen();
|
||||
shareDateUtils = new ShareDateUtils();
|
||||
shareDateUtils.getAllSessionList();
|
||||
shareDateUtils.getLocFriends();
|
||||
}
|
||||
|
||||
private void checkZhiWen() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.dskj.rbchat.databinding.FragmentChatconversationBinding;
|
||||
import com.dskj.rbchat.event.ConversationEditEvent;
|
||||
import com.dskj.rbchat.main.MainActivity;
|
||||
import com.dskj.rbchat.model.NotifyCountBean;
|
||||
import com.dskj.rbchat.model.TeamUpdateEvent;
|
||||
import com.dskj.rbchat.network.Api;
|
||||
import com.dskj.rbchat.network.BaseObserver;
|
||||
import com.dskj.rbchat.network.Result;
|
||||
@@ -51,6 +52,7 @@ import com.netease.yunxin.kit.alog.ALog;
|
||||
import com.netease.yunxin.kit.chatkit.model.ConversationInfo;
|
||||
import com.netease.yunxin.kit.chatkit.model.UserInfoWithTeam;
|
||||
import com.netease.yunxin.kit.chatkit.repo.ContactRepo;
|
||||
import com.netease.yunxin.kit.chatkit.repo.ConversationRepo;
|
||||
import com.netease.yunxin.kit.chatkit.ui.ChatUIConstants;
|
||||
import com.netease.yunxin.kit.chatkit.ui.data.ChatDatabase;
|
||||
import com.netease.yunxin.kit.chatkit.ui.data.dao.ChatDraftDataDao;
|
||||
@@ -77,6 +79,7 @@ import com.netease.yunxin.kit.corekit.im.IMKitClient;
|
||||
import com.netease.yunxin.kit.corekit.im.model.FriendInfo;
|
||||
import com.netease.yunxin.kit.corekit.im.model.UserInfo;
|
||||
import com.netease.yunxin.kit.corekit.route.XKitRouter;
|
||||
import com.netease.yunxin.kit.teamkit.ui.utils.viewmodel.TeamSettingViewModel;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -121,7 +124,7 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
private Observer<FetchResult<List<String>>> aitObserver;
|
||||
private Observer<FetchResult<Integer>> unreadCountObserver;
|
||||
private ChatDraftDataDao dataDao;
|
||||
|
||||
// public final TeamSettingViewModel teammodel = new TeamSettingViewModel();
|
||||
|
||||
protected final EventNotify<ChangeChatDraftEvent> changeDraftEvent =
|
||||
new EventNotify<ChangeChatDraftEvent>() {
|
||||
@@ -269,6 +272,18 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
|
||||
private void queryTeamInfo() {
|
||||
for (String groupId : groupIds) {
|
||||
// teammodel
|
||||
// .getTeamWithMemberData()
|
||||
// .observe(
|
||||
// this,
|
||||
// teamResultInfo -> {
|
||||
// if (teamResultInfo.getValue() == null || !teamResultInfo.getSuccess()) {
|
||||
// return;
|
||||
// }
|
||||
// Team team = teamResultInfo.getValue().getTeam();
|
||||
// addShiJieConversation(team);
|
||||
// });
|
||||
// teammodel.requestTeamData(groupId);
|
||||
NIMClient.getService(TeamService.class).searchTeam(groupId).setCallback(new RequestCallback<Team>() {
|
||||
@Override
|
||||
public void onSuccess(Team result) {
|
||||
@@ -314,8 +329,9 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
conversationBean.isShiJie = true;
|
||||
conversationBean.infoData.setTeamInfo(team);
|
||||
conversationBean.infoData.setStickTop(true);
|
||||
List<ConversationBean> list = new ArrayList<>();
|
||||
|
||||
if (conversationType == 0) {
|
||||
List<ConversationBean> list = new ArrayList<>();
|
||||
boolean isAdd = false;
|
||||
for (ConversationBean conversationBean1 : conversationViewTop.getAdatper().getConversationList()) {
|
||||
Team team1 = conversationBean1.infoData.getTeamInfo();
|
||||
@@ -329,11 +345,18 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
}
|
||||
if (!isAdd) {
|
||||
list.add(conversationBean);
|
||||
conversationViewTop.addData(list);
|
||||
conversationViewTop.addStickTop(team.getId());
|
||||
if (conversationViewTop.getAdatper().getConversationList().size() == 0) {
|
||||
conversationViewTop.addStickTop(team.getId());
|
||||
conversationViewTop.setData(list);
|
||||
} else {
|
||||
conversationViewTop.addData(list);
|
||||
conversationViewTop.addStickTop(team.getId());
|
||||
}
|
||||
// Collections.sort(conversationViewTop.getAdatper().getConversationList(), conversationShiJieComparator);
|
||||
// conversationViewTop.setData(conversationViewTop.getAdatper().getConversationList());
|
||||
}
|
||||
} else if (conversationType == 2) {
|
||||
|
||||
} else if (conversationType == 2) {
|
||||
ConversationBean conversationBeanItem = null;
|
||||
|
||||
for (ConversationBean conversationBean1 : conversationViewTop.getAdatper().getConversationList()) {
|
||||
@@ -361,6 +384,7 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
for (ConversationBean conversationBean1 : conversationViewShiJie.getAdatper().getConversationList()) {
|
||||
if (conversationBean1.infoData.getContactId().equals(team.getId())) {
|
||||
conversationBean1.infoData.setStickTop(true);
|
||||
conversationBean1.infoData.setTeamInfo(team);
|
||||
conversationBean1.isShiJie = true;
|
||||
isAdd = true;
|
||||
break;
|
||||
@@ -368,15 +392,16 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
}
|
||||
if (!isAdd) {
|
||||
if (conversationBeanItem != null) {
|
||||
list.add(conversationBeanItem);
|
||||
listGuanfangTeam.add(conversationBeanItem);
|
||||
} else {
|
||||
list.add(conversationBean); //有时候这个创建的空会话数据不全
|
||||
listGuanfangTeam.add(conversationBean); //有时候这个创建的空会话数据不全
|
||||
}
|
||||
conversationViewShiJie.addData(list);
|
||||
conversationViewShiJie.addStickTop(team.getId());
|
||||
conversationViewShiJie.addData(listGuanfangTeam);
|
||||
}
|
||||
|
||||
}
|
||||
doEmptyView();
|
||||
|
||||
|
||||
}
|
||||
@@ -460,6 +485,7 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
return;
|
||||
}
|
||||
getServicesData();
|
||||
LogUtils.d("shijie", "changeObserver==" + changeObserver);
|
||||
setUpdateViewData(conversationType, result.getData());
|
||||
} else if (result.getLoadStatus() == LoadStatus.Finish
|
||||
&& result.getType() == FetchResult.FetchType.Remove) {
|
||||
@@ -517,7 +543,7 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
LogUtils.d("shijie", "更新群组信息" + result.getData().size() + " conversation size==" + conversationViewTop.getDataSize());
|
||||
conversationViewTop.updateTeamInfo(result.getData());
|
||||
} else if (conversationType == 2) {
|
||||
// updateShiJieTeamInfo(result.getData());
|
||||
// updateShiJieTeamInfo(result.getData());
|
||||
LogUtils.d("shijie", "更新群组信息" + result.getData().size() + " conversationshijie size==" + conversationViewShiJie.getDataSize());
|
||||
conversationViewTop.updateTeamInfoType(result.getData(), true);
|
||||
conversationViewBottom.updateTeamInfoType(result.getData(), false);
|
||||
@@ -743,13 +769,13 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
switch (conversationType) {
|
||||
case 0:
|
||||
List<ConversationBean> listconversation = updateServicesConversation(result.getData());
|
||||
// if (chatTabParentFragment.groupIds != null) { //添加世界聊天窗口
|
||||
// LogUtils.d("shijie", "添加世界聊天==" + chatTabParentFragment.groupIds.size());
|
||||
// List<ConversationBean> conversationShiJieList = addConversationTeamShiJie(listconversation);
|
||||
// LogUtils.d("shijie", "添加世界聊天==" + conversationShiJieList.size());
|
||||
// listconversation.addAll(conversationShiJieList);
|
||||
// }
|
||||
if (groupIds != null) { //添加世界聊天窗口
|
||||
List<ConversationBean> conversationShiJieList = addConversationTeamShiJie(listconversation);
|
||||
LogUtils.d("shijie", "添加世界聊天==" + conversationShiJieList.size());
|
||||
listconversation.addAll(conversationShiJieList);
|
||||
}
|
||||
// Collections.sort(listconversation, conversationShiJieComparator);
|
||||
Collections.sort(listconversation, conversationShiJieComparator);
|
||||
conversationViewTop.setData(listconversation);
|
||||
break;
|
||||
case 1:
|
||||
@@ -758,6 +784,7 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
break;
|
||||
case 2:
|
||||
getConversationTeamTypeList(result.getData());
|
||||
LogUtils.d("shijie", "添加世界聊天 qunzu==" + listGuanfangTeam.size());
|
||||
setChatDraftDataList(listMyTeam);
|
||||
setChatDraftDataList(listJoinTeam);
|
||||
setChatDraftDataList(listGuanfangTeam);
|
||||
@@ -769,35 +796,32 @@ public class ChatConversationFragment extends BaseFragment implements ILoadListe
|
||||
}
|
||||
|
||||
|
||||
// //在已有的会话中添加世界聊天会话
|
||||
// public List<ConversationBean> addConversationTeamShiJie(List<ConversationBean> recentContactList) {
|
||||
// List<ConversationBean> listconversation = new ArrayList<>();
|
||||
// for (int i = 0; i < chatTabParentFragment.groupIds.size(); i++) {
|
||||
// boolean isAdd = false;
|
||||
// for (ConversationBean conversationBean : recentContactList) {
|
||||
// if (conversationBean.infoData.getContactId().equals(chatTabParentFragment.groupIds.get(i))) {
|
||||
// conversationBean.isShiJie = true;
|
||||
// conversationBean.infoData.setStickTop(true);
|
||||
// isAdd = true;
|
||||
// }
|
||||
// }
|
||||
// if (!isAdd) {
|
||||
// RecentContact recentContact = NIMClient.getService(MsgService.class).createEmptyRecentContact(chatTabParentFragment.groupIds.get(i), SessionTypeEnum.Team, 0, System.currentTimeMillis(), true, true);
|
||||
// ConversationInfo info = new ConversationInfo(recentContact);
|
||||
// if (chatTabParentFragment.teamInfos.size() > 0) {
|
||||
// info.setTeamInfo(chatTabParentFragment.teamInfos.get(i));
|
||||
// }
|
||||
// info.setStickTop(true);
|
||||
// ConversationBean conversationBean = new ConversationBean(info);
|
||||
// conversationBean.isShiJie = true;
|
||||
// listconversation.add(conversationBean);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return listconversation;
|
||||
//
|
||||
//
|
||||
// }
|
||||
//在已有的会话中添加世界聊天会话
|
||||
public List<ConversationBean> addConversationTeamShiJie(List<ConversationBean> recentContactList) {
|
||||
List<ConversationBean> listconversation = new ArrayList<>();
|
||||
for (int i = 0; i < groupIds.size(); i++) {
|
||||
boolean isAdd = false;
|
||||
for (ConversationBean conversationBean : recentContactList) {
|
||||
if (conversationBean.infoData.getContactId().equals(groupIds.get(i))) {
|
||||
conversationBean.isShiJie = true;
|
||||
conversationBean.infoData.setStickTop(true);
|
||||
isAdd = true;
|
||||
}
|
||||
}
|
||||
if (!isAdd) {
|
||||
RecentContact recentContact = NIMClient.getService(MsgService.class).createEmptyRecentContact(groupIds.get(i), SessionTypeEnum.Team, 0, System.currentTimeMillis(), true, true);
|
||||
ConversationInfo info = new ConversationInfo(recentContact);
|
||||
info.setStickTop(true);
|
||||
ConversationBean conversationBean = new ConversationBean(info);
|
||||
conversationBean.isShiJie = true;
|
||||
listconversation.add(conversationBean);
|
||||
}
|
||||
|
||||
}
|
||||
return listconversation;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// // 設置包含世界聊天
|
||||
|
||||
@@ -255,14 +255,16 @@
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/text_size_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_teamallowaddfriends"
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swich_teamallowaddfriends"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dimen_24_dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="@string/teamsetting_other_teamallow"
|
||||
android:textColor="@color/color_7f7b81"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
android:checked="true"
|
||||
android:thumb="@drawable/switch_thumb_selector"
|
||||
app:track="@drawable/switch_track_selector" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -195,10 +195,10 @@ public class FunChatTeamFragment extends FunChatFragment {
|
||||
if (!TextUtils.isEmpty(teamInfo.getExtension())) {
|
||||
extensionBean = GsonUtils.getObjFromJSON(teamInfo.getExtension(), TeamExtensionBean.class);
|
||||
if (extensionBean == null) {
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(teamInfo.getExtension()), 1);
|
||||
extensionBean = new TeamExtensionBean(Integer.parseInt(teamInfo.getExtension()), 0);
|
||||
}
|
||||
} else {
|
||||
extensionBean = new TeamExtensionBean(1, 1);
|
||||
extensionBean = new TeamExtensionBean(1, 0);
|
||||
}
|
||||
isAllowAd = extensionBean.getAllowAddFriends();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface ApiService {
|
||||
/**
|
||||
* 测试环境
|
||||
*/
|
||||
// String URL = "https://api-test.letschat2023.com/";
|
||||
// String URL = "https://api-test.letschat2023.com/";
|
||||
|
||||
|
||||
String SUBSTATIONID = "1703655363476242434";
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dimen_24_dp"
|
||||
android:layout_marginEnd="@dimen/dimen_15_dp"
|
||||
android:checked="true"
|
||||
android:checked="false"
|
||||
android:thumb="@drawable/switch_thumb_selector"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvgroup_addFriends"
|
||||
|
||||
Reference in New Issue
Block a user