|
@@ -9,6 +9,7 @@ import com.cooleshow.base.rx.BaseObserver;
|
|
|
import com.cooleshow.base.utils.LogUtils;
|
|
|
import com.cooleshow.base.utils.RequestBodyUtil;
|
|
|
import com.cooleshow.chatmodule.api.IMApi;
|
|
|
+import com.cooleshow.chatmodule.bean.GroupApplyBean;
|
|
|
import com.cooleshow.chatmodule.bean.GroupMemberBean;
|
|
|
import com.cooleshow.chatmodule.bean.IMGroupInfo;
|
|
|
import com.cooleshow.chatmodule.contract.ChatGroupSettingContract;
|
|
@@ -42,7 +43,7 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
|
|
|
mProvider = new GroupInfoProvider();
|
|
|
}
|
|
|
|
|
|
- public void loadGroup(String groupId){
|
|
|
+ public void loadGroup(String groupId) {
|
|
|
mProvider.loadGroupInfo(groupId, GroupInfo.GROUP_MEMBER_FILTER_ALL, new IUIKitCallback<GroupInfo>() {
|
|
|
@Override
|
|
|
public void onSuccess(GroupInfo data) {
|
|
@@ -67,7 +68,7 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
|
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- addSubscribe(create(IMApi.class).queryGroupAllMembers(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString()),BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<List<GroupMemberBean>>(getView()) {
|
|
|
+ addSubscribe(create(IMApi.class).queryGroupAllMembers(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString()), BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<List<GroupMemberBean>>(getView()) {
|
|
|
@Override
|
|
|
protected void onSuccess(List<GroupMemberBean> data) {
|
|
|
if (getView() != null) {
|
|
@@ -79,13 +80,7 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
|
|
|
|
|
|
//查询群详情
|
|
|
public void queryGroupDetail(String groupId) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- try {
|
|
|
- jsonObject.put("groupId", groupId);
|
|
|
- } catch (JSONException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- addSubscribe(create(IMApi.class).queryGroupDetail(groupId,BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<IMGroupInfo>() {
|
|
|
+ addSubscribe(create(IMApi.class).queryGroupDetail(groupId, BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<IMGroupInfo>() {
|
|
|
@Override
|
|
|
protected void onSuccess(IMGroupInfo data) {
|
|
|
if (isViewAttached()) {
|
|
@@ -102,7 +97,7 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
|
|
|
* @param groupId
|
|
|
*/
|
|
|
public void dissolveChatGroup(String groupId) {
|
|
|
- addSubscribe(create(IMApi.class).dissolveChatGroup(groupId,BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<Object>() {
|
|
|
+ addSubscribe(create(IMApi.class).dissolveChatGroup(groupId, BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<Object>() {
|
|
|
@Override
|
|
|
protected void onSuccess(Object data) {
|
|
|
delLocalConversation(groupId);
|
|
@@ -121,7 +116,7 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
|
|
|
* @param groupId
|
|
|
*/
|
|
|
public void quitChatGroup(String groupId) {
|
|
|
- addSubscribe(create(IMApi.class).quitChatGroup(groupId,BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<Object>() {
|
|
|
+ addSubscribe(create(IMApi.class).quitChatGroup(groupId, BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<Object>() {
|
|
|
@Override
|
|
|
protected void onSuccess(Object data) {
|
|
|
if (getView() != null) {
|
|
@@ -138,6 +133,7 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
|
|
|
}
|
|
|
|
|
|
public void delLocalConversationByQuit(String targetId) {
|
|
|
+ targetId = IMCenter.getInstance().getConversationIdFromId(targetId, true);
|
|
|
IMCenter.getInstance().deleteConversation(targetId, new IUIKitCallback<Void>() {
|
|
|
@Override
|
|
|
public void onSuccess(Void data) {
|
|
@@ -145,52 +141,50 @@ public class ChatGroupSettingPresenter extends BasePresenter<ChatGroupSettingCon
|
|
|
|
|
|
@Override
|
|
|
public void onError(int errCode, String errMsg, Void data) {
|
|
|
- LogUtils.i("pq", "errorMsg:" +errMsg + "\n" + "errorCode:" + errCode);
|
|
|
+ LogUtils.i("pq", "errorMsg:" + errMsg + "\n" + "errorCode:" + errCode);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
public void delLocalConversation(String targetId) {
|
|
|
+ targetId = IMCenter.getInstance().getConversationIdFromId(targetId, true);
|
|
|
IMCenter.getInstance().deleteConversation(targetId, new IUIKitCallback<Void>() {
|
|
|
@Override
|
|
|
public void onSuccess(Void data) {
|
|
|
if (getView() != null) {
|
|
|
- getView().dissolveChatGroupSuccess(targetId);
|
|
|
+ getView().dissolveChatGroupSuccess();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(int errCode, String errMsg, Void data) {
|
|
|
- LogUtils.i("pq", "errorMsg:" +errMsg + "\n" + "errorCode:" + errCode);
|
|
|
+ LogUtils.i("pq", "errorMsg:" + errMsg + "\n" + "errorCode:" + errCode);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
public void groupApplyList(String groupId) {
|
|
|
-// if (getView() != null) {
|
|
|
-// getView().showLoading();
|
|
|
-// }
|
|
|
-// JSONObject jsonObject = new JSONObject();
|
|
|
-// try {
|
|
|
-// jsonObject.putOpt("auditStatus", "AUDITING");
|
|
|
-// jsonObject.putOpt("groupId", groupId);
|
|
|
-// jsonObject.putOpt("rows", Integer.MAX_VALUE);
|
|
|
-// } catch (JSONException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// addSubscribe(create(IMApi.class).groupApplyList(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString()), BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<GroupApplyBean>(getView()) {
|
|
|
-// @Override
|
|
|
-// protected void onSuccess(GroupApplyBean data) {
|
|
|
-// if (getView() != null) {
|
|
|
-// getView().groupApplyListSuccess(data);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// });
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ try {
|
|
|
+ jsonObject.putOpt("auditStatus", "AUDITING");
|
|
|
+ jsonObject.putOpt("groupId", groupId);
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ addSubscribe(create(IMApi.class).groupApplyList(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString()),BaseConstant.CLIENT_API_GROUP_NAME), new BaseObserver<List<GroupApplyBean>>(getView()) {
|
|
|
+ @Override
|
|
|
+ protected void onSuccess(List<GroupApplyBean> data) {
|
|
|
+ if (getView() != null) {
|
|
|
+ getView().groupApplyListSuccess(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 群消息免打扰
|
|
|
+ *
|
|
|
* @param targetId
|
|
|
* @param isChecked
|
|
|
* @param callback
|