1.移除七鱼客服 2.MobSDK,网易易盾SDK初始化改为同意协议后再初始化

This commit is contained in:
huangjian
2021-07-26 21:00:24 +08:00
committed by zu
parent 73e1ed5e85
commit 28200f349c
29 changed files with 12 additions and 609 deletions

View File

@@ -264,8 +264,6 @@ dependencies {
implementation 'com.github.YvesCheung:RollingText:1.2.3'
// 引入原有第三方裁图源码,方便修改
api project(':android_crop_lib')
//网易七鱼客服
implementation 'com.qiyukf.unicorn:unicorn:4.9.1'
//rx权限请求框架
implementation('com.github.tbruyelle:rxpermissions:0.10.2') {

View File

@@ -302,9 +302,6 @@
-dontwarn edu.umd.cs.**
-dontwarn org.apache.**
-dontwarn com.amap.**
#网易七鱼客服系统
-dontwarn com.qiyukf.**
-keep class com.qiyukf.** {*;}
# 确保openFileChooser方法不被混淆
-keepclassmembers class * extends android.webkit.WebChromeClient{

View File

@@ -1,6 +1,5 @@
package com.yizhuan.erban;
import android.Manifest;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
@@ -45,7 +44,6 @@ import com.netease.nimlib.sdk.team.constant.TeamMessageNotifyTypeEnum;
import com.netease.nimlib.sdk.team.model.Team;
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.orhanobut.logger.Logger;
import com.qiyukf.unicorn.api.Unicorn;
import com.tencent.bugly.crashreport.CrashReport;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.yizhuan.erban.application.ActivityStackManager;
@@ -123,7 +121,6 @@ import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment;
import com.yizhuan.xchat_android_core.community.event.SquareTaskEvent;
import com.yizhuan.xchat_android_core.community.event.UnReadCountEvent;
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
import com.yizhuan.xchat_android_core.customer_server.event.CustomerServerMsgEvent;
import com.yizhuan.xchat_android_core.home.model.HomeModel;
import com.yizhuan.xchat_android_core.im.custom.bean.AssistantAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.CarAttachment;
@@ -151,11 +148,11 @@ import com.yizhuan.xchat_android_core.level.event.CharmLevelUpEvent;
import com.yizhuan.xchat_android_core.level.event.LevelUpEvent;
import com.yizhuan.xchat_android_core.linked.LinkedModel;
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
import com.yizhuan.xchat_android_core.manager.AudioEngineManager;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMBroadcastManager;
import com.yizhuan.xchat_android_core.manager.IMMessageManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.manager.AudioEngineManager;
import com.yizhuan.xchat_android_core.market_verify.MarketVerifyModel;
import com.yizhuan.xchat_android_core.market_verify.event.MarketVerifyUpdateEvent;
import com.yizhuan.xchat_android_core.miniworld.bean.OpenAudioPartyAttachment;
@@ -636,7 +633,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
//登录成功查询未读信息数量
mMainTabLayout.setmUnReadDynamicCount(0);
int unreadCount = IMMessageManager.get().queryUnreadMsg() + Unicorn.getUnreadCount();
int unreadCount = IMMessageManager.get().queryUnreadMsg();
mMainTabLayout.setMsgNum(unreadCount);
// 互动消息未读数量
HomeModel.get().getUnreadCount(AuthModel.get().getCurrentUid())
@@ -706,13 +703,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
}
}
int unreadCount = IMMessageManager.get().queryUnreadMsg() + Unicorn.getUnreadCount() - countIgnore;
mMainTabLayout.setMsgNum(unreadCount);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCustomerServerMsgEvent(CustomerServerMsgEvent event) {
int unreadCount = IMMessageManager.get().queryUnreadMsg() + event.unreadCount;
int unreadCount = IMMessageManager.get().queryUnreadMsg() + countIgnore;
mMainTabLayout.setMsgNum(unreadCount);
}
@@ -724,7 +715,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLoginUserInfoUpdateEvent(LoginUserInfoUpdateEvent event) {
int unreadCount = IMMessageManager.get().queryUnreadMsg() + Unicorn.getUnreadCount();
int unreadCount = IMMessageManager.get().queryUnreadMsg();
mMainTabLayout.setMsgNum(unreadCount);
}

View File

@@ -27,11 +27,8 @@ import com.bumptech.glide.request.target.ViewTarget;
import com.coorchice.library.utils.LogUtils;
import com.huawei.hms.support.common.ActivityMgr;
import com.idlefish.flutterboost.FlutterBoost;
import com.ishumei.smantifraud.SmAntiFraud;
import com.llew.huawei.verifier.LoadedApkHuaWei;
import com.microquation.linkedme.android.LinkedME;
import com.mob.MobSDK;
import com.netease.mobsec.rjsb.watchman;
import com.netease.nim.uikit.api.NimUIKit;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nimlib.sdk.NIMClient;
@@ -73,7 +70,6 @@ import com.yizhuan.xchat_android_core.Env;
import com.yizhuan.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.channel.ChannelModel;
import com.yizhuan.xchat_android_core.customer_server.CustomerServerModel;
import com.yizhuan.xchat_android_core.family.model.FamilyModel;
import com.yizhuan.xchat_android_core.gift.GiftModel;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
@@ -674,8 +670,6 @@ public class XChatApplication extends Application {
private void init(String channel) {
initNimUIKit();
initYiDun();
MobSDK.init(this);
UriProvider.initUri(BuildConfig.BASE_URL_DEBUG, BuildConfig.BASE_URL_STAGING, BuildConfig.BASE_URL_RELEASE);
SVGAParser.Companion.shareParser().init(this);
try {
@@ -741,9 +735,6 @@ public class XChatApplication extends Application {
// HallModel.get();
// 师徒
MentoringRelationshipModel.get();
//初始化客服系统
CustomerServerModel.getInstance().init(this);
//全局处理
GlobalHandleManager.get().init();
@@ -756,46 +747,6 @@ public class XChatApplication extends Application {
NimUIKit.init(this);
}
private void initYiDun() {
// 网易易盾初始化
watchman.init(this, XChatConstants.YI_DUN_PRODUCT_NUMBER);
}
private void initShuMeiTianWang(String channel) {
// 数美天网初始化
if (Objects.equals(ProcessUtil.getCurProcessName(this), this.getPackageName())) {
SmAntiFraud.SmOption option = new SmAntiFraud.SmOption();
String DEBUG_ORG = XChatConstants.SHU_MEI_TIAN_WANG_ORGANIZATION;// organization 代码 不要传 AccessKey
option.setOrganization(DEBUG_ORG);
option.setChannel(channel);//渠道代码
SmAntiFraud.create(this, option);
}
}
private static void enabledStrictMode() {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll() //检测所有的想检测的
// .detectCustomSlowCalls() //自定义的耗时调用
// .detectDiskReads() /*检测磁盘读操作*/
// .detectDiskWrites() /*检测磁盘写入操作*/
// .detectNetwork() //检测网络
// .detectResourceMismatches()
.penaltyLog()
.penaltyDeath()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()/*也可以采用detectAll()来检测所有想检测的东西*/
// .detectActivityLeaks()/*检测Activity内存泄露*/
// .detectLeakedClosableObjects()/*检测未关闭的Closable对象*/
// .detectLeakedSqlLiteObjects() /*检测Sqlite对象是否关闭*/
.penaltyLog()
.penaltyDeath()
.build()
);
}
/**
* debug 环境 受到实验室模式影响
*/

View File

@@ -15,6 +15,7 @@ import com.idlefish.flutterboost.FlutterBoost;
import com.idlefish.flutterboost.containers.FlutterBoostFragment;
import com.microquation.linkedme.android.LinkedME;
import com.mob.MobSDK;
import com.netease.mobsec.rjsb.watchman;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nim.uikit.support.glide.GlideApp;
import com.umeng.analytics.MobclickAgent;
@@ -112,6 +113,9 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
private void initOtherSDK(String channel) {
LinkedME.getInstance().setImmediate(true);
// 网易易盾初始化
watchman.init(this.getApplicationContext(), XChatConstants.YI_DUN_PRODUCT_NUMBER); // 网易易盾初始化
MobSDK.init(this.getApplicationContext());
MobSDK.submitPolicyGrantResult(true, null);
// 友盟统计初始化
UMConfigure.init(this.getApplicationContext(), XChatConstants.UMENG_APP_KEY,

View File

@@ -25,10 +25,8 @@ import com.netease.nim.uikit.common.fragment.TFragment;
import com.netease.nim.uikit.common.ui.dialog.CustomAlertDialog;
import com.netease.nim.uikit.common.ui.drop.DropCover;
import com.netease.nim.uikit.common.ui.drop.DropManager;
import com.netease.nim.uikit.common.ui.imageview.HeadImageView;
import com.netease.nim.uikit.common.ui.recyclerview.listener.SimpleClickListener;
import com.netease.nim.uikit.impl.NimUIKitImpl;
import com.netease.nim.uikit.support.glide.GlideApp;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.RequestCallback;
@@ -43,14 +41,9 @@ import com.netease.nimlib.sdk.msg.model.QueryDirectionEnum;
import com.netease.nimlib.sdk.msg.model.RecentContact;
import com.netease.nimlib.sdk.team.model.Team;
import com.netease.nimlib.sdk.team.model.TeamMember;
import com.qiyukf.unicorn.api.Unicorn;
import com.qiyukf.unicorn.api.msg.MsgTypeEnum;
import com.qiyukf.unicorn.api.msg.UnicornMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.home.event.ContactTrashEvent;
import com.yizhuan.erban.ui.im.recent.adapter.RecentContactAdapter;
import com.yizhuan.xchat_android_core.customer_server.CustomerServerModel;
import com.yizhuan.xchat_android_core.customer_server.event.CustomerServerMsgEvent;
import com.yizhuan.xchat_android_core.utils.CheckUtils;
import com.yizhuan.xchat_android_core.utils.SystemUidUtil;
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
@@ -115,9 +108,6 @@ public class RecentContactsFragment extends TFragment {
registerObservers(true);
registerDropCompletedListener(true);
registerOnlineStateChangeListener(true);
initKFView();
EventBus.getDefault().register(this);
}
@@ -144,7 +134,7 @@ public class RecentContactsFragment extends TFragment {
private void notifyDataSetChanged() {
adapter.notifyDataSetChanged();
boolean empty = items.isEmpty() && msgLoaded && !isHaveKFHeadView();
boolean empty = items.isEmpty() && msgLoaded;
emptyBg.setVisibility(empty ? View.VISIBLE : View.GONE);
emptyHint.setText("你还没有聊天记录哦!\n快去和好友聊天吧!");
}
@@ -654,14 +644,6 @@ public class RecentContactsFragment extends TFragment {
protected void refreshViewHolderByIndex(final int index) {
if (recyclerView == null) return;
recyclerView.post(() -> adapter.notifyItemChanged(index));
// if (getActivity() == null) return;
// getActivity().runOnUiThread(new Runnable() {
//
// @Override
// public void run() {
// adapter.notifyItemChanged(index);
// }
// });
}
public void setCallback(RecentContactsCallback callback) {
@@ -755,102 +737,9 @@ public class RecentContactsFragment extends TFragment {
}
private View kfView;
private HeadImageView ivKfAvatar;
private TextView tvLastMsg;
private TextView tvMsgCount;
private void initKFView() {
kfView = LayoutInflater.from(getContext()).inflate(R.layout.header_customer_server, null, false);
ivKfAvatar = kfView.findViewById(R.id.iv_kf_avatar);
GlideApp.with(getContext())
.load(CustomerServerModel.AVATAR_URL)
.dontAnimate()
.into(ivKfAvatar);
tvLastMsg = kfView.findViewById(R.id.tv_last_msg);
tvMsgCount = kfView.findViewById(R.id.tv_msg_count);
kfView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CustomerServerModel.getInstance().contactCustomerServer("", "聊天", null).subscribe();
}
});
kfView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
CustomAlertDialog alertDialog = new CustomAlertDialog(getActivity());
alertDialog.setTitle("官方客服");
String title = getString(R.string.main_msg_list_delete_chatting);
alertDialog.addItem(title, new onSeparateItemClickListener() {
@Override
public void onClick() {
Unicorn.clearCache();
removeKFView();
}
});
alertDialog.show();
return true;
}
});
onCustomerServerMsgEvent(new CustomerServerMsgEvent(Unicorn.getUnreadCount()));
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCustomerServerMsgEvent(CustomerServerMsgEvent event) {
UnicornMessage message = Unicorn.queryLastMessage();
if (message != null) {
if (message.getMsgType().equals(MsgTypeEnum.text)) {
tvLastMsg.setText(message.getContent());
} else if (message.getMsgType().equals(MsgTypeEnum.image)) {
tvLastMsg.setText("[图片]");
} else if (message.getMsgType().equals(MsgTypeEnum.audio)) {
tvLastMsg.setText("[语音]");
} else if (message.getMsgType().equals(MsgTypeEnum.video)) {
tvLastMsg.setText("[视频]");
} else {
tvLastMsg.setText("[收到一条消息]");
}
if (!isHaveKFHeadView()) {
addKFView();
}
emptyBg.setVisibility(View.GONE);
}
if (event.unreadCount > 0) {
tvMsgCount.setVisibility(View.VISIBLE);
tvMsgCount.setText(event.unreadCount + "");
} else {
tvMsgCount.setVisibility(View.INVISIBLE);
tvMsgCount.setText("");
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onContactTrashEvent(ContactTrashEvent event) {
NIMClient.getService(MsgService.class).clearAllUnreadCount();
}
private boolean isHaveKFHeadView() {
if (adapter.getHeaderLayout() == null) {
return false;
}
for (int i = 0; i < adapter.getHeaderLayout().getChildCount(); i++) {
if (adapter.getHeaderLayout().getChildAt(i) == kfView) {
return true;
}
}
return false;
}
public void addKFView() {
adapter.addHeaderView(kfView);
adapter.notifyDataSetChanged();
}
public void removeKFView() {
adapter.removeHeaderView(kfView);
adapter.notifyDataSetChanged();
}
}

View File

@@ -2,7 +2,6 @@ package com.yizhuan.erban.ui.login.helper;
import com.yizhuan.xchat_android_core.PreferencesUtils;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.customer_server.CustomerServerModel;
/**
* create by lvzebiao @2019/12/9
@@ -12,7 +11,6 @@ public class LogoutHelper {
public static void logout() {
AuthModel.get().logout().subscribe();
PreferencesUtils.setFristQQ(true);
CustomerServerModel.getInstance().logout();
}
}

View File

@@ -1,23 +1,18 @@
package com.yizhuan.erban.ui.widget;
import android.content.Context;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.msg.MsgService;
import com.yizhuan.erban.R;
import com.yizhuan.xchat_android_core.customer_server.event.CustomerServerMsgEvent;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
import org.greenrobot.eventbus.EventBus;
/**
* <p> 底部tab导航 </p>
* Created by Administrator on 2017/11/14.
@@ -41,7 +36,6 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
private MainRedPointTab.RedPointDismissListener msgListener = new MainRedPointTab.RedPointDismissListener() {
@Override
public void dismiss() {
EventBus.getDefault().post(new CustomerServerMsgEvent(0));
NIMClient.getService(MsgService.class).clearAllUnreadCount();
}
};

View File

@@ -543,7 +543,6 @@
android:layout_marginEnd="@dimen/dp_me_text_padding_to_icon"
android:background="@color/line_353548" />
<TextView
android:id="@+id/me_item_wallet"
android:layout_width="match_parent"

View File

@@ -1,259 +0,0 @@
package com.yizhuan.xchat_android_core.customer_server;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.gson.Gson;
import com.qiyukf.unicorn.api.ConsultSource;
import com.qiyukf.unicorn.api.ImageLoaderListener;
import com.qiyukf.unicorn.api.UICustomization;
import com.qiyukf.unicorn.api.Unicorn;
import com.qiyukf.unicorn.api.UnicornImageLoader;
import com.qiyukf.unicorn.api.UnreadCountChangeListener;
import com.qiyukf.unicorn.api.YSFOptions;
import com.qiyukf.unicorn.api.YSFUserInfo;
import com.qiyukf.unicorn.api.customization.action.BaseAction;
import com.qiyukf.unicorn.api.customization.action.ImageAction;
import com.qiyukf.unicorn.api.customization.input.ActionListProvider;
import com.qiyukf.unicorn.api.customization.input.ActionPanelOptions;
import com.qiyukf.unicorn.api.customization.input.InputPanelOptions;
import com.qiyukf.unicorn.api.msg.OnPushMessageListener;
import com.qiyukf.unicorn.api.msg.PushMessageExtension;
import com.qiyukf.unicorn.api.msg.UnicornMessage;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.XChatApplication;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.base.BaseModel;
import com.yizhuan.xchat_android_core.customer_server.bean.CustomerItemInfo;
import com.yizhuan.xchat_android_core.customer_server.event.CustomerServerMsgEvent;
import com.yizhuan.xchat_android_core.family.model.FamilyModel;
import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Single;
import io.reactivex.SingleEmitter;
import io.reactivex.SingleOnSubscribe;
/**
* @author jack
* @Description
* @Date 2019/3/18
*/
public class CustomerServerModel extends BaseModel implements ICustomerServerModel {
private boolean isInit = false;
private final static String TITLE = "官方客服";
public final static String AVATAR_URL = "https://image.zhongjialx.com/new_kficon.png";
private YSFOptions options;
private YSFUserInfo ysfUserInfo;
private CustomerServerModel() {
EventBus.getDefault().register(this);
}
public static ICustomerServerModel getInstance() {
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder {
private static final CustomerServerModel INSTANCE = new CustomerServerModel();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLoginInfoUpdate(LoginUserInfoUpdateEvent event) {
if (!isInit)
init(XChatApplication.instance().getApplicationContext());
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
if (userInfo != null) {
options.uiCustomization.rightAvatar = userInfo.getAvatar();
ysfUserInfo = new YSFUserInfo();
ysfUserInfo.userId = AuthModel.get().getCurrentUid() + "";
ysfUserInfo.authToken = null;
List<CustomerItemInfo> userData = new ArrayList<>();
userData.add(new CustomerItemInfo("real_name").setValue(UserModel.get().getCacheLoginUserInfo().getNick()));
userData.add(new CustomerItemInfo("mobile_phone").setValue(UserModel.get().getCacheLoginUserInfo().getPhone()));
userData.add(new CustomerItemInfo("email").setValue(""));
userData.add(new CustomerItemInfo("avatar").setValue(UserModel.get().getCacheLoginUserInfo().getAvatar()));
userData.add(new CustomerItemInfo("nick")
.setLabel("用户昵称:")
.setValue(UserModel.get().getCacheLoginUserInfo().getNick())
.setIndex(0));
userData.add(new CustomerItemInfo("gender")
.setLabel("性别:")
.setValue(UserModel.get().getCacheLoginUserInfo().getGender() == 1 ? "" : "")
.setIndex(1));
userData.add(new CustomerItemInfo("erbanNo")
.setLabel("音游号:")
.setValue(UserModel.get().getCacheLoginUserInfo().getErbanNo() + "")
.setIndex(2));
userData.add(new CustomerItemInfo("nobleName")
.setLabel("爵位名称:")
.setValue(UserModel.get().getCacheLoginUserInfo().getNobleInfo() == null ? "无贵族信息" : UserModel.get().getCacheLoginUserInfo().getNobleInfo().getName())
.setIndex(3));
userData.add(new CustomerItemInfo("phone")
.setLabel("手机号:")
.setValue(UserModel.get().getCacheLoginUserInfo().getPhone())
.setIndex(4));
userData.add(new CustomerItemInfo("newUser")
.setLabel("是否新用户:")
.setValue(UserModel.get().getCacheLoginUserInfo().isNewUser() ? "" : "")
.setIndex(5));
userData.add(new CustomerItemInfo("familyName")
.setLabel("家族名称:")
.setValue(FamilyModel.Instance().getMyFamily() == null ? "暂无家族" : FamilyModel.Instance().getMyFamily().getFamilyName())
.setIndex(6));
userData.add(new CustomerItemInfo("familyId")
.setLabel("家族ID")
.setValue(FamilyModel.Instance().getMyFamily() == null ? "暂无家族" : FamilyModel.Instance().getMyFamily().getFamilyId())
.setIndex(7));
ysfUserInfo.data = new Gson().toJson(userData);
Unicorn.setUserInfo(ysfUserInfo);
}
}
@Override
public void init(Context context) {
if (isInit) {
return;
}
isInit = true;
options = new YSFOptions();
options.statusBarNotificationConfig = new com.qiyukf.unicorn.api.StatusBarNotificationConfig();
options.inputPanelOptions = new InputPanelOptions();
options.inputPanelOptions.showActionPanel = true;
options.inputPanelOptions.actionPanelOptions = new ActionPanelOptions();
options.inputPanelOptions.actionPanelOptions.actionListProvider = new ActionListProvider() {
//实现 getActionList 方法返回输入更多弹框的列表SDK 中默认提供了 AlbumAction(相册)、CameraAction(相机)等 Action
@Override
public List<BaseAction> getActionList() {
List<BaseAction> list = new ArrayList<>();
ImageAction imageAction = new ImageAction(com.netease.nim.uikit.R.drawable.nim_message_plus_photo_selector, com.netease.nim.uikit.R.string.input_panel_photo);
imageAction.setActionFontColor(Color.BLACK);
list.add(imageAction);
return list;
}
};
options.uiCustomization = new UICustomization();
options.uiCustomization.titleBarStyle = 0;
options.uiCustomization.titleBackgroundResId = R.drawable.customer_server_title_bar_bg;
options.uiCustomization.leftAvatar = AVATAR_URL;
options.uiCustomization.hideKeyboardOnEnterConsult = true;
options.uiCustomization.titleCenter = true;
options.uiCustomization.buttonBackgroundColorList = R.color.kf_button_color_state_list;
options.uiCustomization.msgItemBackgroundLeft = R.drawable.nim_message_item_left_selector;
options.uiCustomization.msgItemBackgroundRight = R.drawable.nim_message_item_right_selector;
options.uiCustomization.msgBackgroundColor = context.getResources().getColor(R.color.color_f0f0f0);
// appKey 可以在七鱼管理系统->设置->App 接入 页面找到
Unicorn.init(context, XChatConstants.QI_YU_KF_KEY, options, new UnicornImageLoader() {
@Nullable
@Override
public Bitmap loadImageSync(String uri, int width, int height) {
return null;
}
@Override
public void loadImage(String uri, int width, int height, ImageLoaderListener listener) {
if (width <= 0 || height <= 0) {
width = height = Integer.MIN_VALUE;
}
Glide.with(context)
.asBitmap()
.load(uri)
.into(new SimpleTarget<Bitmap>(width, height) {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
if (listener != null) {
listener.onLoadComplete(resource);
}
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
super.onLoadFailed(errorDrawable);
if (listener != null) {
listener.onLoadFailed(new Exception("获取图片失败!"));
}
}
});
}
});
Unicorn.addUnreadCountChangeListener(listener, true);
Unicorn.addPushMessageListener(pushMessageListener);
}
private UnreadCountChangeListener listener = new UnreadCountChangeListener() { // 声明一个成员变量
@Override
public void onUnreadCountChange(int count) {
EventBus.getDefault().post(new CustomerServerMsgEvent(count));
}
};
private OnPushMessageListener pushMessageListener = new OnPushMessageListener() {
@Override
public void onReceive(UnicornMessage message, PushMessageExtension extension) {
EventBus.getDefault().post(new CustomerServerMsgEvent(0));
}
};
@Override
public Single<String> contactCustomerServer(String uri, String title, String custom) {
return Single.create(new SingleOnSubscribe<String>() {
@Override
public void subscribe(SingleEmitter<String> e) throws Exception {
if (!isInit) {
e.onError(new Throwable("客服未初始化!"));
return;
}
if (UserModel.get().getCacheLoginUserInfo() == null) {
e.onError(new Throwable("无用户信息。"));
return;
}
if (!AuthModel.get().isImLogin()) {
e.onError(new Throwable("IM未登录"));
return;
}
ConsultSource source = new ConsultSource(uri, title, custom);
Unicorn.openServiceActivity(getContext(), TITLE, source);
e.onSuccess("客服连接成功");
}
});
}
@Override
public Single<String> logout() {
Unicorn.addUnreadCountChangeListener(listener, false);
Unicorn.removePushMessageListener(pushMessageListener);
Unicorn.logout();
isInit = false; // 切换帐号重新初始化
return Single.just("客服系统登出成功.");
}
}

View File

@@ -1,18 +0,0 @@
package com.yizhuan.xchat_android_core.customer_server;
import android.content.Context;
import io.reactivex.Single;
/**
* @author jack
* @Description
* @Date 2019/3/18
*/
public interface ICustomerServerModel {
public void init(Context context);
public Single<String> contactCustomerServer(String uri, String title, String custom);
Single<String> logout();
}

View File

@@ -1,45 +0,0 @@
package com.yizhuan.xchat_android_core.customer_server.bean;
/**
* @author jack
* @Description @link YSFUserInfo
* @Date 2019/3/18
*/
public class CustomerItemInfo {
private String key;//数据项的名称,用于区别不同的数据。
private int index;//用于排序显示数据时数据项按index值升序排列不设定index的数据项将排在后面index相同或未设定的数据项将按照其在 JSON 中出现的顺序排列。
private String label;//该项数据显示的名称。
private String value;//该数据显示的值,类型不做限定,根据实际需要进行设定。
private String href;//超链接地址。若指定该值,则该项数据将显示为超链接样式,点击后跳转到其值所指定的 URL 地址。
private boolean hidden;//是否隐藏该item。目前仅对mobile和email有效。
public CustomerItemInfo(String key) {
this.key = key;
}
public CustomerItemInfo setIndex(int index) {
this.index = index;
return this;
}
public CustomerItemInfo setLabel(String label) {
this.label = label;
return this;
}
public CustomerItemInfo setValue(String value) {
this.value = value;
return this;
}
public CustomerItemInfo setHref(String href) {
this.href = href;
return this;
}
public CustomerItemInfo setHidden(boolean hidden) {
this.hidden = hidden;
return this;
}
}

View File

@@ -1,14 +0,0 @@
package com.yizhuan.xchat_android_core.customer_server.event;
/**
* @author jack
* @Description
* @Date 2019/3/19
*/
public class CustomerServerMsgEvent {
public int unreadCount = 0;
public CustomerServerMsgEvent(int count) {
this.unreadCount = count;
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_CCCCCC" android:state_enabled="false" />
<item android:color="@color/orainge" android:state_pressed="true" />
<item android:color="@color/appColor" />
</selector>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white" />
</shape>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="@color/red" />
<size android:height="16dp" />
</shape>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="70dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="10dp">
<com.netease.nim.uikit.common.ui.imageview.HeadImageView
android:id="@+id/iv_kf_avatar"
android:layout_width="55dp"
android:layout_height="55dp"
tools:src="@drawable/default_avatar" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="官方客服"
android:textColor="@color/color_333333"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_last_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_B3B3B3"
android:textSize="12sp"
tools:text="官方客服" />
</LinearLayout>
<TextView
android:id="@+id/tv_msg_count"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:background="@drawable/shape_unread_msg_dot"
android:gravity="center"
android:minWidth="16dp"
android:text="12"
android:textColor="@color/color_white"
android:textSize="11sp" />
</LinearLayout>

View File

@@ -26,7 +26,6 @@ import com.yizhuan.erban.miniworld.viewmodel.MiniWorldEditableInfoVM;
import com.yizhuan.erban.miniworld.widget.MiniWorldEditChooseClassifyDialog;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.ButtonItem;
import com.yizhuan.xchat_android_core.customer_server.CustomerServerModel;
import com.yizhuan.xchat_android_core.file.FileModel;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
@@ -315,8 +314,6 @@ public class MiniWorldEditActivity extends BaseMvpActivity<IMiniWorldEditView, M
showTakeOrSelectPicDialog();
} else if (id == R.id.tv_world_edit_save) {// 保存修改
getMvpPresenter().saveEditWorldInfo();
} else if (id == R.id.tv_world_edit_question) {// 联系客服
CustomerServerModel.getInstance().contactCustomerServer("", "话题编辑页面", null).subscribe();
}
}

View File

@@ -50,7 +50,7 @@ android {
'src/model_channel_page/java'
]
jniLibs.srcDirs = ['libs', 'umeng-app-libs/jniLibs', 'shumei-tianwang-libs/jniLibs']
jniLibs.srcDirs = ['libs', 'umeng-app-libs/jniLibs']
}
}
@@ -97,9 +97,6 @@ dependencies {
// 易盾
api 'com.netease.mobsec:netmobsecLib:4.2.4.1@aar'
// 数美-天网
api fileTree(dir: 'shumei-tianwang-libs', include: ['*.jar'])
// core
implementation 'com.liulishuo.okdownload:okdownload:1.0.4'
// provide sqlite to store breakpoints