Commit d8365292 by 万齐军

Merge branch 'feat/lp/lp_nim2' into 'feat/qj/arch3'

js组件抽取完毕

See merge request app_android_lib/YDL-Component!272
parents b10cd886 6317251b
......@@ -41,4 +41,6 @@ interface IConfideService : IProvider {
fun isOnlineRtm():Boolean
fun requestConfidePermission(activity: FragmentActivity, call: ((Boolean) -> Unit)?)
fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit)
}
\ No newline at end of file
package com.ydl.confide.home.event
package com.ydl.confide.event
data class ChangeAnotherExpertEvent(
var doctorID: String,
var title: String,
var uid: String,
var linkUrl: String
)
class ConfideDialogEvent(val show: Int)
\ No newline at end of file
)
\ No newline at end of file
package com.ydl.confide.event
class ConfideDialogEvent(val show: Int)
\ No newline at end of file
package com.yidianling.im.event
package com.yidianling.im.api.event
data class CloseBottomWebviewEvent( var close:Boolean)
\ No newline at end of file
......@@ -188,4 +188,6 @@ interface IImService : IProvider {
fun showConsultServiceDialog(activity: Activity, toUid: String, doctorId: String)
fun dismissConsultServiceDialog();
/**群聊*/
fun startTeamSession(activity: Activity, tid: String, doctorId: String)
}
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.js.api">
</manifest>
\ No newline at end of file
package com.ydl.js.api
import com.alibaba.android.arouter.facade.template.IProvider
interface IJsService : IProvider {
fun isH5Open(): Boolean
fun isMainOpen(): Boolean
fun setH5Open(open: Boolean)
fun setMainOpen(open: Boolean)
}
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.media.api">
</manifest>
\ No newline at end of file
package com.ydl.media.api
import android.app.Activity
import com.alibaba.android.arouter.facade.template.IProvider
interface IMediaService : IProvider {
fun closeFloatView(activity: Activity);
}
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.muse.api">
</manifest>
\ No newline at end of file
package com.ydl.muse.api
import android.app.Activity
import com.alibaba.android.arouter.facade.template.IProvider
interface IMuseService : IProvider {
fun switchSound(activity: Activity,
mediaId: Int, meditationId: Long, meditationType: Int, businessType: Int,
buried: String?, mediaUrl: String?, mediaCoverUrl: String?,
title: String?, desc: String?, status: Int
)
}
\ No newline at end of file
......@@ -7,12 +7,11 @@ import com.google.gson.JsonParser
import com.tencent.smtt.sdk.WebView
import com.ydl.audioim.YDLavManager
import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.confide.event.ConfideDialogEvent
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.ui.Loading
import com.yidianling.common.tools.ToastUtil
import com.yidianling.common.tools.asFragmentActivity
import com.yidianling.user.UserHelper
......
......@@ -8,7 +8,7 @@ import android.graphics.Rect;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ScreenUtils;
import com.ydl.confide.api.IConfideService;
import com.ydl.confide.home.event.ChangeAnotherExpertEvent;
import com.ydl.confide.event.ChangeAnotherExpertEvent;
import com.ydl.webview.H5JsBean;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
......@@ -17,14 +17,17 @@ import com.yidianling.common.tools.LogUtil;
import com.yidianling.consultant.preview.GPreviewBuilder;
import com.yidianling.consultant.preview.UserViewInfo;
import com.yidianling.im.api.service.IImService;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import com.yidianling.muse.activity.ChooseMusicActivity;
import java.util.ArrayList;
import java.util.List;
//import static com.ydl.ydlcommon.router.IYDLRouterConstant.ROUTER_MUSE_PLAY;
import de.greenrobot.event.EventBus;
import com.yidianling.im.api.event.CloseBottomWebviewEvent;
import java.util.ArrayList;
import java.util.List;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
......
......@@ -27,8 +27,8 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.tencent.smtt.export.external.interfaces.JsResult
import com.tencent.smtt.sdk.*
import com.ydl.confide.R
import com.ydl.confide.home.event.ChangeAnotherExpertEvent
import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.confide.event.ConfideDialogEvent
import com.ydl.confide.event.ChangeAnotherExpertEvent
import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.confide.router.PhoneCallIn
import com.ydl.utils.WebUrlParamsUtils
......
......@@ -131,4 +131,8 @@ class ConfdieServiceImpl : IConfideService {
ConfidePermissionDialog().apply { callback = call }.show(activity.supportFragmentManager, "ConfidePermissionDialog")
}
override fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit) {
YDLavManager.instances.login(userId,event)
}
}
\ No newline at end of file
......@@ -431,4 +431,13 @@ class IMServiceImpl : IImService {
override fun dismissConsultServiceDialog() {
expertConsultServiceListDialog2?.changeItem()
}
override fun startTeamSession(activity: Activity, tid: String, doctorId: String) {
SessionHelper.startTeamSession(
activity,
tid + "",
null,
P2PCustomActionHandlerImpl(doctorId + "")
)
}
}
\ No newline at end of file
......@@ -61,7 +61,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import com.yidianling.im.api.event.CloseBottomWebviewEvent;
import com.yidianling.im.event.MultipleAnswerBean;
import com.yidianling.im.event.MultipleSelectedEvent;
import com.yidianling.im.helper.IMChatUtil;
......
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply from: "../publish.gradle"
kapt {
arguments {
arg("AROUTER_MODULE_NAME", "js")
}
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
consumerProguardFiles "consumer-rules.pro"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: "js"]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled true
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.aar','*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.alibaba:arouter-api:$arouter_api"
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
// 时间选择器
implementation 'com.contrarywind:Android-PickerView:4.1.9'
api rootProject.ext.dependencies["ydl-user-router"]
api project(':ydl-webview')
api project(':ydl-platform')
implementation project(':ydl-media')
implementation project(":ydl-pay")
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:consultant")
implementation project(":api:confide")
implementation project(":api:dynamic")
implementation project(":api:tests")
implementation project(":api:fm")
implementation project(":api:course")
implementation project(':api:media')
implementation project(':api:muse')
implementation project(':api:js')
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.js">
</manifest>
\ No newline at end of file
package com.ydl.js
import android.Manifest
import com.blankj.utilcode.util.PermissionUtils
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.tencent.smtt.sdk.WebView
import com.ydl.confide.api.IConfideService
import com.ydl.confide.event.ConfideDialogEvent
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.Utils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.common.tools.asFragmentActivity
import de.greenrobot.event.EventBus
class JsMethod(private val webView: WebView?) {
fun handle(param: String): Boolean {
try {
val obj = JsonParser().parse(param).asJsonObject
val cmd = obj.getAsJsonObject("cmd")
val actionName = cmd?.getAsJsonPrimitive("action_name")?.asString
if (actionName.isNullOrBlank()) return false
return innerHandle(actionName, cmd)
} catch (throwable: Throwable) {
throwable.printStackTrace()
return false
}
}
private fun innerHandle(actionName: String, obj: JsonObject): Boolean {
val param = obj.getAsJsonObject("params")
when (actionName) {
"handle_confide_btn" -> {
val show = param.getAsJsonPrimitive("show").asInt
EventBus.getDefault().post(ConfideDialogEvent(show))
return true
}
"show_loading" -> {
// val topActivity = BaseActivityMgr.INST.getTopActivity()
// Loading.show(topActivity)
return true
}
"close_loading" -> {
// Loading.close()
return true
}
"open_app_eval_list" -> {
val url = param.getAsJsonPrimitive("url").asString
val topActivity = BaseActivityMgr.INST.getTopActivity()
NewH5Activity.start(topActivity, H5Params(url, ""))
return true
}
"toast" -> {
val msg = param.getAsJsonPrimitive("msg").asString
if (!msg.isNullOrBlank()) {
ToastUtil.toastShort(msg)
}
return true
}
"has_audio_permission" -> {
val callback = param.getAsJsonPrimitive("callback").asString
if (callback.isNullOrBlank()) return true
if (PermissionUtils.isGranted(Manifest.permission.RECORD_AUDIO)) {
webView?.post {
webView.loadUrl("javascript:$callback(1)")
}
return true
}
(webView?.context?.asFragmentActivity())?.let {
findRouteService(IConfideService::class.java).requestConfidePermission(it) { granted ->
webView.post {
webView.loadUrl("javascript:$callback(${if (granted) 1 else 0})")
}
}
}
return true
}
"confide_dial" -> {
//倾诉链接 java接口,支持axb和声网
val id = param.getAsJsonPrimitive("id").asInt
val data = param.getAsJsonObject("data").toString()
val topActivity = BaseActivityMgr.INST.topActivity
if (!JsModularService.getIConfideService().isOnlineRtm()) {
//异常退出或者账号被顶掉,重新登录并拨打
JsModularService.getIConfideService().login(JsModularService.getIUserService().getUserInfo()?.uid) { isSuccess: Boolean, _ ->
if (isSuccess) {
findRouteService(IConfideService::class.java).confideDial(id,
data,
topActivity)
} else {
ToastUtil.toastShort("请重新拨打")
}
}
} else {
findRouteService(IConfideService::class.java).confideDial(id, data, topActivity)
}
return true
}
"check_app_support" -> {
val callback = param.getAsJsonPrimitive("callback").asString
val type = param.getAsJsonPrimitive("type").asInt
if (callback.isNullOrBlank()) return true
webView?.post {
when (type) {
1 -> {//检查音频权限能力
webView.loadUrl("javascript:$callback(1)")
}
else -> {
webView.loadUrl("javascript:$callback(0)")
}
}
}
return true
}
"startCms" ->{
if (Utils.isFastClick()) {
return true
}
val activity = BaseActivityMgr.INST.topActivity
if (JsModularService.getIUserService().loginByOneKeyLogin(activity, true)) {
val location = param.getAsJsonPrimitive("location").asInt
JsModularService.getImService().startP2PSession(activity, location, null)
}
return true
}
"to_search_list" ->{
if (Utils.isFastClick()) {
return true
}
val cateId = param.getAsJsonPrimitive("cateId").asString
val cateTitle = param.getAsJsonPrimitive("cateTitle").asString
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_CONSULT_LIST,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_CATEID, cateId)
.putExtra(IYDLRouterConstant.EXTRA_CATETITLE, cateTitle)
.putExtra(IYDLRouterConstant.EXTRA_SHOWTYPE, "0")
)
return true
}
else -> {
return false
}
}
}
}
\ No newline at end of file
package com.ydl.js
import com.ydl.confide.api.IConfideService
import com.ydl.course.api.ICourseService
import com.ydl.media.api.IMediaService
import com.ydl.muse.api.IMuseService
import com.ydl.ydlcommon.modular.ModularServiceManager
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.service.IAppService
import com.yidianling.user.api.service.IUserService
class JsModularService {
companion object{
fun getIConfideService(): IConfideService{
return ModularServiceManager.provide(IConfideService::class.java)
}
fun getIUserService(): IUserService{
return ModularServiceManager.provide(IUserService::class.java)
}
fun getIAppService(): IAppService{
return ModularServiceManager.provide(IAppService::class.java)
}
fun getIDynamicService(): IDynamicService{
return ModularServiceManager.provide(IDynamicService::class.java)
}
fun getImService(): IImService {
return ModularServiceManager.provide(IImService::class.java)
}
fun getITestsApiService(): ITestsApiService {
return ModularServiceManager.provide(ITestsApiService::class.java)
}
fun getIFMService(): IFMService {
return ModularServiceManager.provide(IFMService::class.java)
}
fun getICourseService(): ICourseService {
return ModularServiceManager.provide(ICourseService::class.java)
}
fun getIMediaService(): IMediaService {
return ModularServiceManager.provide(IMediaService::class.java)
}
fun getIMuseService(): IMuseService {
return ModularServiceManager.provide(IMuseService::class.java)
}
}
}
\ No newline at end of file
package com.ydl.js;
import com.ydl.webview.H5JsBean;
/**
* webview 点击事件监听
* Created by harvie on 2017/7/4 0004.
*/
public interface NewH5_WebViewClientClickListener {
void openH5(H5JsBean.H5JsCmd.Params jsData);
void courseList();
void activeDetail(String id);
void contactYi();
void contactCourseCustomerService();
void openTopicDetail(String topic_id);
void openMember(String id);
void sendTrend();
void sendResultTrend(final String cover1, final String title1, final String purl1, String share_url1);
void sendInfo(H5JsBean.H5JsCmd.Params params);
void searchList(H5JsBean.H5JsCmd.Params params);
void openExpertsHome(H5JsBean.H5JsCmd.Params params);
void openTest(H5JsBean.H5JsCmd.Params params);
//注册引导页--跳转私聊界面
void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu, boolean closeReplaceChat);
void chatSendMessage(int id, int toUid, int canTalk, String accessToken, int isFromQingShu);
void chatTeam(int tid, int doctorId);
void jumpLogin(H5JsBean.H5JsCmd.Params jsData);
void openFmDetail(int id);
void openArticle();
void openFmList();
void sendSubscriptionTimeMessage(String to_uid);
void pay(H5JsBean.H5JsCmd.Params jsData);
void payReceipt(H5JsBean.H5JsCmd.Params jsData);
void payCourse(H5JsBean.H5JsCmd.Params jsData);
void payTest(H5JsBean.H5JsCmd.Params jsData);
void viewTestResult(H5JsBean.H5JsCmd.Params jsData);
void ydlNative(H5JsBean.H5JsCmd jsData);//用于神策统计
void openOrderDetail(H5JsBean.H5JsCmd.Params params);
void expertProduct(H5JsBean.H5JsCmd.Params params);
void order(H5JsBean.H5JsCmd.Params params);
void toOrderCt(H5JsBean.H5JsCmd.Params params);
void showDocList(H5JsBean.H5JsCmd.Params params);
void goodExpert();
void copyWechat(H5JsBean.H5JsCmd.Params params);
void goWechat();
void listenOrderDetail(H5JsBean.H5JsCmd.Params params);
void detailSub(H5JsBean.H5JsCmd.Params params);
void openAgreement(H5JsBean.H5JsCmd.Params params);
void modifyEval(H5JsBean.H5JsCmd.Params params);
void visitEval(H5JsBean.H5JsCmd.Params params);
void coursePlay(H5JsBean.H5JsCmd.Params params);
void closeFloatView();
void courseWriteComment(H5JsBean.H5JsCmd.Params params);
void courseComment(H5JsBean.H5JsCmd.Params params);
void listenTel(H5JsBean.H5JsCmd.Params jsData);
void voiceBroadcast(H5JsBean.H5JsCmd.Params params);
void tel(H5JsBean.H5JsCmd.Params params);
void onOrderByApp(H5JsBean.H5JsCmd.Params params);
void orderSetTime(H5JsBean.H5JsCmd.Params params);
void searchServiceDoc(int cateId);
void openTestDetail(H5JsBean.H5JsCmd.Params params);
void shareAction(H5JsBean.H5JsCmd.Params params);
void openTestList();
void feedBack();
void phoneCall();
void chatSchedule(H5JsBean.H5JsCmd.Params params);
void invite(H5JsBean.H5JsCmd.Params params);
void balance(H5JsBean.H5JsCmd.Params params);
//是否显示下拉刷新控件
void switchDownRefresh(H5JsBean.H5JsCmd.Params params);
//跳转充值界面
void recharge();
void bindPhone();
//界面刷新
void refresh();
//声网拨号逻辑
void listenAgora(H5JsBean.H5JsCmd.Params jsData);
void setTitle(H5JsBean.H5JsCmd.Params jsData);
void saveImage(H5JsBean.H5JsCmd.Params jsData);
void sendToExpert(H5JsBean.H5JsCmd.Params jsData);
void confideConnect(H5JsBean.H5JsCmd.Params jsData);
void confidePay(H5JsBean.H5JsCmd.Params jsData);
void back();
//调用公共支付的
void commonPay(H5JsBean.H5JsCmd.Params jsData);
//隐藏statusbar,全屏展示
void hideStatusBar();
void showStatusBar();
//打开与关闭右上角菜单
void openRightTopMenu();
//打开与关闭底部分享弹框
void openShareMenu(H5JsBean.H5JsCmd.Params params);
//关闭页面
void closeWebKit();
void goHome(H5JsBean.H5JsCmd.Params params);
/**
* 向h5发送对那个uid的未读数
* @param callbackFuncName
* @param uid
*/
void sendUnReadNum(String callbackFuncName, String uid);
//h5页面是否需要打开推送
void switchPushStatus(H5JsBean.H5JsCmd.Params params);
//是否展示标题栏
void shouldShowTitleBar(boolean isShowTitleBar);
//设置当前页面类型
void setSelfPageType(int selfType);
void setBootomFitViewColor(String color);
/**打开时间选择器*/
void openTimePicker(String jsCallBackName, String day, String doctorId, String orderId);
/**返回上一页并刷新*/
void goBackAndReload(String url);
/**跳转第三方APP*/
void toThirdApp(String url);
/**页面内跳转url*/
void reloadUrl(String url);
default void playMeditation(int mediaId, long meditationId, int meditationType, String mediaCoverUrl) {
}
default void switchSound(int mediaId, long meditationId, int meditationType, int businessType,
String buried, String mediaUrl, String mediaCoverUrl, String title,
String desc, int status) {
}
default void setBG(String rgb, String alpha) {
}
void getNextExpertStatus(String doctorID, String title, String uid, String linkUrl);
/**
* 关闭私聊窗口立即咨询webview
*/
void chatCloseBottomWebView();
}
package com.ydl.js
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.text.TextUtils
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.tencent.smtt.sdk.WebView
import com.ydl.confide.api.IConfideService
import com.ydl.webview.*
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.Utils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.ydl_pay.pay.payDialog.CallBack
import com.yidianling.ydl_pay.pay.payDialog.ConfidePayParams
import com.yidianling.ydl_pay.pay.payDialog.PayDialog
/**
* Created by haorui on 2019-10-10.
* Des:
*/
@Route(path = "/web/webservice")
class WebServiceImpl : IWebService {
override fun getJavascripHandler(activity: Activity, webView:WebView?, tellData: TellData): IJavascriptHandler {
return NewH5_JavascriptHandler(webView, object : NewH5_WVClickAbstractListener(activity) {
override fun setTitle(jsData: H5JsBean.H5JsCmd.Params?) {
//设置webview标题
if (activity is NewH5Activity) {
activity.setWebViewTitle(jsData?.title)
}
}
//倾诉链接java接口
override fun confideConnect(jsData: H5JsBean.H5JsCmd.Params?) {
if (Utils.isFastClick()) {
//防止连击
return
}
if (!JsModularService.getIConfideService().isOnlineRtm()) {
//异常退出或者账号被顶掉,重新登录并拨打
JsModularService.getIConfideService().login(JsModularService.getIUserService().getUserInfo()?.uid) { isSuccess: Boolean, _ ->
if (isSuccess) {
connectionJava(jsData?.id ?: 0, jsData?.confideType ?: 1, activity, tellData, jsData?.callType)
} else {
ToastUtil.toastShort("请重新拨打")
}
}
} else {
connectionJava(jsData?.id ?: 0, jsData?.confideType ?: 1, activity, tellData, jsData?.callType)
}
}
//php线路已废除
override fun listenTel(jsData: H5JsBean.H5JsCmd.Params?) {
}
override fun listenAgora(jsData: H5JsBean.H5JsCmd.Params?) {
if (Utils.isFastClick()) {
//防止连击
return
}
//声网路线
connectionJava(jsData?.id ?: 0, 3, activity, tellData, jsData?.callType)
}
override fun confidePay(jsData: H5JsBean.H5JsCmd.Params?) {
//倾诉支付
val confidePay = ConfidePayParams(
jsData?.payTitle ?: "倾诉服务", jsData?.orderPrice, jsData?.coupnPrice ?: 0.00,
jsData?.avliableMoney ?: 0.00, jsData?.payId ?: "", jsData?.confideUrl ?: "", jsData?.merchantType
)
confidePayDialog(jsData?.id, jsData?.confideType, activity, confidePay, jsData?.callType)
}
override fun back() {
if (activity is NewH5Activity) {
activity.goBack()
}
}
})
}
//倾诉支付弹窗
private fun confidePayDialog(id: Int?, type : Int?, activity: Activity, confidePay : ConfidePayParams, callType:String?){
PayDialog(activity)
.setCallback(object : CallBack {
override fun onSuccess() {
//支付成功,直接拨打
if (TextUtils.isEmpty(confidePay.confideUrl)) {
connectionJava(id ?: 0, type ?: 1, activity, null, callType)
} else {
//倾诉订单列表页面过来,会有confideUrl值,则直接跳转此url
NewH5Activity.start(activity, H5Params(confidePay.confideUrl!!, ""))
}
}
override fun onError() {
}
})
.show(confidePay)
}
//java版axb和声网接口
@SuppressLint("CheckResult")
private fun connectionJava(id: Int, type: Int, activity: Activity, tellData: TellData?, callType: String?) {
try {
JsModularService.getIConfideService().connectionJava(
id, type, activity, Gson().toJson(tellData), callType
)
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun init(context: Context) {
}
}
package com.ydl.js.bean
data class TimeDataBean(
var serviceTime:Int, // 咨询时长
var times:ArrayList<String> // 时间集合
)
\ No newline at end of file
package com.ydl.js.http
import com.ydl.js.bean.TimeDataBean
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Query
interface JsApi {
/**
* 获取时间选择器数据
*/
@GET("consult/user/order/selectWorriesReducibleTime")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getTimePickerData(
@Query("day") day: String,
@Query("doctorId") doctorId: String,
@Query("orderId") orderId: String
): Observable<BaseResponse<ArrayList<TimeDataBean>>>
}
\ No newline at end of file
package com.ydl.js.http
import com.ydl.js.bean.TimeDataBean
import com.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
interface JsHttp {
// 获取时间选择器数据
fun getTimePickerData(day:String,doctorId:String,orderId:String): Observable<BaseResponse<ArrayList<TimeDataBean>>>
}
package com.ydl.js.http
import com.ydl.js.bean.TimeDataBean
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils
import io.reactivex.Observable
class JsHttpImpl private constructor() : JsHttp{
companion object {
fun getInstance(): JsHttpImpl {
return Holder.INSTANCE
}
fun clearAppApi() {
Holder.INSTANCE.appApi = null
}
}
private var appApi: JsApi? = null
private fun getAppApi(): JsApi {
if (appApi == null) {
appApi = YDLHttpUtils.obtainApi(JsApi::class.java)
}
return appApi!!
}
object Holder {
val INSTANCE = JsHttpImpl()
}
override fun getTimePickerData(
day: String,
doctorId: String,
orderId: String
): Observable<BaseResponse<ArrayList<TimeDataBean>>> {
return getAppApi().getTimePickerData(day,doctorId,orderId)
}
}
\ No newline at end of file
package com.ydl.js.moduler.service
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.js.api.IJsService
@Route(path = "/js/JsService")
class JsImpl : IJsService {
companion object {
var isH5Open = true
var isMainOpen = true
}
override fun init(context: Context?) {
}
override fun isH5Open(): Boolean {
return isH5Open
}
override fun isMainOpen(): Boolean {
return isMainOpen
}
override fun setH5Open(open: Boolean) {
isH5Open = open
}
override fun setMainOpen(open: Boolean) {
isMainOpen = open
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="300"
android:fromYDelta="0"
android:toYDelta="100%p" />
</set>
\ No newline at end of file
......@@ -59,6 +59,7 @@ dependencies {
api project(":ydl-platform")
implementation project(':ydl-media')
implementation project(":api:user")
implementation project(":api:muse")
implementation project(':ydl-flutter-base')
implementation project(':ydl-webview')
......
package com.yidianling.muse.moduler.service
import android.app.Activity
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.muse.api.IMuseService
import com.yidianling.muse.activity.ChooseMusicActivity
@Route(path = "/muse/MuseService")
class MuseImpl : IMuseService {
override fun init(context: Context?) {
}
override fun switchSound(
activity: Activity,
mediaId: Int,
meditationId: Long,
meditationType: Int,
businessType: Int,
buried: String?,
mediaUrl: String?,
mediaCoverUrl: String?,
title: String?,
desc: String?,
status: Int
) {
(activity as ChooseMusicActivity).switchSound(
mediaId, meditationId, meditationType,
businessType, buried, mediaUrl, mediaCoverUrl, title, desc, status
)
}
}
\ No newline at end of file
......@@ -5,5 +5,5 @@ include ':app',
':m-consultant', ':m-muse', ':m-fm', ':m-tests', ":m-course",
":m-im",":m-dynamic",":m-article",":m-audioim",":m-user", ":m-confide"
include ':ydl-tuicore', ':api:confide', ':api:dynamic', ':api:fm', ':api:consultant',
':api:course', ':api:user', ':api:tests', ':api:im',':api:home'
include ':api:audioim'
':api:course', ':api:user', ':api:tests', ':api:im',':api:home',':api:media',':api:muse',':api:js'
include ':m-js'
......@@ -4,6 +4,11 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: "../publish.gradle"
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
android {
compileSdkVersion 28
......@@ -42,8 +47,12 @@ dependencies {
api(rootProject.ext.dependencies["ydl-ijkplayer-jjdxm"]) {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
api project(':ydl-platform')
implementation project(':api:media')
}
package com.ydl.media.moduler.service
import android.app.Activity
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.media.api.IMediaService
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
@Route(path = "/media/MediaService")
class MediaImpl :IMediaService {
override fun init(context: Context?) {
}
override fun closeFloatView(activity: Activity) {
activity.runOnUiThread(Runnable {
try {
if (PlayerFloatHelper.isShow(activity)) {
PlayerFloatHelper.removeView(activity)
AudioPlayer.get().stopPlayer()
}
} catch (e: Exception) {
e.printStackTrace()
}
})
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment