Commit ffa78235 by konghaorui

补充咨询api

parent e206b6d5
......@@ -4,29 +4,30 @@ package com.ydl.component.base;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Build;
import android.os.Process;
import android.support.annotation.RequiresApi;
import com.channel.ydl_flutter_base.base.BaseFlutterActivity;
import com.channel.ydl_flutter_base.plugin.YDLCommonPlugin;
import com.ydl.devicesidlib.DeviceIDHelper;
import com.meituan.android.walle.WalleChannelReader;
import com.netease.nimlib.sdk.util.NIMUtil;
import com.tencent.bugly.crashreport.CrashReport;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;
import com.ydl.audioim.YDLavManager;
import com.ydl.component.BuildConfig;
import com.ydl.component.MainActivity;
import com.ydl.media.audio.PlayService;
import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.base.delegate.IAppLifecycles;
import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
import com.yidianling.course.lifeCallback.CoursePlayLifecycle;
import com.yidianling.im.config.NimApplication;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.TimeUnit;
import io.flutter.app.FlutterActivityDelegate;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.view.FlutterMain;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by haorui on 2019-09-02.
......@@ -39,30 +40,127 @@ public class DemoAppLifecycles implements IAppLifecycles {
}
@RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onCreate(@NotNull Application application) {
//数据埋点初始化--一定要放在主进程中
YdlBuryPointUtil.init(application);
//设备ID初始化
DeviceIDHelper.getInstance().init(application);
//模块初始化
moduleInit(application);
if (NIMUtil.isMainProcess(application)) {
//第三方SDK初始化
initThirdServiceSDK(application);
//Flutter 初始化需要在主线程中执行
FlutterMain.startInitialization(application);
// FlutterMain.ensureInitializationComplete(application, null);
//
// FlutterEngine flutterEngine = new FlutterEngine(application);
// flutterEngine.getDartExecutor().executeDartEntrypoint(DartExecutor.DartEntrypoint.createDefault());
// YDLCommonPlugin plugin = new YDLCommonPlugin();
// flutterEngine.getLocalizationChannel().channel.setMethodCallHandler(plugin);
// FlutterMain.ensureInitializationComplete(application, null);
//
// FlutterEngine flutterEngine = new FlutterEngine(application);
// flutterEngine.getDartExecutor().executeDartEntrypoint(DartExecutor.DartEntrypoint.createDefault());
// YDLCommonPlugin plugin = new YDLCommonPlugin();
// flutterEngine.getLocalizationChannel().channel.setMethodCallHandler(plugin);
Intent intent = new Intent(application, PlayService.class);
application.startService(intent);
application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
}
}
@Override
public void onTerminate(@NotNull Application application) {
}
private void moduleInit(Application application) {
NimApplication.getInstance().initIm(application, MainActivity.class);
}
private void initThirdServiceSDK(Application application) {
new Thread() {
@Override
public void run() {
super.run();
//设置线程优先级,不与主线程抢资源
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
//子线程中初始化X5内核,防止ANR问题
initX5();
//数据埋点初始化--一定要放在主进程中
YdlBuryPointUtil.init(application);
if (DemoGlobalConfig.appEnv.equals(YDLConstants.ENV_PROD)){
YDLavManager.Companion.getInstances().init(application, "3387e9b251f3491e9221a9877e8f7830");
}else {
YDLavManager.Companion.getInstances().init(application, "13b1536698f64905a1e7e5bb978ba821");
}
//bugly
String packageName = application.getPackageName();
String channel = WalleChannelReader.getChannel(application);
if (channel == null || channel.equals("null")) {
channel = "test";
}
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(application);
strategy.setAppChannel(channel);
String appkey = BuildConfig.DEBUG ? "630a3a5cea" : "3939e71afa";
CrashReport.initCrashReport(application, appkey, BuildConfig.DEBUG, strategy);
//umeng
String umAppkey = null;
if (packageName.endsWith("yidianling")) {
umAppkey = "56970affe0f55a9cda001e24";
channel = "android_" + channel;
initUM(umAppkey, channel,application);
PlatformConfig.setWeixin("wx57a9d930270498c7", "17c031f02500ded3457a80e69d8e5e45");
}
PlatformConfig.setQQZone("1105070461", "6BvkUnk6wXJekcgR");
MobclickAgent.setScenarioType(application, MobclickAgent.EScenarioType.E_DUM_NORMAL);
MobclickAgent.setCatchUncaughtExceptions(!BuildConfig.DEBUG);
//开启友盟集成测试
UMConfigure.setLogEnabled(BuildConfig.DEBUG);
//安全检测
//YDLAppProtector.init();
}
}.start();
}
private void initUM(String umAppKey, String channel, Application application) {
/**
* 初始化common库
* 参数1:上下文,不能为空
* 参数2:友盟 app key
* 参数3:友盟 channel
* 参数4:设备类型,UMConfigure.DEVICE_TYPE_PHONE为手机、UMConfigure.DEVICE_TYPE_BOX为盒子,默认为手机
* 参数5:Push推送业务的secret
*/
UMConfigure.init(application, umAppKey, channel, UMConfigure.DEVICE_TYPE_PHONE, null);
UMShareAPI.init(application, umAppKey);
}
/**
* 初始化X5内核
*/
private void initX5() {
// if (!QbSdk.isTbsCoreInited()) {//// preinit只需要调用一次,如果已经完成了初始化,那么就直接构造view
// QbSdk.preInit(application, null);// 设置X5初始化完成的回调接口
// }
//
// QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
//
// @Override
// public void onViewInitFinished(boolean arg0) {
// //初始化完成回调
// }
//
// @Override
// public void onCoreInitFinished() {
// }
// };
// QbSdk.initX5Environment(application, cb);
}
}
\ No newline at end of file
......@@ -2,11 +2,13 @@
package com.ydl.component.base;
import android.content.Context;
import com.ydl.component.BuildConfig;
import com.ydl.ydlcommon.base.config.IConfigModule;
import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.base.delegate.IAppLifecycles;
import com.ydl.ydlcommon.base.config.GlobalConfig;
import org.jetbrains.annotations.NotNull;
import java.util.List;
......@@ -17,6 +19,9 @@ import java.util.List;
*/
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// String appEnv = YDLConstants.ENV_AUTO_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
// String appEnv = YDLConstants.ENV_TEST;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......@@ -25,13 +30,11 @@ public final class DemoGlobalConfig implements IConfigModule {
@Override
public void applyOptions(@NotNull Context context, @NotNull GlobalConfig.Builder builder) {
// String env = YDLConstants.ENV_AUTO_TEST;
// String env = YDLConstants.ENV_PROD;
String env = YDLConstants.ENV_TEST;
builder.setFrom( "ydl".equals(BuildConfig.FLAVOR) ?YDLConstants.FROM_YDL :YDLConstants.FROM_XLZX)
builder.setFrom("ydl".equals(BuildConfig.FLAVOR) ? YDLConstants.FROM_YDL : YDLConstants.FROM_XLZX)
.addUrl("github", APP_DOMAIN)
.setEnv(env)
.setEnv(appEnv)
.setDebug(BuildConfig.DEBUG);
}
}
package com.yidianling.consultant.data
import com.yidianling.router.consultant.Keyworks
import com.yidianling.consultant.bean.Keyworks
interface ConsultantRam {
......
package com.yidianling.consultant.data
import com.yidianling.router.consultant.Keyworks
import com.yidianling.consultant.bean.Keyworks
class ConsultantRamImpl private constructor(): ConsultantRam {
......
......@@ -2,8 +2,12 @@ package com.yidianling.consultant.modular
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.Keyworks
import com.yidianling.consultant.data.ConsultantDataManager
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
/**
......@@ -15,6 +19,18 @@ class ConsultantServiceImp: IConsultantService {
override fun init(context: Context?) {
}
override fun expertSearchIntent(activity: Activity, category: Int, showType: Int, isInitShowHot: Boolean): Intent {
return ExpertSearchActivity.newIntent(activity, category, showType, isInitShowHot)
}
override fun getHotSearch(): MutableList<Keyworks> {
return ConsultantDataManager.getRam().getHotSearch();
}
override fun setHotSearch(hotSearch: MutableList<Keyworks>) {
return ConsultantDataManager.getRam().setHotSearch(hotSearch);
}
/**
* 首页咨询助理入口
*/
......
......@@ -2,22 +2,50 @@ package com.yidianling.consultant.router
import android.app.Activity
import android.content.Intent
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.ydl.ydlcommon.utils.LogUtil
import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.data.ConsultantDataManager
import com.yidianling.router.consultant.IConsultantRouter
import com.yidianling.router.consultant.Keyworks
class ConsultantRouterImp : IConsultantRouter{
val gson: Gson = Gson()
override fun expertSearchIntent(activity: Activity, category: Int, showType: Int, isInitShowHot: Boolean): Intent {
return ExpertSearchActivity.newIntent(activity, category, showType, isInitShowHot)
}
override fun getHotSearch(): MutableList<Keyworks> {
return ConsultantDataManager.getRam().getHotSearch();
val hotSearch = ConsultantDataManager.getRam().getHotSearch()
if (hotSearch.size==0){
return mutableListOf()
}
val list = try {
val jsonStr = gson.toJson(hotSearch)
gson.fromJson<MutableList<Keyworks>>(jsonStr, object : TypeToken<MutableList<Keyworks>>() {
}.type)
} catch (e: Exception) {
LogUtil.e(e.message)
return mutableListOf()
}
return list
}
override fun setHotSearch(hotSearch: MutableList<Keyworks>) {
return ConsultantDataManager.getRam().setHotSearch(hotSearch);
if (hotSearch.size==0){
return
}
val list: MutableList<com.yidianling.consultant.bean.Keyworks> = try {
val jsonStr = gson.toJson(hotSearch)
Gson().fromJson<MutableList<com.yidianling.consultant.bean.Keyworks>>(jsonStr, object : TypeToken<MutableList<com.yidianling.consultant.bean.Keyworks>>() {
}.type)
} catch (e: Exception) {
LogUtil.e(e.message)
mutableListOf()
}
return ConsultantDataManager.getRam().setHotSearch(list)
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yidianling.consultant.api
import android.app.Activity
import com.alibaba.android.arouter.facade.template.IProvider
import com.yidianling.consultant.bean.Keyworks
/**
* Created by xj on 2019/11/14.
......@@ -11,4 +12,11 @@ interface IConsultantService: IProvider {
fun showConsultAssistantDialog(activity: Activity)
// 隐藏咨询助理弹框
fun hideConsultAssistantDialog()
fun expertSearchIntent(activity: android.app.Activity, category: kotlin.Int, showType: kotlin.Int, isInitShowHot: kotlin.Boolean): android.content.Intent
fun getHotSearch(): kotlin.collections.MutableList<Keyworks>
fun setHotSearch(hotSearch: kotlin.collections.MutableList<Keyworks>): kotlin.Unit
}
\ No newline at end of file
package com.yidianling.consultant.bean
import android.support.annotation.Keep
/**
* Created by haorui on 2019/3/3.
* Des:
*/
@Keep
class Keyworks {
/**
* id
*/
var id: Int = 0
/**
* 跳转地址
*/
var url: String? = null
/**
* 关键字
*/
var keyword: String? = null
}
\ No newline at end of file
......@@ -21,12 +21,11 @@ import com.yidianling.im.preference.IMCache;
import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.SessionHelper;
import com.yidianling.nimbase.api.UIKitOptions;
import com.yidianling.router.RouterManager;
import com.yidianling.router.user.UserResponse;
import com.yidianling.uikit.api.NimUIKit;
import com.yidianling.uikit.business.team.helper.TeamHelper;
import com.yidianling.uikit.business.uinfo.UserInfoHelper;
import com.yidianling.uikit.custom.config.YDLToolBarOptions;
import com.yidianling.user.api.bean.UserResponseBean;
import de.greenrobot.event.EventBus;
......@@ -70,7 +69,7 @@ public class NimApplication {
// 如果已经存在用户登录信息,返回LoginInfo,否则返回null即可
private LoginInfo loginInfo(){
UserResponse loginBean = RouterManager.INSTANCE.getUserRouter().getUserResponse();
UserResponseBean loginBean = ImIn.INSTANCE.getUserResponse();
if(loginBean != null) {
IMCache.setAccount(loginBean.getUid());
}
......
......@@ -20,8 +20,8 @@ import com.yidianling.im.config.constants.UserPreferences
import com.yidianling.im.preference.IMCache
import com.yidianling.router.RouterManager
import com.yidianling.router.app.ReceiveRedPacketParam
import com.yidianling.router.user.UserResponse
import com.yidianling.uikit.api.NimUIKit
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.service.IUserService
/**
......@@ -51,17 +51,14 @@ object ImIn {
}
fun closeMeidplayer(){
RouterManager.getCourseRouter()?.closePlayer()
RouterManager.getFMRouter()?.closePlayer()
}
/**
* 更新用户设置
*/
fun setChatTeamHisShowed(){
RouterManager.getUserRouter()?.setChatTeamHisShowed(true)
getUserService()?.setChatTeamHisShowed(true)
}
/**
......@@ -126,14 +123,6 @@ object ImIn {
return RouterManager.getAppRouter()?.sendRedPacketIntent(activity, toUid)
}
fun testDetailIntent(activity: Activity, testId: Int): Intent? {
return RouterManager.getTestsRouter()?.testDetailIntent(activity, testId)
}
fun testResultIntent(activity: Activity, testId: Int): Intent? {
return RouterManager.getTestsRouter()?.testResultIntent(activity, testId)
}
fun testResultH5(testResultId: Int){
RouterManager.getTestsRouter()!!.testH5Result(testResultId.toString())
}
......@@ -148,7 +137,7 @@ object ImIn {
fun inputPhoneIntent(activity: Activity, smsAction: String): Intent? {
return RouterManager.getUserRouter()?.inputPhoneIntent(activity, smsAction)
return getUserService()?.inputPhoneIntent(activity, smsAction)
}
/**
......@@ -239,22 +228,23 @@ object ImIn {
}
fun isLogin(): Boolean {
return RouterManager.getUserRouter()?.isLogin()?:false
return getUserService()?.isLogin()?:false
}
fun getUserInfo(): UserResponse.UserInfo? {
return RouterManager.getUserRouter()?.getUserInfo()
fun getUserInfo(): UserResponseBean.UserInfo? {
return getUserService().getUserInfo()
}
fun getUserResponse():UserResponse?{
return RouterManager.getUserRouter()?.getUserResponse()
fun getUserResponse():UserResponseBean?{
return getUserService().getUserResponse()
}
fun getChatTeamHisShow(): Boolean {
return RouterManager.getUserRouter()?.getChatTeamHisShow()?:false
return getUserService().getChatTeamHisShow()?:false
}
fun loginWayIntent(context: Context): Intent? {
return RouterManager.getUserRouter()?.loginWayIntent(context)
return getUserService().loginWayIntent(context)
}
/* fun mainIntent(context: Context): Intent? {
......
......@@ -91,7 +91,7 @@ import com.yidianling.nimbase.api.model.session.SessionCustomization;
import com.yidianling.nimbase.api.model.session.SessionEventListener;
import com.yidianling.nimbase.business.session.actions.BaseAction;
import com.yidianling.nimbase.impl.cache.TeamDataCache;
import com.yidianling.router.user.UserResponse;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.uikit.api.NimUIKit;
import com.yidianling.uikit.business.session.actions.ImageAction;
import com.yidianling.uikit.business.session.actions.VideoAction;
......@@ -170,7 +170,7 @@ public class SessionHelper {
}
}
};
UserResponse userInfo = ImIn.INSTANCE.getUserResponse();
UserResponseBean userInfo = ImIn.INSTANCE.getUserResponse();
String imAccount = "", imToken = "";
if (userInfo != null) {
imAccount = userInfo.getUid();
......
......@@ -17,13 +17,12 @@ import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.extension.CustomAttachRedPacket;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.router.app.ReceiveRedPacketParam;
import com.yidianling.router.user.UserResponse;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import com.yidianling.user.api.bean.UserResponseBean;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by wi1ls on 2017/1/10.
*/
......@@ -73,7 +72,7 @@ public class MsgViewHolderRedPacket extends MsgViewHolderBase {
UserInfoCache.YDLUser user = UserInfoCache.getInstance().getUser(data.to_uid);
if ((ImIn.INSTANCE.getUserInfo().getUid() + "").equals(data.uid)) {
UserResponse.UserInfo userInfo = ImIn.INSTANCE.getUserInfo();
UserResponseBean.UserInfo userInfo = ImIn.INSTANCE.getUserInfo();
ReceiveRedPacketParam param = new ReceiveRedPacketParam(
data.status,
data.money,
......
......@@ -19,7 +19,7 @@ import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.extension.CustomAttachmentRedStatus;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.router.app.ReceiveRedPacketParam;
import com.yidianling.router.user.UserResponse;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import io.reactivex.android.schedulers.AndroidSchedulers;
......@@ -78,7 +78,7 @@ public class MsgViewHolderRedStatus extends MsgViewHolderBase {
UserInfoCache.YDLUser user = UserInfoCache.getInstance().getUser(data.to_uid);
if ((ImIn.INSTANCE.getUserInfo().getUid() + "").equals(data.uid)) {
UserResponse.UserInfo userInfo = ImIn.INSTANCE.getUserInfo();
UserResponseBean.UserInfo userInfo = ImIn.INSTANCE.getUserInfo();
ReceiveRedPacketParam param = new ReceiveRedPacketParam(
data.status,
data.money,
......
......@@ -15,7 +15,7 @@ import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.extension.CustomAttachmentShareMsg;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.router.user.UserResponse;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import io.reactivex.android.schedulers.AndroidSchedulers;
......@@ -118,7 +118,7 @@ public class MsgViewHolderShareMsg extends MsgViewHolderBase {
if(mSubscribe != null && !mSubscribe.isDisposed()){
mSubscribe.dispose();
}
UserResponse userInfo = ImIn.INSTANCE.getUserResponse();
UserResponseBean userInfo = ImIn.INSTANCE.getUserResponse();
mSubscribe = ImRetrofitApi.Companion.getImJavaApi().getPushConfideStatus(userInfo.getUid(), message.getFromAccount()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(it -> {
if ("200".equals(it.code)) {
PushConfideStatusBean data = it.data;
......
......@@ -53,7 +53,7 @@ dependencies {
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-platform')
implementation fileTree(dir: 'libs', include: ['*.jar'])
api fileTree(dir: 'libs', include: ['*.jar'])
implementation modularPublication('com.ydl:m-user-api')
}else {
//发布时使用
......
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