Commit ca1d57b5 by 刘鹏

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

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