Commit 4d124e17 by konghaorui

删除RouterManager引用

parent fd2e5fd8
ext {
kotlin_version = "1.3.21"
dev_mode = true
dev_mode = false
ydl_app = [
appName : "心理咨询壹点灵",
......@@ -288,6 +288,8 @@ ext {
"ydl-m-home-api" : "com.ydl:m-home-api:${ydlCompileVersion["m-home-api"]}",
"ydl-m-consultant-api" : "com.ydl:m-consultant-api:${ydlCompileVersion["m-consultant-api"]}",
"ydl-m-dynamic-api" : "com.ydl:m-dynamic-api:${ydlCompileVersion["m-dynamic-api"]}",
"ydl-m-confide-api" : "com.ydl:m-confide-api:${ydlCompileVersion["m-confide-api"]}",
"ydl-m-course-api" : "com.ydl:m-course-api:${ydlCompileVersion["m-course-api"]}",
]
}
......@@ -85,6 +85,9 @@ dependencies {
api project(':ydl-media')
api project(':ydl-platform')
api project(':m-audioim')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-confide-api')
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-media"]
......@@ -92,5 +95,8 @@ dependencies {
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
}
}
......@@ -24,7 +24,7 @@ modular {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-confide-api"
version = rootProject.ext.ydlPublishVersion["${childProject.getName()}-api"]
//version = rootProject.ext.ydlPublishVersion["${childProject.getName()}-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
......
......@@ -24,6 +24,7 @@ import com.ydl.confide.home.listener.ConfideHomeRecycleViewListener
import com.ydl.confide.home.listener.ConfideHomeRecyleSuspendListener
import com.ydl.confide.home.presenter.ConfideHomePresenterImpl
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.confide.router.PhoneCallIn
import com.ydl.ydl_image.listener.YDLImageRecyclerOnScrollListener
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.utils.StatusBarUtils
......@@ -31,7 +32,6 @@ import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.DrawableRightTextView
import com.ydl.ydlcommon.view.WrapContentLinearLayoutManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.router.RouterManager
import kotlinx.android.synthetic.main.confide_home_activity.*
import kotlinx.android.synthetic.main.confide_title_bar.*
......@@ -523,8 +523,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override fun onBackPressed() {
if (isSplash) {
//跳转主页
var int = RouterManager.getAppRouter()?.mainIntent(this)
startActivity(int)
PhoneCallIn.getAppService().mainIntent(this)
}
super.onBackPressed()
}
......
......@@ -8,9 +8,6 @@ import android.support.v7.app.AppCompatActivity
import android.text.TextUtils
import android.view.View
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.yidianling.common.tools.ToastUtil
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeBodyBean
......@@ -27,11 +24,13 @@ import com.ydl.media.audio.AudioPlayer
import com.ydl.media.audio.model.Music
import com.ydl.media.view.PlayerFloatHelper
import com.ydl.media.view.PlayerFloatView
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.router.RouterManager
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRequestCallback
/**
* @author yuanwai
......@@ -267,7 +266,8 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
if (mContext is AppCompatActivity && !TextUtils.isEmpty(doctorId)) {
PhoneCallIn.startChat(mContext as AppCompatActivity, doctorId!!, 0x001, 0)
}
RouterManager.getImRouter().createTextMessage(doctorId, "你好,我想找你倾诉,请尽快上线私聊我,我在等你。", object : IMRequestCallback<Void> {
PhoneCallIn.getImService().createTextMessage(doctorId, "你好,我想找你倾诉,请尽快上线私聊我,我在等你。", object :
IMRequestCallback<Void> {
override fun onSuccess(aVoid: Void?) {
(mContext as BaseActivity).dismissProgressDialog()
ToastHelper.show("发送成功")
......
package com.ydl.confide.router
package com.ydl.confide.home.modular.service
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v4.app.DialogFragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.ConfideHomeActivity
import com.yidianling.router.phoneCall.IPhoneCallRouter
class PhoneCallImp : IPhoneCallRouter {
/**
* Created by haorui on 2019-12-11 .
* Des:
*/
@Route(path = "/confide/ConfideService")
class ConfdieServiceImpl : IConfideService {
override fun init(context: Context?) {
}
override fun phoneCallFragment(head: String, callId: String): DialogFragment {
//废弃
return DialogFragment()
......@@ -21,15 +33,15 @@ class PhoneCallImp : IPhoneCallRouter {
override fun openConfideHome(context: Context) {
val intent = Intent(context, ConfideHomeActivity::class.java)
if (context !is Activity){
if (context !is Activity) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(intent)
}
override fun closePlayer() {
// if (MyPlayer.isStart()) {
// MyPlayer.getInstance().releaseMedia()
// }
}
}
\ No newline at end of file
......@@ -3,7 +3,10 @@ package com.ydl.confide.router
import android.app.Activity
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import com.yidianling.router.RouterManager
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
* author : Zhangwenchao
......@@ -12,77 +15,31 @@ import com.yidianling.router.RouterManager
*/
object PhoneCallIn {
fun isLogin(): Boolean {
return RouterManager.getUserRouter()?.isLogin()?:false
}
fun rechargeIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.rechargeIntent(activity)
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun inputPhoneIntent(activity: Activity, smsAction: String): Intent? {
return RouterManager.getUserRouter()?.inputPhoneIntent(activity, smsAction)
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun loginWayIntent(activity: Activity): Intent? {
return RouterManager.getUserRouter()?.loginWayIntent(activity)
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
fun publishTrendIntent(activity: Activity, url: String, cover: String, title: String): Intent? {
return RouterManager.getDynamicRouter()?.publishTrendIntent(activity, url, cover, title)
}
fun myRedPacketIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.myRedPockIntent(activity)
}
fun fmDetailIntent(activity: Activity, fmId: Int): Intent? {
return RouterManager.getFMRouter()?.fmDetailIntent(activity, fmId)
}
fun isFmPlaying(): Boolean {
return RouterManager.getFMRouter()?.isPlaying() ?: false
}
fun isCoursePlaying(): Boolean {
return RouterManager.getCourseRouter()?.isPlaying() ?: false
}
fun getFmId(): Int {
return RouterManager.getFMRouter()?.getFmId() ?: 0
}
/**
* 课程播放页
*/
fun startCoursePlayPage(activity: Activity){
RouterManager.getCourseRouter()?.startCoursePlayPage(activity,1)
}
fun playCourse(){
if (!isCoursePlaying()){
RouterManager.getCourseRouter()?.play()
}
}
fun pauseCourse(){
if (isCoursePlaying()){
RouterManager.getCourseRouter()?.pause()
}
fun isLogin(): Boolean {
return getUserService()?.isLogin()?:false
}
fun rePlayFM(){
RouterManager.getFMRouter()?.replay()
}
fun pauseFm(){
RouterManager.getFMRouter()?.pause()
fun loginWayIntent(activity: Activity): Intent? {
return getUserService()?.loginWayIntent(activity)
}
/**
* 私聊
*/
fun startChat(context: AppCompatActivity, toUid: String, flag: Int, canTalk: Int) {
RouterManager.getImRouter().startChat(context,toUid,flag,canTalk)
getImService().startChat(context,toUid,flag,canTalk)
}
}
\ No newline at end of file
package com.ydl.confide.api
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v4.app.DialogFragment
import com.alibaba.android.arouter.facade.template.IProvider
interface IPhoneCallRouter{
interface IConfideService : IProvider {
fun phoneCallIntent(activity: Activity): Intent
fun phoneCallFragment(head: String, callId: String): DialogFragment
fun closePlayer()
......
......@@ -73,11 +73,13 @@ dependencies {
if (rootProject.ext.dev_mode){
//开发时使用
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-im-api')
api project(":ydl-webview")
api project(":ydl-platform")
} else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
......@@ -425,7 +425,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//返回键处理,热门搜索如果可见,则隐藏,来自启动页,则打开主界面
override fun onBackPressed() {
if (isFromSplash) {
startActivity(ConsultantIn.mainIntent(this))
ConsultantIn.mainIntent(this)
}
finish()
}
......
......@@ -2,10 +2,10 @@ package com.yidianling.consultant.router
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
......@@ -15,9 +15,20 @@ import com.yidianling.user.api.service.IUserService
*/
object ConsultantIn {
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
// 打开小壹聊天界面
fun startP2PXiaoYi(context: Context) {
RouterManager.getImRouter().startP2PXiaoYi(context)
getImService().startP2PXiaoYi(context)
}
fun isLogin(): Boolean {
......@@ -25,11 +36,11 @@ object ConsultantIn {
}
fun startP2PSession(context: AppCompatActivity, toUid: String) {
RouterManager.getImRouter().startP2PSession(context, toUid)
getImService().startP2PSession(context, toUid)
}
fun mainIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.mainIntent(activity)
fun mainIntent(activity: Activity){
getAppService().mainIntent(activity)
}
fun getUserImpl(): IUserService {
......
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> {
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>) {
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
......@@ -69,6 +69,7 @@ dependencies {
if (rootProject.ext.dev_mode){
//开发时使用
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
api project(":ydl-webview")
api project(":ydl-platform")
api project(":ydl-media")
......@@ -78,6 +79,7 @@ dependencies {
} else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
api rootProject.ext.dependencies["ydl-webview"]
api (rootProject.ext.dependencies["ydl-media"]){
transitive = true
......
......@@ -20,8 +20,8 @@ import com.yidianling.course.bean.CourseCouponBean
import com.yidianling.course.constants.CourseBIConstants
import com.yidianling.course.flutterPlugin.CourseSendPlugin
import com.yidianling.course.net.CourseRetrofitUtils
import com.yidianling.course.router.CourseIn
import com.yidianling.course.widget.CourseCouponDialog
import com.yidianling.router.RouterManager
import io.flutter.view.FlutterView
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
......@@ -66,7 +66,7 @@ class FlutterCourseHomeFragment : BaseFlutterFragment() {
*/
private fun prepareCoupon() {
//判断是否登录 以及本次app启动后是否已经请求过
if (RouterManager.getUserRouter()?.isLogin() == true && !hasRequestCoupon) {
if (CourseIn.getUserService()?.isLogin() && !hasRequestCoupon) {
Handler().postDelayed({
//优惠券逻辑
if (compareCouponTime()) {
......
......@@ -573,8 +573,7 @@ class CoursePlayActivity : BaseActivity() {
private fun toTrend(share: ShareData) {
var url = if (TextUtils.isEmpty(share.url)) share.share_url else share.url
YdlCommonRouterManager.getYdlCommonRoute()
.publishArticleToTrend(this@CoursePlayActivity, url!!, share.cover!!, share.title!!)
CourseIn.getDynamicService().publishArticleToTrend(this@CoursePlayActivity, url!!, share.cover!!, share.title!!)
}
override fun onPause() {
......
......@@ -3,7 +3,7 @@ package com.yidianling.course.router
import android.app.Activity
import android.content.Intent
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.user.api.service.IUserService
/**
......@@ -13,6 +13,14 @@ import com.yidianling.user.api.service.IUserService
*/
object CourseIn {
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
fun getDynamicService(): IDynamicService {
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun isLogin(): Boolean {
return ModularServiceManager.provide(IUserService::class.java).isLogin()
}
......@@ -21,8 +29,4 @@ object CourseIn {
return ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
}
fun mainIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.mainIntent(activity)
}
}
\ No newline at end of file
package com.yidianling.course.router
import android.app.Activity
import android.content.Intent
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.media.audio.AudioPlayer
import com.yidianling.course.courseNew.CourseTopicActivity
import com.yidianling.router.course.ICourseRouter
/**
* Created by hgw on 2018/5/3.
*/
class CourseRouterImp : ICourseRouter{
override fun closePlayer() {
if (AudioPlayer.get().isPlaying) {
AudioPlayer.get().stopPlayer()
}
}
override fun isPlaying(): Boolean {
return AudioPlayer.get().isPlaying
}
override fun play(){
AudioPlayer.get().play()
}
override fun pause(){
AudioPlayer.get().playPause()
}
override fun startCoursePlayPage(activity: Activity, from: Int) {
ARouter.getInstance()
.build("/course/play")
.withInt("from", from)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.withBoolean("isFromFloatView", false)
.navigation()
}
override fun courseTopic(activity: Activity, id: String){
return CourseTopicActivity.start(activity, id)
}
}
\ No newline at end of file
......@@ -98,13 +98,25 @@ dependencies {
api project(':ydl-webview')
api project(':ydl-platform')
api project(":ydl-pay")
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-tests-api')
implementation modularPublication('com.ydl:m-course-api')
implementation modularPublication('com.ydl:m-fm-api')
implementation modularPublication('com.ydl:m-consultant-api')
implementation modularPublication('com.ydl:m-confide-api')
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-pay"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies["ydl-m-tests-api"]
compileOnly rootProject.ext.dependencies["ydl-m-course-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
......@@ -438,7 +438,7 @@ public class MembersActivity extends BaseActivity implements View.OnClickListene
*/
private void JumpToPersonInfo() {
// OuterEmptyImp.jumpToPersonInfoActivity(MembersActivity.this);
startActivity(DynamicIn.INSTANCE.personalInfoIntent(this));
DynamicIn.INSTANCE.personalInfoIntent(this);
}
/**
......
......@@ -4,12 +4,19 @@ import android.app.Activity
import android.content.Intent
import android.support.v4.app.DialogFragment
import android.support.v7.app.AppCompatActivity
import com.ydl.confide.api.IConfideService
import com.ydl.course.api.ICourseService
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback
import com.ydl.ydlcommon.actions.imagepicker.YdlImagePicker
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.fm.api.service.IFMService
import com.yidianling.im.api.service.IImService
import com.yidianling.tests.api.service.ITestsApiService
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
......@@ -19,14 +26,42 @@ import com.yidianling.user.api.service.IUserService
*/
object DynamicIn {
// fun getImService(): IMServiceImpl {
// return ModularServiceManager.provide(IMServiceImpl::class.java)
// }
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
fun getDynamicService(): IDynamicService {
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun getCourseService(): ICourseService {
return ModularServiceManager.provide(ICourseService::class.java)
}
fun getTestsService(): ITestsApiService {
return ModularServiceManager.provide(ITestsApiService::class.java)
}
fun getFMService(): IFMService {
return ModularServiceManager.provide(IFMService::class.java)
}
fun getConsultService(): IConsultantService {
return ModularServiceManager.provide(IConsultantService::class.java)
}
fun getConfideService(): IConfideService {
return ModularServiceManager.provide(IConfideService::class.java)
}
/**
* 获取专家主页url
*/
......@@ -48,98 +83,89 @@ object DynamicIn {
return getUserService().loginWayIntent(activity)
}
fun personalInfoIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.personalInfoIntent(activity)
fun personalInfoIntent(activity: Activity){
getAppService().personalInfoIntent(activity)
}
fun inputPhoneIntent(activity: Activity, smsAction: String): Intent? {
return getUserService().inputPhoneIntent(activity, smsAction)
}
fun mainIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.mainIntent(activity)
}
fun expertSearchIntent(activity: Activity, category: Int, showType: Int, isInitShowHot: Boolean): Intent? {
return RouterManager.getConsultantRouter()?.expertSearchIntent(activity, category, showType, isInitShowHot)
fun mainIntent(activity: Activity){
getAppService().mainIntent(activity)
}
fun testResultIntent(activity: Activity, testResultId: Int): Intent? {
return RouterManager.getTestsRouter()?.testResultIntent(activity, testResultId)
fun mainIntent(activity: Activity,tab :Int){
getAppService().mainIntent(activity,tab,false)
}
fun testDetailIntent(activity: Activity, testId: Int): Intent? {
return RouterManager.getTestsRouter()?.testDetailIntent(activity, testId)
fun expertSearchIntent(activity: Activity, category: Int, showType: Int, isInitShowHot: Boolean): Intent? {
return getConsultService().expertSearchIntent(activity, category, showType, isInitShowHot)
}
fun testResultH5(testResultId: Int){
RouterManager.getTestsRouter()!!.testH5Result(testResultId.toString())
getTestsService().testH5Result(testResultId.toString())
}
fun testDetailH5(testId: Int){
RouterManager.getTestsRouter()?.testDetailH5(testId.toString());
getTestsService().testDetailH5(testId.toString());
}
fun phoneCallIntent(activity: Activity): Intent? {
return RouterManager.getPhoneCallRouter()?.phoneCallIntent(activity)
return getConfideService().phoneCallIntent(activity)
}
fun fmDetailIntent(activity: Activity, fmId: Int): Intent? {
return RouterManager.getFMRouter()?.fmDetailIntent(activity, fmId)
return getFMService().fmDetailIntent(activity, fmId)
}
fun getFmId(): Int {
return RouterManager.getFMRouter()?.getFmId() ?: 0
return getFMService().getFmId() ?: 0
}
fun testAnswerIntent(activity: Activity): Intent? {
return RouterManager.getTestsRouter()?.testAnswerIntent(activity)
}
fun rechargeIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.rechargeIntent(activity)
fun rechargeIntent(activity: Activity){
getAppService().rechargeIntent(activity)
}
fun phoneCallFragment(head: String, callId: String): DialogFragment? {
return RouterManager.getPhoneCallRouter()?.phoneCallFragment(head, callId)
return getConfideService().phoneCallFragment(head, callId)
}
fun startChat(activity: AppCompatActivity, toUid: String) {
RouterManager.getImRouter().startP2PSession(activity, toUid)
getImService().startP2PSession(activity, toUid)
}
fun isFmPlaying(): Boolean {
return RouterManager.getFMRouter()?.isPlaying() ?: false
return getFMService().isPlaying() ?: false
}
fun isCoursePlaying(): Boolean {
return RouterManager.getCourseRouter()?.isPlaying() ?: false
return getCourseService().isPlaying() ?: false
}
fun playCourse(){
if (!isCoursePlaying()){
RouterManager.getCourseRouter()?.play()
getCourseService().play()
}
}
fun pauseCourse(){
if (isCoursePlaying()){
RouterManager.getCourseRouter()?.pause()
getCourseService().pause()
}
}
fun rePlayFM(){
RouterManager.getFMRouter()?.replay()
getFMService().replay()
}
fun pauseFm(){
RouterManager.getFMRouter()?.pause()
getFMService().pause()
}
fun showSelector(activity: Activity, requestCode: Int) {
RouterManager.getImRouter().showSelector(activity, requestCode)
getImService().showSelector(activity, requestCode)
}
fun startPicker(activity: AppCompatActivity, openCamera: Boolean, callback: PickerCallback) {
......@@ -150,6 +176,6 @@ object DynamicIn {
* 课程播放页
*/
fun startCoursePlayPage(activity: Activity){
RouterManager.getCourseRouter()?.startCoursePlayPage(activity,1)
getCourseService().startCoursePlayPage(activity,1)
}
}
\ No newline at end of file
package com.yidianling.dynamic.router
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.yidianling.dynamic.activity.TrendsReplyInfoActivity
import com.yidianling.dynamic.members.MembersActivity
import com.yidianling.dynamic.publishTrend.PublishTrendActivity
import com.yidianling.dynamic.topic.topicDetail.TopicDetailActivity
import com.yidianling.dynamic.trendsDetail.TrendsDetailActivity
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.router.dynamic.IDynamicRouter
class DynamicRouterImp : IDynamicRouter {
override fun membersIntent(activity: Activity, userId: String): Intent {
return MembersActivity.newIntent(activity, userId)
}
override fun replyInfoIntent(activity: Activity, replyId: String, aid: String): Intent {
return TrendsReplyInfoActivity.newIntent(activity, replyId, aid)
}
override fun trendsDetailIntent(activity: Activity, trendId: Int): Intent {
return TrendsDetailActivity.newIntent(activity, trendId)
}
override fun trendsDetailIntent(activity: Activity, trendId: Int, isScrollToZan: Boolean): Intent {
return TrendsDetailActivity.newIntent(activity, trendId, isScrollToZan)
}
override fun trendsDetailIntent(activity: Activity, trendId: Int, isScrollToZan: Boolean, lastId: Int): Intent {
return TrendsDetailActivity.newIntent(activity, trendId, isScrollToZan, lastId)
}
override fun publishTrendIntent(activity: Activity, url: String, cover: String, title: String): Intent {
return PublishTrendActivity.newIntent(activity, url, cover, title)
}
override fun publishFmToTrend(activity: Activity, url: String, cover: String, title: String): Intent {
return PublishTrendActivity.newIntentForFm(activity, url, cover, title, 1)
}
override fun publishArticleToTrend(activity: Activity, url: String, cover: String, title: String): Intent {
return PublishTrendActivity.newIntentForArticle(activity, url, cover, title)
}
override fun topicDetailIntent(context: Context, isSplash: Boolean, topicId: String): Intent {
return TopicDetailActivity.newIntent(context, isSplash, topicId)
}
}
\ No newline at end of file
......@@ -163,7 +163,7 @@ public class ShowIntroduceDialogFragment extends BaseDialogFragment {
@Override
public void onClick(View v) {
// OuterEmptyImp.jumpToRechargeActivity(getActivity(),needRecharge+"");
startActivity(DynamicIn.INSTANCE.rechargeIntent(getActivity()));
DynamicIn.INSTANCE.rechargeIntent(getActivity());
// Intent intent = new Intent(getActivity(), RechargeActivity.class);
// intent.putExtra("money", needRecharge + "");
// startActivity(intent);
......
......@@ -376,7 +376,7 @@ public class TopicDetailActivity extends BaseMvpActivity<TopicDetailView, TopicD
private void back() {
if (isSplash) {
startActivity(DynamicIn.INSTANCE.mainIntent(this));
DynamicIn.INSTANCE.mainIntent(this);
}
finish();
}
......@@ -437,7 +437,7 @@ public class TopicDetailActivity extends BaseMvpActivity<TopicDetailView, TopicD
dialog.dismiss();
});
backhome_lin.setOnClickListener(v -> {
startActivity(DynamicIn.INSTANCE.mainIntent(this));
DynamicIn.INSTANCE.mainIntent(this);
dialog.dismiss();
});
}
......
......@@ -1134,7 +1134,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
}
} else if (v.getId() == R.id.image_back) {
if (isFromSplash) {
startActivity(DynamicIn.INSTANCE.mainIntent(this));
DynamicIn.INSTANCE.mainIntent(this);
finish();
}
setResultForActivity();
......@@ -1672,11 +1672,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
}
private void backHome() {
Intent intent = DynamicIn.INSTANCE.mainIntent(this);
Bundle bundle = new Bundle();
bundle.putInt("selectTab", 0);
intent.putExtra("bundle", bundle);
startActivity(intent);
DynamicIn.INSTANCE.mainIntent(this,0);
}
/**
......
......@@ -75,11 +75,13 @@ dependencies {
api project(":ydl-platform")
api project(':m-user')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation project(':ydl-media')
} else {
//发布时使用
implementation rootProject.ext.dependencies["ydl-media"]
implementation rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
implementation (rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
......
......@@ -576,7 +576,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
private void Back() {
if (isSplash) {
// FMOut.INSTANCE.startMain(this);
startActivity(FMIn.INSTANCE.mainIntent(this));
FMIn.INSTANCE.mainIntent(this);
finish();
} else {
finish();
......
......@@ -3,7 +3,8 @@ package com.yidianling.fm.router
import android.app.Activity
import android.content.Intent
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
......@@ -12,14 +13,20 @@ import com.yidianling.user.api.service.IUserService
* time : 2018/04/25
*/
object FMIn {
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun getDynamicService(): IDynamicService {
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun isLogin(): Boolean {
return ModularServiceManager.provide(IUserService::class.java).isLogin()
}
fun mainIntent(activity: Activity): Intent? {
//todo xujian 跳转到MainActivity 待修改
return RouterManager.getAppRouter()?.mainIntent(activity)
fun mainIntent(activity: Activity){
getAppService().mainIntent(activity)
}
fun loginWayIntent(activity: Activity): Intent? {
......@@ -30,8 +37,7 @@ object FMIn {
* FM分享到心事动态
*/
fun publisFmToTrend(activity: Activity, url: String, cover: String, title: String) : Intent?{
//todo xujian 待修改
return RouterManager.getDynamicRouter()?.publishFmToTrend(activity,url,cover,title)
return getDynamicService()?.publishFmToTrend(activity,url,cover,title)
}
......
package com.yidianling.fm.router
import android.app.Activity
import android.content.Intent
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
import com.yidianling.fm.FMDetailActivity
import com.yidianling.router.fm.IFMRouter
class FmRouterImp : IFMRouter{
override fun fmDetailIntent(activity: Activity, id: Int): Intent {
return FMDetailActivity.newIntent(activity, id)
}
override fun fmDetailIntent(activity: Activity, id: Int, isSplash: Boolean): Intent {
return FMDetailActivity.newIntent(activity, id, isSplash)
}
override fun getFmId(): Int {
return PlayerFloatHelper.getFmId()
}
override fun closePlayer() {
if (AudioPlayer.get().isPlaying) {
AudioPlayer.get().stopPlayer()
}
}
override fun isPlaying(): Boolean {
return AudioPlayer.get().isPlaying
}
override fun pause(){
AudioPlayer.get().pausePlayer()
}
override fun replay() {}
}
\ No newline at end of file
......@@ -34,8 +34,6 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.router.RouterManager
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.tests.api.service.ITestsApiService
import com.yidianling.user.api.service.IUserService
import org.json.JSONObject
......
......@@ -98,10 +98,20 @@ dependencies {
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-tests-api')
implementation modularPublication('com.ydl:m-course-api')
implementation modularPublication('com.ydl:m-fm-api')
implementation modularPublication('com.ydl:m-consultant-api')
implementation modularPublication('com.ydl:m-confide-api')
}else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies["ydl-m-tests-api"]
compileOnly rootProject.ext.dependencies["ydl-m-course-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
......@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl"
artifactId = "m-im-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
......
......@@ -62,7 +62,7 @@ import com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice
import com.yidianling.im.session.extension.CustomRecommendExpertListMsg;
import com.yidianling.im.session.extension.CustomSystemTips;
import com.yidianling.im.ui.widget.ChatTeamHisDialog;
import com.yidianling.router.im.IMExpertBuild;
import com.yidianling.im.api.bean.IMExpertBuild;
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import com.yidianling.uikit.custom.http.response.RecommendExpertBean;
......@@ -170,7 +170,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
// Bundle bundle = new Bundle();
// bundle.putString("to_uid",toChatUsername);
// ImIn.INSTANCE.SendRedPacketActivity(activity,bundle,44);
activity.startActivityForResult(ImIn.INSTANCE.sendRedPacketIntent(activity, toChatUsername), 44);
ImIn.INSTANCE.sendRedPacketIntent(activity, toChatUsername,44);
}
//判定是否是今天第一次发送提醒上线通知,不是的话则不发消息通知|普通消息
......@@ -588,7 +588,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
dialog.dismiss();
break;
case "返回首页":
mActivity.startActivity(ImIn.INSTANCE.mainIntent(mActivity, 0));
ImIn.INSTANCE.mainIntent(mActivity, 0);
dialog.dismiss();
break;
case "客服热线":
......@@ -916,7 +916,7 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
@Override
public void startFeedback(Context context) {
context.startActivity(ImIn.INSTANCE.feedBackIntent((Activity) context));
ImIn.INSTANCE.feedBackIntent((Activity) context);
}
@Override
......
......@@ -24,7 +24,7 @@ import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.SessionHelper;
import com.yidianling.router.im.IMExpertBuild;
import com.yidianling.im.api.bean.IMExpertBuild;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
......
......@@ -10,7 +10,7 @@ import com.yidianling.im.ui.page.fragment.bean.ChatModelBean
import com.yidianling.im.ui.page.fragment.bean.InteractBean
import com.yidianling.im.ui.page.fragment.bean.NoticeItemBean
import com.yidianling.im.ui.page.fragment.bean.UnreadMessageBean
import com.yidianling.router.im.IMExpertBuild
import com.yidianling.im.api.bean.IMExpertBuild
import io.reactivex.Observable
import retrofit2.http.*
......
......@@ -7,7 +7,7 @@ import com.yidianling.im.message.param.MsgListParam
import com.yidianling.im.message.param.ReadParam
import com.yidianling.im.ui.page.fragment.bean.*
import com.yidianling.im.ui.param.*
import com.yidianling.router.im.IMExpertBuild
import com.yidianling.im.api.bean.IMExpertBuild
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
......
......@@ -17,7 +17,7 @@ import com.yidianling.im.ui.page.fragment.bean.InteractBean
import com.yidianling.im.ui.page.fragment.bean.NoticeItemBean
import com.yidianling.im.ui.page.fragment.bean.UnreadMessageBean
import com.yidianling.im.ui.param.*
import com.yidianling.router.im.IMExpertBuild
import com.yidianling.im.api.bean.IMExpertBuild
import io.reactivex.Observable
/**
......
......@@ -9,7 +9,7 @@ import com.yidianling.im.bean.CourseStatusBean
import com.yidianling.im.bean.DoctorAssistantRespDtoBean
import com.yidianling.im.bean.PushConfideStatusBean
import com.yidianling.im.bean.RedPacketDetailBean
import com.yidianling.router.im.IMExpertBuild
import com.yidianling.im.api.bean.IMExpertBuild
import io.reactivex.Observable
import retrofit2.http.*
......
......@@ -19,6 +19,7 @@ import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.im.api.service.IImService
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import com.yidianling.im.helper.IMUtil
import com.yidianling.im.helper.MsgReceiveHelper
import com.yidianling.im.preference.IMCache
import com.yidianling.im.router.ImIn
import com.yidianling.im.session.SessionHelper
......@@ -35,6 +36,10 @@ import com.yidianling.uikit.business.session.helper.MessageListPanelHelper
@Route(path = "/im/ImService")
class IMServiceImpl : IImService {
override fun isHasUnread(): Boolean {
return MsgReceiveHelper.isHasUnread
}
override fun init(context: Context?) {
}
......
package com.yidianling.im.router
import android.app.Activity
import android.content.Context
import android.support.v7.app.AppCompatActivity
import com.netease.nimlib.sdk.NIMClient
import com.netease.nimlib.sdk.RequestCallback
import com.netease.nimlib.sdk.auth.AuthService
import com.netease.nimlib.sdk.auth.LoginInfo
import com.netease.nimlib.sdk.msg.MessageBuilder
import com.netease.nimlib.sdk.msg.MsgService
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.StringUtils
import com.yidianling.im.R
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import com.yidianling.im.helper.IMUtil
import com.yidianling.im.preference.IMCache
import com.yidianling.im.session.SessionHelper
import com.yidianling.im.session.extension.CustomAttachSubScriptTime
import com.yidianling.im.session.extension.CustomAttachmentTest
import com.yidianling.nimbase.common.media.picker.PickImageHelper
import com.yidianling.router.im.IIMRouter
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.uikit.api.NimUIKit
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/23
* 暴漏给其他module使用
*/
class IMRouterImp : IIMRouter {
override fun startP2PSession(context: AppCompatActivity, toUid: String) {
IMUtil.startChat(context, toUid, IMUtil.FLAG_SAVE or IMUtil.FLAG_USE_UM, 0, null)
}
override fun startP2PXiaoYi(context: Context) {
if (!ImIn.isLogin()) {
context.startActivity(ImIn.loginWayIntent(context))
return
}
SessionHelper.startP2PSession(context, -1, "14", null,
P2PCustomActionHandlerImpl("14",
"客服小壹", "https://static.ydlcdn.com/mobile/images/avatar_girl_app.png"))
}
override fun imLogin(info: IMLoginInfo) {
NimUIKit.setAccount(info.account)
try {
NIMClient.getService(AuthService::class.java).login(LoginInfo(info.account, info.passWord))
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun login(info: IMLoginInfo, callback: IMRequestCallback<IMLoginInfo>?) {
NimUIKit.login(LoginInfo(info.account, info.passWord), object : RequestCallback<LoginInfo> {
override fun onSuccess(param: LoginInfo?) {
if (param != null) {
val newParam = IMLoginInfo(param.account, param.token)
callback?.onSuccess(newParam)
}
}
override fun onFailed(code: Int) {
callback?.onFailed(code)
}
override fun onException(exception: Throwable?) {
callback?.onException(exception)
}
})
}
override fun setAccount(account: String) {
NimUIKit.setAccount(account)
}
override fun setChattingAccountAll() {
NIMClient.getService(MsgService::class.java).setChattingAccount(MsgService.MSG_CHATTING_ACCOUNT_ALL, SessionTypeEnum.None)
}
override fun setChattingAccountNone() {
NIMClient.getService(MsgService::class.java).setChattingAccount(MsgService.MSG_CHATTING_ACCOUNT_NONE, SessionTypeEnum.None)
}
override fun logout() {
NIMClient.getService(AuthService::class.java).logout()
}
override fun clear() {
NimUIKit.logout()
IMCache.clear()
}
override fun createTextMessage(sessionId: String?, content: String, callback: IMRequestCallback<Void>) {
val message = MessageBuilder.createTextMessage(sessionId, SessionTypeEnum.P2P, content)
NIMClient.getService(MsgService::class.java)
.sendMessage(message, false)
.setCallback(object : RequestCallback<Void> {
override fun onSuccess(param: Void?) {
callback.onSuccess(param)
MessageListPanelHelper.getInstance().notifyAddMessage(message)
}
override fun onException(exception: Throwable?) {
callback.onException(exception)
}
override fun onFailed(code: Int) {
callback.onFailed(code)
}
})
}
override fun sendSubscriptionTimeMessage(sessionId: String?, content: String, callback: IMRequestCallback<Void>) {
val customTime = CustomAttachSubScriptTime(content)
val message = MessageBuilder.createCustomMessage(sessionId, SessionTypeEnum.P2P, content, customTime)
NIMClient.getService(MsgService::class.java)
.sendMessage(message, false)
.setCallback(object : RequestCallback<Void> {
override fun onSuccess(param: Void?) {
callback.onSuccess(param)
MessageListPanelHelper.getInstance().notifyAddMessage(message)
}
override fun onException(exception: Throwable?) {
callback.onException(exception)
}
override fun onFailed(code: Int) {
callback.onFailed(code)
}
})
}
override fun showSelector(activity: Activity, requestCode: Int) {
val option = PickImageHelper.PickImageOption()
option.titleResId = R.string.im_input_panel_photo
option.multiSelect = true
option.multiSelectMaxCount = 9
option.crop = false
option.cropOutputImageWidth = 720
option.cropOutputImageHeight = 720
// option.outputPath = StorageUtil.getWritePath(StringUtils.get32UUID() + ".jpg", StorageType.TYPE_TEMP)
option.outputPath = YdlCommonOut.getApp().externalCacheDir.absolutePath + "/" + StringUtils.get32UUID() + ".jpg"
PickImageHelper.pickImage(activity, requestCode, option)
}
override fun sendTestResultMessage(uid: String, content: String, title: String?, head: String?, url: String?, id: Int, share_url: String?, callback: IMRequestCallback<Void>) {
val customAttachmentTest = CustomAttachmentTest(
CustomAttachmentTest.FLAG_RESULT,
title,
head,
url,
id,
share_url
)
val message = MessageBuilder.createCustomMessage(uid, SessionTypeEnum.P2P, "测试结果", customAttachmentTest)
NIMClient.getService(MsgService::class.java).sendMessage(message, false).setCallback(object : RequestCallback<Void> {
override fun onSuccess(param: Void?) {
callback.onSuccess(param)
MessageListPanelHelper.getInstance().notifyAddMessage(message)
}
override fun onFailed(code: Int) {
callback.onFailed(code)
}
override fun onException(exception: Throwable?) {
callback.onException(exception)
}
})
}
/**
* 跳转私聊界面
*/
override fun startChat(context: AppCompatActivity, toUid: String, flag: Int, canTalk: Int) {
//这里虽然是倾述流程进入私聊,但不需要发送自定义消息
IMUtil.startChat(context, toUid, 0x001, canTalk, null, 0, false)
}
}
\ No newline at end of file
......@@ -4,25 +4,33 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter
import com.netease.nimlib.sdk.NIMClient
import com.netease.nimlib.sdk.RequestCallback
import com.netease.nimlib.sdk.auth.LoginInfo
import com.netease.nimlib.sdk.msg.MsgService
import com.netease.nimlib.sdk.uinfo.UserService
import com.netease.nimlib.sdk.uinfo.constant.UserInfoFieldEnum
import com.ydl.confide.api.IConfideService
import com.ydl.course.api.ICourseService
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.GlobalInfo
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.data.http.GsonProvider
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.fm.api.service.IFMService
import com.yidianling.im.api.bean.ReceiveRedPacketParam
import com.yidianling.im.api.service.IImService
import com.yidianling.im.config.constants.UserPreferences
import com.yidianling.im.modular.service.IMServiceImpl
import com.yidianling.im.preference.IMCache
import com.yidianling.router.RouterManager
import com.yidianling.router.app.ReceiveRedPacketParam
import com.yidianling.tests.api.service.ITestsApiService
import com.yidianling.uikit.api.NimUIKit
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
......@@ -32,14 +40,42 @@ import com.yidianling.user.api.service.IUserService
*/
object ImIn {
fun getImService(): IMServiceImpl {
return ModularServiceManager.provide(IMServiceImpl::class.java)
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
fun getDynamicService(): IDynamicService {
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun getCourseService(): ICourseService{
return ModularServiceManager.provide(ICourseService::class.java)
}
fun getTestsService(): ITestsApiService{
return ModularServiceManager.provide(ITestsApiService::class.java)
}
fun getFMService(): IFMService{
return ModularServiceManager.provide(IFMService::class.java)
}
fun getConsultService(): IConsultantService {
return ModularServiceManager.provide(IConsultantService::class.java)
}
fun getConfideService(): IConfideService {
return ModularServiceManager.provide(IConfideService::class.java)
}
/**
* 获取专家主页url
*/
......@@ -55,10 +91,6 @@ object ImIn {
return HttpConfig.H5_URL+"booking/order-detail?orderid="
}
fun closeMeidplayer(){
RouterManager.getCourseRouter()?.closePlayer()
RouterManager.getFMRouter()?.closePlayer()
}
/**
* 更新用户设置
*/
......@@ -79,40 +111,34 @@ object ImIn {
}
fun membersIntent(activity: Activity, userId: String): Intent? {
// TODO: 2019-12-12 待替换 by:HaoRui
return RouterManager.getDynamicRouter()?.membersIntent(activity, userId)
return getDynamicService().membersIntent(activity, userId)
}
fun replayInfoIntent(activity: Activity, replyId: String, aid: String): Intent? {
// TODO: 2019-12-12 待替换 by:HaoRui
return RouterManager.getDynamicRouter()?.replyInfoIntent(activity, replyId, aid)
return getDynamicService().replyInfoIntent(activity, replyId, aid)
}
fun myRedPockIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.myRedPockIntent(activity)
fun myRedPockIntent(activity: Activity){
getAppService().myRedPockIntent(activity)
}
fun trendsDetailIntent(activity: Activity, trendId: Int): Intent? {
// TODO: 2019-12-12 待替换 by:HaoRui
return RouterManager.getDynamicRouter()?.trendsDetailIntent(activity, trendId)
return getDynamicService().trendsDetailIntent(activity, trendId)
}
fun trendsDetailIntent(activity: Activity, trendId: Int, isScrollToZan: Boolean): Intent? {
// TODO: 2019-12-12 待替换 by:HaoRui
return RouterManager.getDynamicRouter()?.trendsDetailIntent(activity, trendId, isScrollToZan)
return getDynamicService().trendsDetailIntent(activity, trendId, isScrollToZan)
}
fun trendsDetailIntent(activity: Activity, trendId: Int, isScrollToZan: Boolean, lastId: Int): Intent? {
// TODO: 2019-12-12 待替换 by:HaoRui
return RouterManager.getDynamicRouter()?.trendsDetailIntent(activity, trendId, isScrollToZan, lastId)
return getDynamicService().trendsDetailIntent(activity, trendId, isScrollToZan, lastId)
}
/**
* 跳转话题详情
*/
fun topicDetailActivity(context: Context,topic_id : String){
var intent = RouterManager.getDynamicRouter()?.topicDetailIntent(context, false,topic_id)
var intent = getDynamicService().topicDetailIntent(context, false,topic_id)
intent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
}
......@@ -121,32 +147,33 @@ object ImIn {
* 课程专题页面
*/
fun courseTopic(activity: Activity,id : String){
RouterManager.getCourseRouter()?.courseTopic(activity,id)
getCourseService().courseTopic(activity,id)
}
fun fmDetailIntent(activity: Activity, id: Int): Intent? {
return RouterManager.getFMRouter()?.fmDetailIntent(activity, id)
return getFMService().fmDetailIntent(activity, id)
}
fun sendRedPacketIntent(activity: Activity, toUid: String): Intent? {
return RouterManager.getAppRouter()?.sendRedPacketIntent(activity, toUid)
fun sendRedPacketIntent(activity: Activity, toUid: String,code:Int){
//getAppService().sendRedPacketIntent(activity, toUid)
ARouter.getInstance().build("/main/sendRedPacket").withString("to_uid",toUid).navigation(activity,code)
}
fun testResultH5(testResultId: Int){
RouterManager.getTestsRouter()!!.testH5Result(testResultId.toString())
getTestsService().testH5Result(testResultId.toString())
}
fun testDetailH5(testId: Int){
RouterManager.getTestsRouter()?.testDetailH5(testId.toString());
getTestsService().testDetailH5(testId.toString());
}
fun receiveRedPacketIntent(activity: Activity, param: ReceiveRedPacketParam): Intent? {
return RouterManager.getAppRouter()?.receiverRedPacketIntent(activity, param)
fun receiveRedPacketIntent(activity: Activity, param: ReceiveRedPacketParam){
getAppService().receiverRedPacketIntent(activity, GsonProvider.getGson().toJson(param))
}
fun inputPhoneIntent(activity: Activity, smsAction: String): Intent? {
return getUserService()?.inputPhoneIntent(activity, smsAction)
return getUserService().inputPhoneIntent(activity, smsAction)
}
/**
......@@ -256,16 +283,12 @@ object ImIn {
return getUserService().loginWayIntent(context)
}
/* fun mainIntent(context: Context): Intent? {
return RouterManager.getAppRouter()?.mainIntent(context)
}*/
fun mainIntent(context: Context, selectTab: Int): Intent? {
return RouterManager.getAppRouter()?.mainIntent(context, selectTab, false)
fun mainIntent(context: Context, selectTab: Int){
getAppService().mainIntent(context, selectTab, false)
}
fun feedBackIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.feedBackIntent(activity)
fun feedBackIntent(activity: Activity){
getAppService().feedBackIntent(activity)
}
fun getGlobalInfo(): GlobalInfo? {
......
......@@ -14,7 +14,7 @@ import com.yidianling.im.http.ImHttpImpl;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.http.param.ExpertParam;
import com.yidianling.nimbase.business.session.actions.BaseAction;
import com.yidianling.router.im.IMExpertBuild;
import com.yidianling.im.api.bean.IMExpertBuild;
import org.jetbrains.annotations.NotNull;
......
......@@ -16,7 +16,7 @@ import com.yidianling.im.http.ImRetrofitApi;
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.im.api.bean.ReceiveRedPacketParam;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import com.yidianling.user.api.bean.UserResponseBean;
......@@ -83,7 +83,7 @@ public class MsgViewHolderRedPacket extends MsgViewHolderBase {
data.get_time
);
context.startActivity(ImIn.INSTANCE.receiveRedPacketIntent((Activity) context, param));
ImIn.INSTANCE.receiveRedPacketIntent((Activity) context, param);
}
}, throwable -> HttpErrorUtils.Companion.handleError(context, throwable));
......
......@@ -18,7 +18,7 @@ import com.yidianling.im.http.ImRetrofitApi;
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.im.api.bean.ReceiveRedPacketParam;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
......@@ -88,7 +88,7 @@ public class MsgViewHolderRedStatus extends MsgViewHolderBase {
user.getNickName(),
data.get_time
);
context.startActivity(ImIn.INSTANCE.receiveRedPacketIntent((Activity) context, param));
ImIn.INSTANCE.receiveRedPacketIntent((Activity) context, param);
}
......
......@@ -172,7 +172,7 @@ public class MsgListAdapter extends CommonAdapter<MsgData> {
case 1003:
// ImIn.INSTANCE.MyRedPackActivity(context,null);
context.startActivity(ImIn.INSTANCE.myRedPockIntent(context));
ImIn.INSTANCE.myRedPockIntent(context);
break;
}
}, new ThrowableConsumer() {
......
......@@ -19,7 +19,6 @@ import com.yidianling.im.ui.page.fragment.bean.ChatModelBean
import com.yidianling.im.ui.page.fragment.view.ChatFooterItemView
import com.yidianling.im.ui.page.widget.ChatUnusualView
import com.yidianling.im.ui.param.ChatParam
import com.yidianling.router.RouterManager
import de.greenrobot.event.EventBus
import kotlinx.android.synthetic.main.im_chat_fragment_layout.*
......@@ -268,9 +267,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
}
ll_chat_unusual_view.setListener(object : ChatUnusualView.ChatUnusualListener {
override fun onButtonClick() {
RouterManager.getConsultantRouter()?.let {
startActivity(RouterManager.getConsultantRouter()?.expertSearchIntent(activity, 0, 0, false))
}
startActivity(ImIn.getConsultService().expertSearchIntent(activity, 0, 0, false))
}
})
}
......
......@@ -4,8 +4,13 @@ import android.app.Activity
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.StringUtils
import com.yidianling.im.bean.MsgDetail
import com.yidianling.im.config.constants.ImConstants
import com.yidianling.im.event.ReQureyUnreadNum
import com.yidianling.im.http.ImHttpImpl
import com.yidianling.im.message.param.MsgDetailParam
import com.yidianling.im.router.ImIn
......@@ -13,11 +18,6 @@ import com.yidianling.im.ui.page.fragment.bean.InteractItemBean
import com.yidianling.im.ui.page.fragment.view.InteractFooterItemView
import com.yidianling.im.ui.page.fragment.view.InteractItemView
import com.yidianling.im.ui.page.fragment.view.InteractTimeItemView
import com.yidianling.im.event.ReQureyUnreadNum
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.StringUtils
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -87,7 +87,7 @@ class InteractAdapter(var context: Context, private var mList: ArrayList<Interac
1002 -> {
} //心事被回复
1003 -> { //首次说心事-送2元红包
context.startActivity(ImIn.myRedPockIntent(context as Activity))
ImIn.myRedPockIntent(context as Activity)
}
1004 -> {
} //心事收到温暖
......
......@@ -12,19 +12,18 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.adapter.BaseRecyclerAdapter;
import com.ydl.ydlcommon.bean.ShareData;
import com.ydl.ydlcommon.view.BaseViewHolder;
import com.ydl.ydlcommon.view.JumpTextView;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.bean.SystemMsgBean;
import com.yidianling.im.router.ImIn;
import com.yidianling.router.RouterManager;
import com.ydl.ydlcommon.adapter.BaseRecyclerAdapter;
import com.ydl.ydlcommon.bean.ShareData;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydlcommon.view.BaseViewHolder;
import com.ydl.ydlcommon.view.JumpTextView;
import java.util.ArrayList;
import java.util.List;
......@@ -201,7 +200,7 @@ public class SystemItemView extends LinearLayout {
String courseId = id;
ImIn.INSTANCE.courseTopic((Activity) context, courseId);
} else {
context.startActivity(ImIn.INSTANCE.mainIntent(context, 2));
ImIn.INSTANCE.mainIntent(context, 2);
}
break;
case "fm":
......@@ -214,7 +213,7 @@ public class SystemItemView extends LinearLayout {
//倾诉
if("/home".equals(uri.getPath())){
//倾诉首页
RouterManager.INSTANCE.getPhoneCallRouter().openConfideHome(context);
ImIn.INSTANCE.getConfideService().openConfideHome(context);
}
break;
}
......
package com.yidianling.im.api.bean;
/**
* Created by xj on 2019/6/27.
*/
public class IMDoctorBriefInfo {
public String smallImage = "";
public double feedbackRate = 0.000;
public int orderNum = 0;
public int helpLong = 0;
}
package com.yidianling.im.api.bean;
/**
* Created by hgw on 2018/3/13.
*/
public class IMExpertBuild {
public IMShareDataBuild shareData;
public String tips; //禁言提示内容
public String url;//禁言帮助URL
public IMDoctorBriefInfo doctorBriefInfo = new IMDoctorBriefInfo();
}
\ No newline at end of file
package com.yidianling.im.api.bean;
import com.google.gson.annotations.SerializedName;
/**
* Created by hgw on 2018/3/13.
*/
public class IMShareDataBuild {
public String toUid;
public String doctorId;
public String listenerId;
// public String name;
public String title;
@SerializedName(value = "isOnline", alternate = "is_online")
public int is_online;//专家倾述在线状态 1.在线 2.离线 3通话中 4-继续拨打 ,
public int isChatOnline;//专家私聊在线状态 1.在线 2.离线
public String cover;
public String desc;
@SerializedName(value = "urlShare", alternate = "url_share")
public String url_share;
public String price;
public String unitTxt;
public String url;
public String urlTitle;
public String blackStatus;
@SerializedName(value = "userType", alternate = "user_type")
public int user_type;//1用户,2专家,3助理
public int is_first;//1表示第一次聊天0不是
public paramsBuild params = new paramsBuild();
public int hasAvailableListenOrder;//是否还有未完成的倾诉订单 1、没有 2、有
public int listenOrderCommentStatus;//倾诉订单评论状态 1:未评价 9:已评价 ,
public String listenOrderCommentUrl;//倾诉订单评价页url
public String listenOrderUrl;//订单详情页面url
public String listenOrderDesc;//倾诉订单状态描述
public String listenOrderRemainTime;//未完成倾诉订单剩余时间
@SerializedName(value = "orderUrl", alternate = "order_url")
public String order_url;
@SerializedName(value = "name", alternate = "doctorName")
public String doctorName;
/**
* 是否开启电话倾诉
* 1.开启 2.关闭
*/
public int listenerIsOpen;
public static class paramsBuild {
//php接口此字段返回值始终为0,更换java接口后,服务端去掉了此字段,本地改动太多,先给默认值
public String orderid = "0";
}
public String tag1 = ""; //该字段是私聊改造项目新加的,用于在获取推荐专家列表的时候,catName字段
}
\ No newline at end of file
package com.yidianling.im.api.bean
import android.os.Parcel
import android.os.Parcelable
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/05/04
*/
data class ReceiveRedPacketParam(
var status: Int = 0,
var money: String? = null,
var name: String? = null,
var headUrl: String? = null,
var expertUrl: String? = null,
var expertName: String? = null,
var expertTime: String? = null) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readInt(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString()) {
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeInt(status)
parcel.writeString(money)
parcel.writeString(name)
parcel.writeString(headUrl)
parcel.writeString(expertUrl)
parcel.writeString(expertName)
parcel.writeString(expertTime)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<ReceiveRedPacketParam> {
override fun createFromParcel(parcel: Parcel): ReceiveRedPacketParam {
return ReceiveRedPacketParam(parcel)
}
override fun newArray(size: Int): Array<ReceiveRedPacketParam?> {
return arrayOfNulls(size)
}
}
}
\ No newline at end of file
......@@ -25,6 +25,8 @@ interface IImService : IProvider {
fun setChattingAccountNone()
fun isHasUnread():Boolean
fun login(info: IMLoginInfo, callback: IMRequestCallback<IMLoginInfo>?)
/**
......
......@@ -78,10 +78,14 @@ dependencies {
implementation project(':ydl-flutter-base')
implementation modularPublication('com.ydl:m-test-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-im-api')
}else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-tests-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
......
......@@ -16,7 +16,7 @@ import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.NetworkParamsUtils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.ydl.ydlcommon.view.dialog.NormalDialog
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.tests.home.param.RecentCmd
import com.yidianling.tests.router.TestsIn
import io.reactivex.android.schedulers.AndroidSchedulers
......
......@@ -10,7 +10,6 @@ import android.view.View
import android.widget.TextView
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.MainUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.yidianling.common.tools.LogUtil
......@@ -20,6 +19,7 @@ import com.yidianling.tests.home.bean.TestHomeBodyBean
import com.yidianling.tests.home.bean.TestHomeDataBean
import com.yidianling.tests.home.config.ITestHomeConfig
import com.yidianling.tests.home.event.UpdateCouponMoneyEvent
import com.yidianling.tests.router.TestsIn
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
......@@ -250,7 +250,7 @@ class TestHomeUtils {
* 只有当和上一次优惠券金额不一致时才会发事件通知更新
*/
fun updateCouponMoney(){
var userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId?: "";
var userId = TestsIn.getUserService().getUserInfo()?.uid?: "";
TestRetrofitApi.getTestRetrofitApi()
.fetchMaxCoupon(userId)
.subscribeOn(Schedulers.io())
......
......@@ -4,10 +4,12 @@ import android.app.Activity
import android.content.Intent
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlUserInfo
import com.yidianling.router.RouterManager
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.im.api.service.IImService
import com.yidianling.tests.api.service.ITestsApiService
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
......@@ -17,6 +19,22 @@ import com.yidianling.user.api.service.IUserService
*/
object TestsIn {
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun getDynamicService(): IDynamicService {
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun getTestsImpl(): ITestsApiService {
return ModularServiceManager.provide(ITestsApiService::class.java)
}
......@@ -37,17 +55,17 @@ object TestsIn {
}
fun publishTrendIntent(activity: Activity, url: String, cover: String, title: String): Intent? {
return RouterManager.getDynamicRouter()?.publishTrendIntent(activity, url, cover, title)
return getDynamicService()?.publishTrendIntent(activity, url, cover, title)
}
fun sendTestResultMessage(uid : String,content : String,title: String?,head : String?,url : String?,id : Int,share_url : String?, callback: IMRequestCallback<Void>) {
RouterManager.getImRouter().sendTestResultMessage(uid, content, title, head, url, id, share_url, callback)
getImService().sendTestResultMessage(uid, content, title, head, url, id, share_url, callback)
}
/**
* 跳转红包
*/
fun myRedPockIntent(activity: Activity){
activity.startActivity(RouterManager.getAppRouter()?.myRedPockIntent(activity))
getAppService().myRedPockIntent(activity)
}
}
\ No newline at end of file
package com.yidianling.tests.router
import android.app.Activity
import android.content.Intent
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.HttpConfig
import com.yidianling.router.tests.ITestsRouter
class TestsRouterImp : ITestsRouter {
override fun testH5Result(testResultId: String) {
val h5Params = H5Params(HttpConfig.MH5_URL+"ceshi/result/"+testResultId, null)
NewH5Activity.start(BaseApp.getApp(),h5Params)
}
override fun testDetailH5(testId: String) {
val h5Params = H5Params(HttpConfig.MH5_URL+"ceshi/"+testId, null)
NewH5Activity.start(BaseApp.getApp(),h5Params)
}
override fun testDetailIntent(activity: Activity, testId: Int): Intent {
return Intent()
}
override fun testResultIntent(activity: Activity, testResultId: Int): Intent {
return Intent()
}
override fun testAnswerIntent(activity: Activity): Intent {
return Intent()
}
}
\ No newline at end of file
......@@ -88,11 +88,15 @@ dependencies {
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-audioim-api')
implementation modularPublication('com.ydl:m-home-api')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-fm-api')
}else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies['ydl-m-home-api']
compileOnly rootProject.ext.dependencies["ydl-m-audioim-api"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
......@@ -5,8 +5,8 @@ import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.request.LoginParam
import com.yidianling.user.route.UserIn
......
......@@ -4,8 +4,8 @@ import com.tencent.bugly.crashreport.CrashReport
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.event.UserLoginEvent
import com.yidianling.user.api.event.UserLogoutEvent
......
......@@ -2,54 +2,65 @@ package com.yidianling.user.modular_service
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.yidianling.user.api.service.IAppService
@Route(path = "/user/AppService")
class AppServiceImpl: IAppService {
override fun mainIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/main/main").navigation()
}
override fun mainIntent(context: Context, selectTab: Int, animation: Boolean) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
val bundle = Bundle()
bundle.putInt("selectTab", selectTab)
bundle.putBoolean("animation", animation)
ARouter.getInstance().build("/main/main")
.withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
.withBundle("bundle",bundle)
.navigation()
}
override fun myRedPockIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/mine/redpacket").navigation()
}
override fun receiverRedPacketIntent(activity: Activity, param: String) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/main/receiveRedPacket").withString("paramStr",param).navigation()
}
override fun personalInfoIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/main/personInfo").navigation()
}
override fun rechargeIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/main/recharge").navigation()
}
override fun splashIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/main/splash").navigation()
}
override fun feedBackIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/mine/FeedBackActivity").navigation()
}
override fun sendRedPacketIntent(activity: Activity, toUid: String) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/main/sendRedPacket").withString("to_uid",toUid).navigation()
}
override fun notificationSettingIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/main/notifysetting").navigation()
}
override fun privacyIntent(activity: Activity) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
ARouter.getInstance().build("/user/privacy").navigation()
}
override fun init(context: Context?) {
......
......@@ -2,12 +2,14 @@ package com.yidianling.user.route
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.ydl.audioim.api.AudioImApi
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.fm.api.service.IFMService
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
* author : Zhangwenchao
......@@ -16,48 +18,61 @@ import com.yidianling.router.im.IMRequestCallback
*/
object UserIn {
fun mainIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.mainIntent(activity)
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun mainIntent(context: Context, selectTab: Int): Intent? {
return RouterManager.getAppRouter()?.mainIntent(context, selectTab, false)
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun imSetAccount(account: String) {
RouterManager.getImRouter().setAccount(account)
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
fun getFmService(): IFMService{
return ModularServiceManager.provide(IFMService::class.java)
}
fun mainIntent(activity: Activity){
getAppService().mainIntent(activity)
}
fun mainIntent(context: Context, selectTab: Int){
getAppService().mainIntent(context, selectTab, false)
}
fun imSetAccount(account: String) {
getImService().setAccount(account)
}
fun splashIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.splashIntent(activity)
fun splashIntent(activity: Activity){
getAppService().splashIntent(activity)
}
fun setChattingAccountAll() {
RouterManager.getImRouter().setChattingAccountAll()
getImService().setChattingAccountAll()
}
fun setChattingAccountNone() {
RouterManager.getImRouter().setChattingAccountNone()
getImService().setChattingAccountNone()
}
fun imLogin(info: IMLoginInfo, callback: IMRequestCallback<IMLoginInfo>) {
RouterManager.getImRouter().login(info, callback)
getImService().login(info, callback)
}
fun imLogout() {
RouterManager.getImRouter().logout()
getImService().logout()
}
// 关闭音频播放
fun closePlayer() {
RouterManager.getCourseRouter()?.closePlayer()
RouterManager.getFMRouter()?.closePlayer()
RouterManager.getPhoneCallRouter()?.closePlayer()
getFmService().closePlayer()
}
// 清除 im 数据
fun clearImData() {
RouterManager.getImRouter().clear()
getImService().clear()
}
// 获取 声网 api
fun getAvImApi(): AudioImApi{
......
package com.yidianling.user.route
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.base.BaseApp
import com.yidianling.common.tools.RxAppTool
import com.yidianling.router.user.IUserRouter
import com.yidianling.router.user.UserResponse
import com.yidianling.router.user.UserSetting
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.PrivacyActivity
import com.yidianling.user.ui.InputPhoneActivity
import com.yidianling.user.ui.login.RegisterAndLoginActivity
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/13
*/
class UserRouterImp : IUserRouter {
val gson: Gson = Gson()
override fun getUserSetting(): UserSetting? {
var infoStr = UserHelper.getUserSettingStr()
if (TextUtils.isEmpty(infoStr)){
return null
}
return gson.fromJson(infoStr, UserSetting::class.java)
}
override fun updateUserInfoSp(userInfo: UserResponse.UserInfo?) {
if (userInfo==null){
return
}
val info:UserResponseBean.UserInfo = gson.fromJson( gson.toJson(userInfo), UserResponseBean.UserInfo::class.java)
UserHelper.updateUserinfo(info)
}
override fun updateUserSetingSp(userSetting: UserSetting?) {
if (userSetting==null){
return
}
val info:UserSettingBean= gson.fromJson(gson.toJson(userSetting), UserSettingBean::class.java)
UserHelper.updateUserSetting(info)
}
override fun setChatTeamHisShowed(showed: Boolean) {
UserHelper.getUsetSetting()?.chatTeamHisShowed = showed
}
override fun setUserResponse(userInfo: UserResponse?) {
val info:UserResponseBean = gson.fromJson(gson.toJson(userInfo), UserResponseBean::class.java)
UserHelper.setUserinfo(info)
}
override fun getUserResponse(): UserResponse? {
var infoStr = UserHelper.getUserInfoStr()
if (TextUtils.isEmpty(infoStr)){
return null
}
return gson.fromJson(infoStr,UserResponse::class.java)
}
override fun isLogin(): Boolean {
return UserHelper.isLogin()
}
override fun isFirstLogin(): Boolean {
return UserHelper.getUserInfo()?.firstLogin==1
}
override fun setFirstLogin(first: Boolean) {
var value : Int = if (first) 1 else 2 //1是2否
UserHelper.getUserInfo()?.firstLogin = value
}
override fun isSafePrivacyClicked(): Boolean {
return UserHelper.getUsetSetting()?.meSafePrivateIsClick?:true
}
override fun putSafePrivacyClicked(clicked: Boolean) {
UserHelper.getUsetSetting()?.meSafePrivateIsClick = clicked
}
override fun getUserInfo(): UserResponse.UserInfo? {
return gson.fromJson(UserHelper.getUserInfoStr(), UserResponse::class.java)?.userInfo
}
override fun isBindPhone(): Boolean {
return !TextUtils.isEmpty(UserHelper.getUserInfo()?.userInfo?.phone)
}
override fun putUnlockCheckSuccessTime(time: Long) {
UserHelper.getUsetSetting()?.unLockCheckSuccessTime = time
}
override fun getChatTeamHisShow(): Boolean {
return UserHelper.getUsetSetting()?.chatTeamHisShowed?:true
}
override fun privacyIntent(activity: Activity): Intent {
return Intent(activity, PrivacyActivity::class.java)
}
override fun loginWayIntent(context: Context): Intent {
return RegisterAndLoginActivity.getIntent(context)
}
override fun inputPhoneIntent(activity: Activity, smsAction: String): Intent {
return InputPhoneActivity.newIntent(activity, smsAction)
}
override fun safeTipViewGone(): Boolean {
//如果是非登录状态 或者 app指纹开启 或者 手势密码不为空 或者 已提示过安全解锁 -> 隐藏 设置密码提示
return !UserHelper.isLogin() || FingerPrintUtil.instance().fingerPrintIsOpen()
|| !TextUtils.isEmpty(FingerPrintUtil.instance().getHandPass())
|| FingerPrintUtil.instance().getTrendsSafeTip()
}
override fun setTrendsSafeTip(status: Boolean) {
FingerPrintUtil.instance().setTrendsSafeTip(status)
}
override fun errorAgainTime(): Long {
return FingerPrintUtil.errorAgainTime
}
override fun isFirstStart(): Boolean {
val lastVersionCode : Int = UserHelper.getUsetSetting()?.lastVersionCode?:0
val currentVersionCode : Int = RxAppTool.getAppVersionCode(BaseApp.getApp())
if (lastVersionCode < currentVersionCode) {
UserHelper.getUsetSetting()?.lastVersionCode = currentVersionCode
return true
}
return false
}
override fun clearUserInfo() {
UserHelper.setUserinfo(null)
UserIn.clearImData()
}
}
\ No newline at end of file
......@@ -98,7 +98,7 @@ class CheckPasswordActivity : BaseActivity() {
if (type == "") {
//进入启动页
// UserIn.startSplash(mContext)
startActivity(UserIn.splashIntent(this))
UserIn.splashIntent(this)
finish()
} else {
//跳转手势密码设置界面
......
......@@ -140,7 +140,7 @@ class FingerPrintCheckActivity : BaseActivity(), View.OnClickListener {
//
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
if (!isFromBackground) {
startActivity(UserIn.splashIntent(this@FingerPrintCheckActivity))
UserIn.splashIntent(this@FingerPrintCheckActivity)
}
//关闭手势解锁页面与指纹解锁页面
// EventBus.getDefault().post(FinishActivityEvent(FingerPrintCheckActivity::class.simpleName))
......
......@@ -37,7 +37,7 @@ class HandUnlockCheckActivity : BaseActivity(), android.view.View.OnClickListene
} else {
if (!isFromBackground) {
startActivity(UserIn.splashIntent(this))
UserIn.splashIntent(this)
}
finish()
return
......@@ -144,7 +144,7 @@ class HandUnlockCheckActivity : BaseActivity(), android.view.View.OnClickListene
//解锁成功
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
if (!isFromBackground) {
startActivity(UserIn.splashIntent(this@HandUnlockCheckActivity))
UserIn.splashIntent(this@HandUnlockCheckActivity)
}
finish()
} else {
......@@ -219,7 +219,7 @@ class HandUnlockCheckActivity : BaseActivity(), android.view.View.OnClickListene
//解锁成功
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
if (!isFromBackground) {
startActivity(UserIn.splashIntent(this@HandUnlockCheckActivity))
UserIn.splashIntent(this@HandUnlockCheckActivity)
}
//关闭手势解锁页面与指纹解锁页面
// EventBus.getDefault().post(FinishActivityEvent(FingerPrintCheckActivity::class.simpleName))
......
......@@ -5,6 +5,7 @@ import android.view.View
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.TextView
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.view.MyToggleButton
......@@ -18,7 +19,7 @@ import com.yidianling.user.ui.InputPhoneActivity
* 安全隐私--手势解锁--指纹解锁
* Created by harvie on 2017/6/10 0010.
*/
@Route(path = "/user/privacy")
class PrivacyActivity : BaseActivity() {
override fun layoutResId(): Int {
return R.layout.user_activity_me_privacy
......
......@@ -15,6 +15,7 @@ import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.lzy.imagepicker.ImagePicker;
import com.lzy.imagepicker.bean.ImageItem;
import com.lzy.imagepicker.ui.ImageGridActivity;
......@@ -37,16 +38,18 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.ThreeLinesDialog;
import com.yidianling.common.tools.RxFileTool;
import com.yidianling.common.tools.RxImageTool;
import com.yidianling.user.GlideImageLoader;
import com.yidianling.user.LoginHelper;
import com.yidianling.user.R;
import com.yidianling.user.UserConstants;
import com.yidianling.user.UserHelper;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.*;
import com.yidianling.user.http.UserHttp;
import com.yidianling.user.http.UserHttpImpl;
import com.yidianling.user.http.request.HeadParam;
import com.yidianling.user.http.request.UserInfoParam;
import com.yidianling.user.route.UserIn;
import de.greenrobot.event.EventBus;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import org.jetbrains.annotations.NotNull;
import java.io.File;
......@@ -55,6 +58,10 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import de.greenrobot.event.EventBus;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* 完善信息
* Created by softrice on 15/12/9.
......@@ -177,13 +184,13 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
.setMessage("确定退出完善资料?")
.setLeftOnclick("退出", (view1) -> {
if (isFromSplash) {
startActivity(UserIn.INSTANCE.mainIntent(this));
UserIn.INSTANCE.mainIntent(this);
ActivityManager.Companion.finishActivity(InputPhoneActivity.class);
ActivityManager.Companion.finishActivity(LoginActivity.class);
finish();
} else if (isRegisterFromRedPacket) {
EventBus.getDefault().post(new RefreshWebEvent());
startActivity(UserIn.INSTANCE.mainIntent(this));
UserIn.INSTANCE.mainIntent(this);
finish();
} else {
EventBus.getDefault().post(new RefreshWebEvent());
......@@ -349,13 +356,13 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
userInfo.getUserInfo().setNick_name(et_nick.getText().toString());
}
if (isFromSplash) {
startActivity(UserIn.INSTANCE.mainIntent(this));
UserIn.INSTANCE.mainIntent(this);
ActivityManager.Companion.finishActivity(InputPhoneActivity.class);
ActivityManager.Companion.finishActivity(LoginActivity.class);
finish();
} else if (isRegisterFromRedPacket) {
EventBus.getDefault().post(new RefreshWebEvent());
startActivity(UserIn.INSTANCE.mainIntent(this));
UserIn.INSTANCE.mainIntent(this);
finish();
} else {
EventBus.getDefault().post(new RefreshWebEvent());
......
......@@ -7,6 +7,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ydl.webview.RefreshWebEvent;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.bean.StatusBarOptions;
......@@ -18,29 +19,34 @@ import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.utils.remind.ToastHelper;
import com.ydl.ydlcommon.view.RoundCornerButton;
import com.ydl.ydlcommon.view.TitleBar;
import com.yidianling.router.RouterManager;
import com.yidianling.router.im.IMLoginInfo;
import com.yidianling.router.im.IMRequestCallback;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.im.api.bean.IMLoginInfo;
import com.yidianling.im.api.bean.IMRequestCallback;
import com.yidianling.user.LoginHelper;
import com.yidianling.user.R;
import com.yidianling.user.UserConstants;
import com.yidianling.user.UserHelper;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.api.event.UserBindPhoneEvent;
import com.yidianling.user.event.UpdateBindStatusEvent;
import com.yidianling.user.http.UserHttp;
import com.yidianling.user.http.UserHttpImpl;
import com.yidianling.user.http.request.*;
import com.yidianling.user.http.request.BindPhoneParam;
import com.yidianling.user.http.request.CodeParam;
import com.yidianling.user.http.request.ForgetParam;
import com.yidianling.user.http.request.LoginParam;
import com.yidianling.user.http.request.RegisterParam;
import com.yidianling.user.route.UserIn;
import de.greenrobot.event.EventBus;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import org.jetbrains.annotations.NotNull;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
import de.greenrobot.event.EventBus;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import static com.yidianling.user.UserConstants.FORGET_ACTION;
import static com.yidianling.user.UserConstants.REGISTER_ACTION;
......@@ -229,12 +235,12 @@ public class GetIdentifyingCodeActivity extends BaseActivity implements View.OnC
.doAfterTerminate(this::dismissProgressDialog)
.subscribe(loginResponse -> {
if (loginResponse != null && !TextUtils.isEmpty(loginResponse.getAccessToken())) {
RouterManager.INSTANCE.getImRouter().logout();
UserIn.INSTANCE.getImService().logout();
// RouterManager.INSTANCE.getImRouter().clear();
//绑定成功,重新登录IM
UserHelper.INSTANCE.setUserinfo(loginResponse);
RouterManager.INSTANCE.getImRouter().login(
UserIn.INSTANCE.getImService().login(
new IMLoginInfo(loginResponse.getUid(), loginResponse.getHxpwd()), null);
LogHelper.Companion.getInstance().writeLogSync("绑定手机成功");
} else {
......@@ -418,7 +424,7 @@ public class GetIdentifyingCodeActivity extends BaseActivity implements View.OnC
UserIn.INSTANCE.imSetAccount(userInfo.getUid() + "");
//流程改了 不需要跳转 用户完善信息界面了
EventBus.getDefault().post(new RefreshWebEvent());
startActivity(UserIn.INSTANCE.mainIntent(this));
UserIn.INSTANCE.mainIntent(this);
ActivityManager.Companion.finishActivity(InputPhoneActivity.class);
ActivityManager.Companion.finishActivity(LoginActivity.class);
finish();
......
......@@ -145,7 +145,7 @@ public class LoginActivity extends BaseMvpActivity<LoginContract.View,LoginContr
int size = ActivityManager.Companion.getActivitySize();
if (size == 2 || size == 1) {
ActivityManager.Companion.finishAll();
startActivity(UserIn.INSTANCE.mainIntent(this));
UserIn.INSTANCE.mainIntent(this);
} else {
finish();
}
......
......@@ -16,8 +16,8 @@ import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.home.api.service.IHomeService
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.LoginUtils
import com.yidianling.user.UserConstants
import com.yidianling.user.api.bean.UserResponseBean
......@@ -157,7 +157,7 @@ class SmsLoginActivity : BaseActivity() {
}
ActivityManager.finishActivity(LoginActivity::class.java)
if (ActivityManager.getActivitySize() <= 1) {
startActivity(UserIn.mainIntent(this))
UserIn.mainIntent(this)
}
finish()
}, object : ThrowableConsumer() {
......
......@@ -279,7 +279,7 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput
val size = ActivityManager.getActivitySize()
if (size <= 2) {//当前stack只有两个页面,必然没有MainActivity
ActivityManager.finishAll()
startActivity(UserIn.mainIntent(this))
UserIn.mainIntent(this)
} else {//需要判断stack中是否有MainActivity
//这里不能引用到MainActivity 想别的办法
var flag = 0
......@@ -304,7 +304,7 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
} else {
ActivityManager.finishAll()
startActivity(UserIn.mainIntent(this))
UserIn.mainIntent(this)
}
}
}
......
......@@ -455,7 +455,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
} else {
finishPrePage()
if (isFromGuide) {
startActivity(UserIn.mainIntent(this))
UserIn.mainIntent(this)
}
}
}
......@@ -556,7 +556,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
val size = ActivityManager.getActivitySize()
if (size == 1) {
ActivityManager.finishAll()
startActivity(UserIn.mainIntent(this))
UserIn.mainIntent(this)
} else {
finishPrePage()
}
......@@ -579,7 +579,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
//当前stack只有一个activity,说明被挤掉线的
if (ActivityManager.getActivitySize() == 1) {
ActivityManager.finishOtherActivity(this)
startActivity(UserIn.mainIntent(this, 4))
UserIn.mainIntent(this, 4)
finish()
} else {
super.onBackPressed()
......
......@@ -275,7 +275,7 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View,
val size = ActivityManager.getActivitySize()
if (size <= 2) {//当前stack只有两个页面,必然没有MainActivity
ActivityManager.finishAll()
startActivity(UserIn.mainIntent(this))
UserIn.mainIntent(this)
} else {//需要判断stack中是否有MainActivity
//这里不能引用到MainActivity 想别的办法
var flag = 0
......@@ -300,7 +300,7 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View,
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
} else {
ActivityManager.finishAll()
startActivity(UserIn.mainIntent(this))
UserIn.mainIntent(this)
}
}
}
......
......@@ -11,12 +11,8 @@ import android.content.Context
*/
interface IYdlCommonRouter {
fun publishArticleToTrend(activity: Activity, url: String, cover: String, title: String)
fun startMain(activity: Activity, isSplashActivity: Boolean)
fun isHasUnread(): Boolean
fun startMain(context: Context, selectTab: Int, trend_tap: String?)
fun setMoreService(context: Context)
......
......@@ -55,9 +55,14 @@ dependencies {
api project(':ydl-platform')
api fileTree(dir: 'libs', include: ['*.jar'])
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-im-api')
}else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly files('libs/tbs_sdk_thirdapp_163319.jar')
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
......@@ -40,7 +40,6 @@ import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.bean.StatusBarOptions;
import com.ydl.ydlcommon.router.YdlCommonRouterManager;
import com.ydl.ydlcommon.ui.LogoLoadingView;
import com.ydl.ydlcommon.utils.BuryPointUtils;
import com.ydl.ydlcommon.utils.LogUtil;
......@@ -1194,7 +1193,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
safeTipView.updateVisibility();
}
if (h5Params.isShowMenu()) {
if (YdlCommonRouterManager.INSTANCE.getYdlCommonRoute().isHasUnread()) {
if (WebModularServiceUtils.Companion.getImService().isHasUnread()) {
tb_title.setImage_right(getResources().getDrawable(R.drawable.platform_common_notice_more_en));
} else {
tb_title.setImage_right(getResources().getDrawable(R.drawable.platform_common_notice_more_un));
......@@ -1282,6 +1281,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
private void toTrend(String url) {
YdlCommonRouterManager.INSTANCE.getYdlCommonRoute().publishArticleToTrend(NewH5Activity.this, url, cover, shareTitle);
WebModularServiceUtils.Companion.getDynamicService().publishArticleToTrend(NewH5Activity.this, url, cover, shareTitle);
}
}
......@@ -2,7 +2,9 @@ package com.ydl.webview
import android.app.Activity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService
/**
......@@ -12,6 +14,20 @@ import com.yidianling.user.api.service.IUserService
class WebModularServiceUtils {
companion object {
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun getDynamicService(): IDynamicService {
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun getAppService(): IAppService {
return ModularServiceManager.provide(IAppService::class.java)
}
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
......@@ -21,7 +37,8 @@ class WebModularServiceUtils {
}
fun startMain(activity: Activity){
YdlCommonRouterManager.getYdlCommonRoute().startMain(activity,false)
getAppService().mainIntent(activity)
}
}
}
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