Commit 3ce007cb by 严久程

导医的入口和跳转

parent f4080b07
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = false dev_mode = true
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.74", "m-confide" : "0.0.48.74",
"m-consultant" : "0.0.59.27", "m-consultant" : "0.0.59.29",
"m-fm" : "0.0.30.00", "m-fm" : "0.0.30.00",
"m-user" : "0.0.60.21", "m-user" : "0.0.60.22",
"m-home" : "0.0.22.20", "m-home" : "0.0.22.20",
"m-im" : "0.0.18.15", "m-im" : "0.0.18.15",
"m-dynamic" : "0.0.7.9", "m-dynamic" : "0.0.7.9",
...@@ -21,7 +21,7 @@ ext { ...@@ -21,7 +21,7 @@ ext {
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.1", "m-confide-api" : "0.0.2.1",
"m-consultant-api": "0.0.5.3", "m-consultant-api": "0.0.5.4",
"m-course-api" : "0.0.3.6", "m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3", "m-fm-api" : "0.0.3",
"m-muse-api" : "0.0.1", "m-muse-api" : "0.0.1",
...@@ -102,7 +102,7 @@ ext { ...@@ -102,7 +102,7 @@ ext {
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.1", "m-confide-api" : "0.0.2.1",
"m-consultant-api": "0.0.5.3", "m-consultant-api": "0.0.5.4",
"m-course-api" : "0.0.3.6", "m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3", "m-fm-api" : "0.0.3",
"m-muse-api" : "0.0.1", "m-muse-api" : "0.0.1",
......
...@@ -61,6 +61,14 @@ class ConsultantServiceImp : IConsultantService { ...@@ -61,6 +61,14 @@ class ConsultantServiceImp : IConsultantService {
ConsultAssistantDialogUtils.INSTANCE.hideFromHomePage() ConsultAssistantDialogUtils.INSTANCE.hideFromHomePage()
} }
override fun showConsultAssistantMineDialog(activity: Activity) {
ConsultAssistantDialogUtils.INSTANCE.fitRequest(activity, "mine_index")
}
override fun hideConsultAssistantMineDialog() {
ConsultAssistantDialogUtils.INSTANCE.hideFromMine()
}
override fun startExpertSearchActivity( override fun startExpertSearchActivity(
mContext: Context, mContext: Context,
category: Int, category: Int,
......
...@@ -2,25 +2,21 @@ package com.yidianling.consultant.modular.singlton ...@@ -2,25 +2,21 @@ package com.yidianling.consultant.modular.singlton
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.SharedPreferences
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.text.TextUtils import android.text.TextUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YdlBuryPointUtil import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ConsultAssistantCenterActivity import com.yidianling.consultant.ConsultAssistantCenterActivity
import com.yidianling.consultant.constants.ConsultBIConstants import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.dialog.ConsultAssistantDialog import com.yidianling.consultant.dialog.ConsultAssistantDialog
import com.yidianling.consultant.model.SearchApi import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.router.ConsultantIn import com.yidianling.consultant.router.ConsultantIn
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import java.util.*
/** /**
* Created by xj on 2019/11/14. * Created by xj on 2019/11/14.
...@@ -32,6 +28,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -32,6 +28,7 @@ class ConsultAssistantDialogUtils private constructor() {
} }
var consultAssistantDialogFromHomePage: ConsultAssistantDialog? = null // 首页展示的dialog var consultAssistantDialogFromHomePage: ConsultAssistantDialog? = null // 首页展示的dialog
var consultAssistantDialogFromMine: ConsultAssistantDialog? = null // 我的展示的dialog
var consultAssistantFragmentDialog: ConsultAssistantDialog? = null //咨询师列表fragment页面展示的dialog var consultAssistantFragmentDialog: ConsultAssistantDialog? = null //咨询师列表fragment页面展示的dialog
var expertSearchPageHasShown: Boolean = false // 专家咨询列表fragment页面是否已经展示 var expertSearchPageHasShown: Boolean = false // 专家咨询列表fragment页面是否已经展示
var consultAssistantActivityDialog: ConsultAssistantDialog? = null //咨询师列表activity页面展示的dialog var consultAssistantActivityDialog: ConsultAssistantDialog? = null //咨询师列表activity页面展示的dialog
...@@ -59,6 +56,13 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -59,6 +56,13 @@ class ConsultAssistantDialogUtils private constructor() {
shouldShowDialog(activity, origin, fromActivity = fromActivity) shouldShowDialog(activity, origin, fromActivity = fromActivity)
} }
} }
"mine_index" -> {
if (ConsultantIn.isLogin() &&
ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1
) {
shouldShowDialog(activity, origin)
}
}
} }
} }
...@@ -66,18 +70,13 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -66,18 +70,13 @@ class ConsultAssistantDialogUtils private constructor() {
/** /**
* 判断是否符合接口展示逻辑 * 判断是否符合接口展示逻辑
*/ */
@SuppressLint("CheckResult")
private fun shouldShowDialog( private fun shouldShowDialog(
activity: Activity, activity: Activity,
origin: String, origin: String,
fromActivity: Boolean = false fromActivity: Boolean = false
) { ) {
// if (origin == "home_index") {
// showFromYdlHome(activity)
// } else if (origin == "doctor_list") {
// show(activity, fromActivity)
// }
// 请求接口判断导医咨询助理按钮是否展示 // 请求接口判断导医咨询助理按钮是否展示
SearchApi.getSearchApi().getConsultAssistantRequest(origin) SearchApi.getSearchApi().getConsultAssistantRequest(origin)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -88,6 +87,8 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -88,6 +87,8 @@ class ConsultAssistantDialogUtils private constructor() {
showFromYdlHome(activity) showFromYdlHome(activity)
} else if (origin == "doctor_list") { } else if (origin == "doctor_list") {
show(activity, fromActivity) show(activity, fromActivity)
} else if (origin == "mine_index") {
showFromMine(activity)
} }
} }
} }
...@@ -108,6 +109,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -108,6 +109,7 @@ class ConsultAssistantDialogUtils private constructor() {
//获取用户uid //获取用户uid
ActionCountUtils.count("main_page|main_daoyi_entry_click") ActionCountUtils.count("main_page|main_daoyi_entry_click")
YdlBuryPointUtil.sendClick("home_page_assistant_click") YdlBuryPointUtil.sendClick("home_page_assistant_click")
ActionCountUtils.count("daoyi_advertisement_click", "1")
getConsultAssistantUid(activity) getConsultAssistantUid(activity)
} }
...@@ -126,6 +128,40 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -126,6 +128,40 @@ class ConsultAssistantDialogUtils private constructor() {
////////////////////////////////////// 首页的展示隐藏逻辑 代码块end /////////////////////////////////////////////////// ////////////////////////////////////// 首页的展示隐藏逻辑 代码块end ///////////////////////////////////////////////////
////////////////////////////////////// 我的展示隐藏逻辑 代码块start ///////////////////////////////////////////////////
/**
* 我的页展示
*/
fun showFromMine(activity: Activity) {
if (!activity.isFinishing) {
if (consultAssistantDialogFromMine == null) {
consultAssistantDialogFromMine = ConsultAssistantDialog(
activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() {
//获取用户uid
ActionCountUtils.count("daoyi_advertisement_click", "4")
getConsultAssistantUid(activity)
}
})
}
consultAssistantDialogFromMine?.show()
}
}
/**
* 我的隐藏
*/
fun hideFromMine() {
consultAssistantDialogFromMine?.hide()
}
////////////////////////////////////// 我的展示隐藏逻辑 代码块end ///////////////////////////////////////////////////
////////////////////////////////////// 咨询师列表页面的展示隐藏逻辑 代码块start /////////////////////////////////////////////////// ////////////////////////////////////// 咨询师列表页面的展示隐藏逻辑 代码块start ///////////////////////////////////////////////////
/** /**
* 咨询师列表页展示 * 咨询师列表页展示
...@@ -160,6 +196,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -160,6 +196,7 @@ class ConsultAssistantDialogUtils private constructor() {
activity, activity,
object : ConsultAssistantDialog.OnConsultAssistantClickListener { object : ConsultAssistantDialog.OnConsultAssistantClickListener {
override fun onClickAction() { override fun onClickAction() {
ActionCountUtils.count("daoyi_advertisement_click", "6")
ActionCountUtils.count("app_consult_list_page|app_consult_list_daoyi_entry_click") ActionCountUtils.count("app_consult_list_page|app_consult_list_daoyi_entry_click")
YdlBuryPointUtil.sendClick("assistant_list_click") YdlBuryPointUtil.sendClick("assistant_list_click")
// 咨询师列表页面且未登录情况下,跳转登录页面 // 咨询师列表页面且未登录情况下,跳转登录页面
...@@ -222,12 +259,14 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -222,12 +259,14 @@ class ConsultAssistantDialogUtils private constructor() {
*/ */
fun resetStatus() { fun resetStatus() {
consultAssistantDialogFromHomePage?.dismiss() consultAssistantDialogFromHomePage?.dismiss()
consultAssistantDialogFromMine?.dismiss()
consultAssistantFragmentDialog?.dismiss() consultAssistantFragmentDialog?.dismiss()
consultAssistantActivityDialog?.dismiss() consultAssistantActivityDialog?.dismiss()
expertSearchPageHasShown = false expertSearchPageHasShown = false
expertSearchActivityPageHasShown = false expertSearchActivityPageHasShown = false
consultAssistantDialogFromHomePage = null consultAssistantDialogFromHomePage = null
consultAssistantDialogFromMine = null
consultAssistantFragmentDialog = null consultAssistantFragmentDialog = null
consultAssistantActivityDialog = null consultAssistantActivityDialog = null
} }
...@@ -246,24 +285,24 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -246,24 +285,24 @@ class ConsultAssistantDialogUtils private constructor() {
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun getConsultAssistantUid(activity: Activity) { fun getConsultAssistantUid(activity: Activity) {
ActionCountUtils.count(ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK,"1") ActionCountUtils.count(ConsultBIConstants.POSITION_DAOYI_ADVERTISEMENT_CLICK, "1")
// 请求接口获取咨询助理的uid // 请求接口获取咨询助理的uid
SearchApi.getSearchApi().getConsultAssistantUidRequest(1) SearchApi.getSearchApi().getConsultAssistantUidRequest(1)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( Consumer { .subscribe(Consumer {
if (it.code == "200" && it.data != 0.toLong() && null != activity) { if (it.code == "200" && it.data != 0.toLong() && null != activity) {
ConsultantIn.startP2PSession(activity as AppCompatActivity, it.data.toString()) ConsultantIn.startP2PSession(activity as AppCompatActivity, it.data.toString())
} else { } else {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试") ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
} }
if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish() if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish()
}, object: ThrowableConsumer() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish() if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish()
} }
} }
) )
} }
// 判定是否展示左侧的描述文本 // 判定是否展示左侧的描述文本
...@@ -271,7 +310,10 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -271,7 +310,10 @@ class ConsultAssistantDialogUtils private constructor() {
if (TextUtils.isEmpty(SharedPreferencesEditor.getString(ASSISTANT_DIALOG_SP_TAG))) { if (TextUtils.isEmpty(SharedPreferencesEditor.getString(ASSISTANT_DIALOG_SP_TAG))) {
//如果没有缓存,则展示 //如果没有缓存,则展示
return true return true
}else if (System.currentTimeMillis() - SharedPreferencesEditor.getString(ASSISTANT_DIALOG_SP_TAG).toLong() > 24 * 60 * 60 * 1000) { } else if (System.currentTimeMillis() - SharedPreferencesEditor.getString(
ASSISTANT_DIALOG_SP_TAG
).toLong() > 24 * 60 * 60 * 1000
) {
//如果缓存时间超过一天,则展示 //如果缓存时间超过一天,则展示
return true return true
} }
...@@ -280,6 +322,7 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -280,6 +322,7 @@ class ConsultAssistantDialogUtils private constructor() {
fun setDescHide() { fun setDescHide() {
consultAssistantDialogFromHomePage?.setDescHide() consultAssistantDialogFromHomePage?.setDescHide()
consultAssistantDialogFromMine?.setDescHide()
consultAssistantActivityDialog?.setDescHide() consultAssistantActivityDialog?.setDescHide()
consultAssistantFragmentDialog?.setDescHide() consultAssistantFragmentDialog?.setDescHide()
} }
......
...@@ -16,6 +16,11 @@ interface IConsultantService: IProvider { ...@@ -16,6 +16,11 @@ interface IConsultantService: IProvider {
// 隐藏咨询助理弹框 // 隐藏咨询助理弹框
fun hideConsultAssistantDialog() fun hideConsultAssistantDialog()
// 显示咨询助理弹框
fun showConsultAssistantMineDialog(activity: Activity)
// 隐藏咨询助理弹框
fun hideConsultAssistantMineDialog()
fun resetConsultAssistantDialogStatus() fun resetConsultAssistantDialogStatus()
fun expertSearchIntent(activity: android.app.Activity, category: kotlin.Int, showType: kotlin.Int, isInitShowHot: kotlin.Boolean): android.content.Intent fun expertSearchIntent(activity: android.app.Activity, category: kotlin.Int, showType: kotlin.Int, isInitShowHot: kotlin.Boolean): android.content.Intent
......
...@@ -91,6 +91,7 @@ dependencies { ...@@ -91,6 +91,7 @@ dependencies {
implementation modularPublication('com.ydl:m-im-api') implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-fm-api') implementation modularPublication('com.ydl:m-fm-api')
implementation modularPublication('com.ydl:m-dynamic-api') implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-consultant-api')
}else { }else {
//发布时使用 //发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"] compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
...@@ -98,6 +99,7 @@ dependencies { ...@@ -98,6 +99,7 @@ dependencies {
compileOnly rootProject.ext.dependencies["ydl-m-im-api"] compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"] compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"] compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies['ydl-m-consultant-api']
api rootProject.ext.dependencies["ydl-webview"] api rootProject.ext.dependencies["ydl-webview"]
api rootProject.ext.dependencies["ydl-pay"] api rootProject.ext.dependencies["ydl-pay"]
api(rootProject.ext.dependencies["ydl-platform"]) { api(rootProject.ext.dependencies["ydl-platform"]) {
......
...@@ -29,6 +29,7 @@ import com.ydl.ydlcommon.utils.YdlBuryPointUtil; ...@@ -29,6 +29,7 @@ import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
import com.ydl.ydlcommon.view.JumpTextView; import com.ydl.ydlcommon.view.JumpTextView;
import com.ydl.ydlcommon.view.dialog.YDLShareDialog; import com.ydl.ydlcommon.view.dialog.YDLShareDialog;
import com.ydl.ydlcommon.view.widgets.BorderCircleImageView; import com.ydl.ydlcommon.view.widgets.BorderCircleImageView;
import com.yidianling.consultant.api.IConsultantService;
import com.yidianling.dynamic.api.IDynamicService; import com.yidianling.dynamic.api.IDynamicService;
import com.yidianling.im.api.service.IImService; import com.yidianling.im.api.service.IImService;
import com.yidianling.im.message.param.MsgListParam; import com.yidianling.im.message.param.MsgListParam;
...@@ -184,6 +185,26 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR ...@@ -184,6 +185,26 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
updateUI(); updateUI();
} }
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser && isResumed()) {
showConsultAssistantDialog();
} else {
hideConsultAssistantDialog();
}
if (isVisibleToUser && isResumed()) {
onResume();
}
}
private void showConsultAssistantDialog() {
ModularServiceManager.INSTANCE.provide(IConsultantService.class).showConsultAssistantMineDialog(getActivity());
}
private void hideConsultAssistantDialog() {
ModularServiceManager.INSTANCE.provide(IConsultantService.class).hideConsultAssistantMineDialog();
}
/** /**
* DEBUG包中:增加切换环境功能,线上包会自动隐藏此按钮 * DEBUG包中:增加切换环境功能,线上包会自动隐藏此按钮
...@@ -541,7 +562,8 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR ...@@ -541,7 +562,8 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
initdata(); initdata();
try { try {
ModularServiceManager.INSTANCE.provide(IImService.class).updateUserHead(UserHelper.INSTANCE.getUserInfo().getUserInfo().getHead()); ModularServiceManager.INSTANCE.provide(IImService.class).updateUserHead(UserHelper.INSTANCE.getUserInfo().getUserInfo().getHead());
}catch (Exception e) {} } catch (Exception e) {
}
} }
} }
} }
\ 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