Commit 78fca931 by 霍志良

feat:对接接口,配合服务端红点消失隐藏的需求

parent ab9603dd
...@@ -8,6 +8,7 @@ import com.ydl.ydlnet.YDLHttpUtils ...@@ -8,6 +8,7 @@ import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.im.api.bean.IMExpertBuild import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.bean.* import com.yidianling.im.bean.*
import io.reactivex.Observable import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.* import retrofit2.http.*
/** /**
...@@ -102,4 +103,7 @@ interface ImRetrofitApi { ...@@ -102,4 +103,7 @@ interface ImRetrofitApi {
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getPushConfideStatus(@Query("uid") uid: String, @Query("listenerUid") listenerUid: String): Observable<BaseAPIResponse<PushConfideStatusBean>> fun getPushConfideStatus(@Query("uid") uid: String, @Query("listenerUid") listenerUid: String): Observable<BaseAPIResponse<PushConfideStatusBean>>
@POST("lingxi/asistant/buryRedPoint")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun imBuryRedPoints(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ import android.content.Intent; ...@@ -6,6 +6,7 @@ import android.content.Intent;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import com.google.gson.Gson;
import com.netease.nimlib.sdk.NIMClient; import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.RequestCallback; import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.StatusCode; import com.netease.nimlib.sdk.StatusCode;
...@@ -19,12 +20,15 @@ import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum; ...@@ -19,12 +20,15 @@ import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage; import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.netease.nimlib.sdk.team.constant.TeamTypeEnum; import com.netease.nimlib.sdk.team.constant.TeamTypeEnum;
import com.netease.nimlib.sdk.team.model.Team; import com.netease.nimlib.sdk.team.model.Team;
import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.data.http.UpLoadLogUtils; import com.ydl.ydlcommon.data.http.UpLoadLogUtils;
import com.ydl.ydlcommon.utils.log.LogHelper; import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.view.dialog.CommonDialog; import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.avchatkit.TeamAVChatProfile; import com.yidianling.avchatkit.TeamAVChatProfile;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R; import com.yidianling.im.R;
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;
...@@ -93,10 +97,12 @@ import com.yidianling.im.session.viewholder.MsgViewHolderSticker; ...@@ -93,10 +97,12 @@ import com.yidianling.im.session.viewholder.MsgViewHolderSticker;
import com.yidianling.im.session.viewholder.MsgViewHolderSubscriptTime; import com.yidianling.im.session.viewholder.MsgViewHolderSubscriptTime;
import com.yidianling.im.session.viewholder.MsgViewHolderSystemTips; import com.yidianling.im.session.viewholder.MsgViewHolderSystemTips;
import com.yidianling.im.session.viewholder.MsgViewHolderTip; import com.yidianling.im.session.viewholder.MsgViewHolderTip;
import com.yidianling.im.ui.param.BuryRedPointsParm;
import com.yidianling.nimbase.api.model.session.SessionCustomization; import com.yidianling.nimbase.api.model.session.SessionCustomization;
import com.yidianling.nimbase.api.model.session.SessionEventListener; import com.yidianling.nimbase.api.model.session.SessionEventListener;
import com.yidianling.nimbase.business.session.actions.BaseAction; import com.yidianling.nimbase.business.session.actions.BaseAction;
import com.yidianling.nimbase.impl.cache.TeamDataCache; import com.yidianling.nimbase.impl.cache.TeamDataCache;
import com.yidianling.uikit.business.session.activity.YDLP2PMessageActivity;
import com.yidianling.user.api.bean.UserResponseBean; import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.uikit.api.NimUIKit; import com.yidianling.uikit.api.NimUIKit;
import com.yidianling.uikit.business.session.actions.ImageAction; import com.yidianling.uikit.business.session.actions.ImageAction;
...@@ -107,8 +113,15 @@ import com.yidianling.uikit.business.team.model.TeamRequestCode; ...@@ -107,8 +113,15 @@ import com.yidianling.uikit.business.team.model.TeamRequestCode;
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage; import com.yidianling.uikit.custom.bridge.ActionHandlerStorage;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler; import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import java.util.ArrayList; import java.util.ArrayList;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/** /**
* UIKit自定义消息界面用法展示类 * UIKit自定义消息界面用法展示类
*/ */
...@@ -126,7 +139,6 @@ public class SessionHelper { ...@@ -126,7 +139,6 @@ public class SessionHelper {
private static int last_user_type = -2; private static int last_user_type = -2;
public static void init() { public static void init() {
// 注册自定义消息附件解析器 // 注册自定义消息附件解析器
NIMClient.getService(MsgService.class).registerCustomAttachmentParser(new CustomAttachParser()); NIMClient.getService(MsgService.class).registerCustomAttachmentParser(new CustomAttachParser());
...@@ -140,6 +152,8 @@ public class SessionHelper { ...@@ -140,6 +152,8 @@ public class SessionHelper {
LogHelper.Companion.getInstance().writeLogSync("开启聊天:" LogHelper.Companion.getInstance().writeLogSync("开启聊天:"
+ "user_type = " + user_type + "user_type = " + user_type
+ ", account = " + account); + ", account = " + account);
//只要打开聊天页面,就请求接口,服务端用来判断消息红点显示隐藏
notifyRedPoint(context, account, ImIn.INSTANCE.getUserInfo().getUid());
StatusCode status = NIMClient.getStatus(); StatusCode status = NIMClient.getStatus();
if (status == StatusCode.UNLOGIN) { if (status == StatusCode.UNLOGIN) {
RequestCallback<LoginInfo> callback = new RequestCallback<LoginInfo>() { RequestCallback<LoginInfo> callback = new RequestCallback<LoginInfo>() {
...@@ -195,6 +209,24 @@ public class SessionHelper { ...@@ -195,6 +209,24 @@ public class SessionHelper {
} }
} }
/*
* 通知服务端红点
* */
private static void notifyRedPoint(Context context, String assistantUid, String userId) {
String str = new Gson().toJson(new BuryRedPointsParm(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())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(it -> {
LogUtil.e("redPointsSuccess");
}, throwable ->
LogUtil.e(throwable.getMessage())
);
}
public static void startTeamSession(Context context, String tid) { public static void startTeamSession(Context context, String tid) {
startTeamSession(context, tid, null, null); startTeamSession(context, tid, null, null);
} }
......
package com.yidianling.im.ui.param
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/9/8
*/
class BuryRedPointsParm (assistantUid :String,userId:String)
\ No newline at end of file
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