Commit 84ac13b2 by 霍志良

feat:im-灵犀2.0-用户进入聊天页面,用户离开聊天页面

parent b052d78e
...@@ -124,4 +124,9 @@ interface ImRetrofitApi { ...@@ -124,4 +124,9 @@ interface ImRetrofitApi {
@POST("chat/sendCustomizeMessage") @POST("chat/sendCustomizeMessage")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun lingxiAnswerQuestion(@Body body: RequestBody): Observable<BaseAPIResponse<Any>> fun lingxiAnswerQuestion(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
//发送通知接口
@POST("chat/sendNoticeMessage")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun lingxiSendNotice(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
} }
\ No newline at end of file
...@@ -25,6 +25,8 @@ import com.yidianling.im.session.viewholder.bean.AnswerBean; ...@@ -25,6 +25,8 @@ import com.yidianling.im.session.viewholder.bean.AnswerBean;
import com.yidianling.im.session.viewholder.bean.AnswersItem; import com.yidianling.im.session.viewholder.bean.AnswersItem;
import com.yidianling.im.session.viewholder.bean.LingxiAnswerBean; import com.yidianling.im.session.viewholder.bean.LingxiAnswerBean;
import com.yidianling.im.session.viewholder.bean.QuestionItemBean; import com.yidianling.im.session.viewholder.bean.QuestionItemBean;
import com.yidianling.im.session.viewholder.bean.UserIsInPage;
import com.yidianling.im.session.viewholder.bean.UserIsInPageData;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter; import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase; import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
...@@ -212,6 +214,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -212,6 +214,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
LogUtil.e(throwable.getMessage()) LogUtil.e(throwable.getMessage())
); );
} }
@Override @Override
public void onMultipleItemClick(@NotNull QuestionItemBean string, int position) { public void onMultipleItemClick(@NotNull QuestionItemBean string, int position) {
//多选发送消息 //多选发送消息
......
...@@ -40,4 +40,17 @@ data class Relates( ...@@ -40,4 +40,17 @@ data class Relates(
var category:String?, var category:String?,
var name: String?, var name: String?,
var score:String? var score:String?
)
data class UserIsIn(
var data: UserIsInPage,
var fromUid: String,
var noticeType: String,
var toUid: String
)
data class UserIsInPage(
var noticeType:String,
var data: UserIsInPageData
)
data class UserIsInPageData(
var content:String
) )
\ No newline at end of file
...@@ -133,7 +133,7 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity { ...@@ -133,7 +133,7 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
public void onObserverCustomNotification(@NotNull String fromUid, @NotNull String toUid, @NotNull String content) { public void onObserverCustomNotification(@NotNull String fromUid, @NotNull String toUid, @NotNull String content) {
ServiceBean serviceBean = new Gson().fromJson(content, ServiceBean.class); ServiceBean serviceBean = new Gson().fromJson(content, ServiceBean.class);
// 切换到客服 // 切换到客服
if (serviceBean != null && serviceBean.getData() != null && serviceBean.getBusiness().equals("change_doctor")) { if (serviceBean != null && serviceBean.getData() != null&&serviceBean.getBusiness()!=null && serviceBean.getBusiness().equals("change_doctor")) {
isChangeDoctor = true; isChangeDoctor = true;
String serviceUid = String.valueOf(serviceBean.getData().getToUid()); String serviceUid = String.valueOf(serviceBean.getData().getToUid());
tb.setTitle(serviceBean.getData().getName()); tb.setTitle(serviceBean.getData().getName());
......
...@@ -28,6 +28,7 @@ import androidx.constraintlayout.widget.ConstraintLayout; ...@@ -28,6 +28,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.netease.nimlib.sdk.NIMClient; import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer; import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.RequestCallback; import com.netease.nimlib.sdk.RequestCallback;
...@@ -45,6 +46,7 @@ import com.netease.nimlib.sdk.uinfo.model.NimUserInfo; ...@@ -45,6 +46,7 @@ import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.ydl.webview.H5Params; import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity; import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.modular.ModularServiceManager; import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.utils.AnimUtils; import com.ydl.ydlcommon.utils.AnimUtils;
import com.ydl.ydlcommon.utils.LogUtil; import com.ydl.ydlcommon.utils.LogUtil;
...@@ -60,7 +62,11 @@ import com.yidianling.common.tools.ToastUtil; ...@@ -60,7 +62,11 @@ import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.event.MultipleSelectedEvent; import com.yidianling.im.event.MultipleSelectedEvent;
import com.yidianling.im.helper.IMChatUtil; import com.yidianling.im.helper.IMChatUtil;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn; import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.viewholder.bean.UserIsIn;
import com.yidianling.im.session.viewholder.bean.UserIsInPage;
import com.yidianling.im.session.viewholder.bean.UserIsInPageData;
import com.yidianling.nimbase.api.UIKitOptions; import com.yidianling.nimbase.api.UIKitOptions;
import com.yidianling.nimbase.api.model.main.CustomPushContentProvider; import com.yidianling.nimbase.api.model.main.CustomPushContentProvider;
import com.yidianling.nimbase.api.model.session.ModuleProxy; import com.yidianling.nimbase.api.model.session.ModuleProxy;
...@@ -106,7 +112,10 @@ import java.util.Map; ...@@ -106,7 +112,10 @@ import java.util.Map;
import de.greenrobot.event.EventBus; import de.greenrobot.event.EventBus;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/** /**
...@@ -1067,6 +1076,8 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -1067,6 +1076,8 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (aitManager != null) { if (aitManager != null) {
aitManager.reset(); aitManager.reset();
} }
userIsInPage("67","用户离开当前页面",sessionId,ImIn.INSTANCE.getUserInfo().getUid());
} }
public void onEvent(MultipleSelectedEvent event){ public void onEvent(MultipleSelectedEvent event){
question_multiple.setText(event.getStrSelected()); question_multiple.setText(event.getStrSelected());
...@@ -1118,6 +1129,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -1118,6 +1129,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (customization != null) { if (customization != null) {
messageListPanel.setChattingBackground(customization.backgroundUri, customization.backgroundColor); messageListPanel.setChattingBackground(customization.backgroundUri, customization.backgroundColor);
} }
userIsInPage("66","用户在当前页面",sessionId,ImIn.INSTANCE.getUserInfo().getUid());
} }
private void initAitManager() { private void initAitManager() {
...@@ -1381,7 +1393,23 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -1381,7 +1393,23 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
ToastUtil.toastShort(throwable.toString()); ToastUtil.toastShort(throwable.toString());
}); });
} }
/*
* 用户是否在当前页面
*
* */
private void userIsInPage(String noticeType,String content,String fromUid,String toUid) {
String str = new Gson().toJson(new UserIsIn(new UserIsInPage(noticeType,new UserIsInPageData(content)),fromUid,noticeType,toUid));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str);
Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().lingxiSendNotice(body)
.compose(RxUtils.INSTANCE.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(it -> {
LogUtil.e(it.toString()+content);
}, throwable ->
com.yidianling.common.tools.LogUtil.e(throwable.getMessage())
);
}
private void initCommonQuestionLayout() { private void initCommonQuestionLayout() {
CommonQuestionView commonQuestionView = new CommonQuestionView(getActivity()); CommonQuestionView commonQuestionView = new CommonQuestionView(getActivity());
commonQuestionView.setData(commonQuestionBeanList); commonQuestionView.setData(commonQuestionBeanList);
......
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