Commit ca1d57b5 by 刘鹏

feat : IM区分用户类型2、3

parent d8462f95
......@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03",
"m-user" : "0.0.61.84",
"m-home" : "0.0.22.70",
"m-im" : "0.0.20.38",
"m-im" : "0.0.20.41",
"m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.10",
......@@ -94,7 +94,7 @@ ext {
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.84",
"m-home" : "0.0.22.70",
"m-im" : "0.0.20.38",
"m-im" : "0.0.20.41",
"m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.8",
......
......@@ -144,7 +144,7 @@ object IMChatUtil {
fun startChat(context: AppCompatActivity?, chatItemBean: ChatItemBean) {
SessionHelper.startP2PSession(
context,
3,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
......@@ -254,7 +254,7 @@ object IMChatUtil {
p2PCustomActionHandlerImpl.isFromQingShu = isFromQingShu
SessionHelper.startP2PSession(
context,
3,
expertInfo.shareData.user_type,
toUid,
null,
p2PCustomActionHandlerImpl
......
......@@ -32,7 +32,6 @@ import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.action.AVChatAction;
import com.yidianling.im.session.action.H5VideoAction;
import com.yidianling.im.session.action.HelpAction;
import com.yidianling.im.session.action.MakeCollectionsAction;
import com.yidianling.im.session.action.OrderAction;
import com.yidianling.im.session.action.RedPacketAction;
......@@ -169,6 +168,10 @@ public class SessionHelper {
setSessionListener();
}
/**
* user_type 2 医生
* 3 导医
*/
public static void startP2PSession(Context context, int user_type, String account, IMMessage anchor, IP2PCustomActionHandler actionHandler) {
LogHelper.Companion.getInstance().writeLogSync("开启聊天:"
+ "user_type = " + user_type
......@@ -233,8 +236,8 @@ public class SessionHelper {
/*
* 通知服务端红点
* */
private static void notifyRedPoint( String assistantUid, String userId) {
String str = new Gson().toJson(new BuryRedPointParam(assistantUid, userId));
private static void notifyRedPoint(String assistantUid, String userId) {
String str = new Gson().toJson(new BuryRedPointParam(assistantUid, userId));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str);
Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().imBuryRedPoints(body)
.compose(RxUtils.INSTANCE.resultJavaData())
......
......@@ -95,6 +95,12 @@ import okhttp3.RequestBody;
* Created by huangjun on 2015/2/1.
*/
public class YDLMessageFragment extends TFragment implements ModuleProxy {
//用户
private static int USER_TYPE_USER = 1;
//专家
private static int USER_TYPE_EXPERT = 2;
//助理
private static int USER_TYPE_ASSISTANT = 3;
private View rootView;
......@@ -190,7 +196,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
private void initView() {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_ASSISTANT) {
if (ChatStatusCacheHelper.getStatusCache("chatEvent")) {
ChatStatusCacheHelper.clearDataByKey("chatEvent");
}
......@@ -204,7 +210,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
titleBar.setTitle(ActionHandlerStorage.getL(sessionId).getInfo().name);
// 初始化顶部专家信息栏
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 2) {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_EXPERT) {
initTopViewHeight(); //设置顶部专家信息栏高度
IMChatUtil.INSTANCE.initChatOnlineState(titleBar, getContext(), sessionId, this);
}
......@@ -212,14 +218,15 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (ActionHandlerStorage.getL(sessionId) != null) {
int type = ActionHandlerStorage.getL(sessionId).getUserType();
int sType = ActionHandlerStorage.getL(sessionId).getSelfUserType();
if (type == 2 && sType == 1) {
if (type == USER_TYPE_EXPERT && sType == USER_TYPE_USER) {
ll_actions_yi.setVisibility(View.GONE);
} else if (type == -1 && sType == 1) {
} else if (type == -1 && sType == USER_TYPE_USER) {
ll_actions_yi.setVisibility(View.VISIBLE);
initYiMenu();
} else {
ll_actions_yi.setVisibility(View.GONE);
}
}
......@@ -257,10 +264,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
});
String targetUid = "";
if (ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 1) {
if (ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == USER_TYPE_USER) {
//自己是用戶,搜索的是自己的信息
targetUid = ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUid();
} else if (ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 3) {
} else if (ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == USER_TYPE_ASSISTANT) {
// 自己是助理,搜索的是对方(用户)的信息
if (ActionHandlerStorage.getL(sessionId) != null) {
targetUid = ActionHandlerStorage.getL(sessionId).getInfo().toUid;
......@@ -272,7 +279,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
.subscribe(hasCollectedInResp -> {
if (hasCollectedInResp.data != null && hasCollectedInResp.data.size() > 0) {
if (ActionHandlerStorage.getL(sessionId) != null && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 1) {
if (ActionHandlerStorage.getL(sessionId) != null && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == USER_TYPE_USER) {
if (TextUtils.isEmpty(SharedPreferencesEditor.getString("chat_age_ensure_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
for (UserQuestInfoBean bean : hasCollectedInResp.data) {
if (TextUtils.equals(bean.getUserInfoType(), "age")) {
......@@ -292,7 +299,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
// 如果对方是用户,自己是助理,则展示标题文本右侧icon,并设置点击事件,展示用户信息弹窗
if (ActionHandlerStorage.getL(sessionId).getUserType() == 1 && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 3) {
if (ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_USER && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == USER_TYPE_ASSISTANT) {
if (null == userInfoDialog) {
for (UserQuestInfoBean bean : hasCollectedInResp.data) {
......@@ -448,7 +455,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
NIMClient.getService(MsgService.class).setChattingAccount(sessionId, sessionType);
getActivity().setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); // 默认使用听筒播放
messageListPanel.scrollToBottom();
inputPanel.setVisible(false);
if (ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_EXPERT) {
inputPanel.setVisible(false);
}
getInquIryIngInfo();
}
......@@ -465,45 +474,52 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} else {
ToastUtil.toastShort(response.msg);
inputPanel.setVisible(false);
if (ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_EXPERT) {
inputPanel.setVisible(false);
}
}
}, throwable -> {
inputPanel.setVisible(false);
if (ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_EXPERT) {
inputPanel.setVisible(false);
}
LogUtil.e(throwable.getMessage());
}
);
}
public void upReceiceType(int type) {
if (type == 30) {
// 30:待诊断(已接诊、问诊中)
inputPanel.setVisible(true);
top_expert_info_ll.setVisibility(View.VISIBLE);
receive_undiagnosis.setVisibility(View.VISIBLE);
receive_unstart.setVisibility(View.GONE);
receive_end.setVisibility(View.GONE);
} else if (type == 20) {
//待接诊
inputPanel.setVisible(false);
top_expert_info_ll.setVisibility(View.VISIBLE);
receive_undiagnosis.setVisibility(View.GONE);
receive_unstart.setVisibility(View.VISIBLE);
receive_end.setVisibility(View.GONE);
} else if (type == 40) {
//已完成
inputPanel.setVisible(false);
top_expert_info_ll.setVisibility(View.VISIBLE);
receive_undiagnosis.setVisibility(View.GONE);
receive_unstart.setVisibility(View.GONE);
receive_end.setVisibility(View.VISIBLE);
public void upReceiceType(int type) {
if (ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_EXPERT) {
if (type == 30) {
// 30:待诊断(已接诊、问诊中)
inputPanel.setVisible(true);
top_expert_info_ll.setVisibility(View.VISIBLE);
receive_undiagnosis.setVisibility(View.VISIBLE);
receive_unstart.setVisibility(View.GONE);
receive_end.setVisibility(View.GONE);
} else if (type == 20) {
//待接诊
inputPanel.setVisible(false);
top_expert_info_ll.setVisibility(View.VISIBLE);
receive_undiagnosis.setVisibility(View.GONE);
receive_unstart.setVisibility(View.VISIBLE);
receive_end.setVisibility(View.GONE);
} else if (type == 40) {
//已完成
inputPanel.setVisible(false);
top_expert_info_ll.setVisibility(View.VISIBLE);
receive_undiagnosis.setVisibility(View.GONE);
receive_unstart.setVisibility(View.GONE);
receive_end.setVisibility(View.VISIBLE);
} else {
top_expert_info_ll.setVisibility(View.GONE);
inputPanel.setVisible(false);
} else {
top_expert_info_ll.setVisibility(View.GONE);
inputPanel.setVisible(false);
}
}
}
......@@ -747,7 +763,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
//用户对用户第一次聊天发送安全提示消息
if (ActionHandlerStorage.getL(sessionId) != null) {
IP2PCustomActionHandler p2PMoreListener = ActionHandlerStorage.getL(sessionId);
if (p2PMoreListener.getUserType() == 1 && p2PMoreListener.getSelfUserType() == 1 && null != p2PMoreListener.getInfo() && p2PMoreListener.getInfo().is_first == 1) {
if (p2PMoreListener.getUserType() == USER_TYPE_USER && p2PMoreListener.getSelfUserType() == USER_TYPE_USER && null != p2PMoreListener.getInfo() && p2PMoreListener.getInfo().is_first == 1) {
p2PMoreListener.getInfo().is_first = 0;
ActionHandlerStorage.getL(sessionId).sendCustomMsg();
}
......@@ -906,7 +922,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private boolean openOrCloseCommonQuestionLayout(boolean open) {
boolean result = false;
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == USER_TYPE_ASSISTANT) {
if (open) {
inputPanel.collapse(true);
messageListPanel.scrollToBottom();
......
......@@ -78,6 +78,9 @@ public interface IP2PCustomActionHandler {
void pauseUm(Activity activity);
/**
* 1:用户 2:医生 3:导医
* */
int getUserType();
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment