Commit 25924372 by 刘鹏

Merge branch 'feat/qj/arch3' into 'd/v4.4.07'

组件架构2期

See merge request app_android_lib/YDL-Component!279
parents 3921888b af5e2e66
/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.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.audioim.api">
</manifest>
\ No newline at end of file
package com.ydl.audioim.api
import android.app.Activity
import android.content.Context
import com.alibaba.android.arouter.facade.template.IProvider
/**
* Created by Ykai on 2022/7/26.
*/
interface IAudioImService : IProvider{
/**
* YDLavManager初始化方法
*/
fun yDLAvManagerInit(context: Context, appId: String)
/**
* 获取rtm是否在线
*/
fun getIsOnlineRtm(): Boolean
/**
* rtm登录返回并登录状态
*/
fun loginRtm(userId:String?,event: (isSuccess: Boolean, msg: String?) -> Unit)
/**
* rtm登录
*/
fun loginRtm(userId:String?)
/**
* 拨打语音电话转axb弹窗
*/
fun openAxbDialog(activity: Activity?, type:Int, phoneNumber: String?)
/**
* 事件上报
*/
fun callEventSave(status: String, res: String, session: String?, line: String)
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ public class ExpertInfoBean {
public String listenerIsOpen;
public String listenOrderStatus;
public String channelId;
public ExpertInfoBean.ListenRemainingTime remainingTime;
public ListenRemainingTime remainingTime;
public String totalDuration;
public String commentUrl;
......
......@@ -38,7 +38,5 @@ interface IConfideService : IProvider {
uid: String
)
fun isOnlineRtm():Boolean
fun requestConfidePermission(activity: FragmentActivity, call: ((Boolean) -> Unit)?)
}
\ No newline at end of file
package com.ydl.confide.home.event
package com.ydl.confide.event
data class ChangeAnotherExpertEvent(
var doctorID: String,
......@@ -6,5 +6,3 @@ data class ChangeAnotherExpertEvent(
var uid: String,
var linkUrl: String
)
\ No newline at end of file
class ConfideDialogEvent(val show: Int)
\ No newline at end of file
package com.ydl.confide.event
class ConfideDialogEvent(val show: Int)
\ No newline at end of file
......@@ -30,4 +30,6 @@ android {
dependencies {
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compileOnly(project(":ydl-webview"))
}
\ No newline at end of file
......@@ -4,9 +4,10 @@ import android.app.Activity
import android.content.Context
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider
import com.ydl.webview.H5JsBean
import com.yidianling.consultant.OnBottomWordListener
import com.yidianling.consultant.bean.GuideBean
import com.yidianling.consultant.bean.Keyworks
import com.yidianling.consultant.OnBottomWordListener
/**
* Created by xj on 2019/11/14.
......@@ -51,4 +52,7 @@ interface IConsultantService: IProvider {
//获取底纹词
fun getbottomWord(type: Int, listener: OnBottomWordListener)
// 预览资源
fun resourceToPreview(dataList: List<H5JsBean.MediaInfo>?, params: H5JsBean.H5JsCmd.Params, activity: Activity)
}
\ 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.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
......@@ -220,6 +220,8 @@ dependencies {
implementation project(':m-fm')
implementation project(":api:fm")
implementation project(':ydl-tuicore')
implementation project(':m-js')
implementation project(':api:js')
implementation rootProject.ext.dependencies["retrofit-url-manager"]
......
package com.ydl.component.service;
import android.app.Activity;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.tencent.smtt.sdk.WebView;
import com.ydl.component.service.web.WVClickAbstractListener;
import com.ydl.component.service.web.WebJavascriptHandler;
import com.ydl.webview.IJavascriptHandler;
import com.ydl.webview.IWebService;
import com.ydl.webview.TellData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Created by haorui on 2019-10-10.
* Des:
*/
@Route(path = "/web/webservice")
public class WebServiceImpl implements IWebService {
@Override
public void init(Context context) {
}
@NotNull
@Override
public IJavascriptHandler getJavascripHandler(@NotNull Activity activity, @Nullable WebView webView, @NotNull TellData tellData) {
return new WebJavascriptHandler(webView, new WVClickAbstractListener(activity));
}
}
/build
\ No newline at end of file
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.cxzapp.yidianling"
minSdk 21
targetSdk 28
versionCode 1
versionName "1.0"
flavorDimensions "versionCode"
ndk {
abiFilters "arm64-v8a"
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "e4b0d0bb7ef01053c93e25ba", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
XIAOMI_APPKEY : "MI-5241743243980",//小米平台注册的appkey
XIAOMI_APPID : "MI-2882303761517432980",//小米平台注册的appid
HUAWEI_APPID : "10444675",//华为平台注册的appid
OPPO_APPKEY : "OP-afk71f35VogGw0w0wKsookksc", // OPPO平台注册的appkey
OPPO_APPID : "OP-3245516", // OPPO平台注册的appid
OPPO_APPSECRET: "OP-691184F044acA7a6851F578451f67616",//OPPO平台注册的appsecret
VIVO_APPKEY : '67d79734-c9c5-4916-a6f4-ba2ef4df09a4',
VIVO_APPID : '14298',
MEIZU_APPKEY : "MZ-00d268d7228748479036f202d45b4ef2",//魅族平台注册的appkey
MEIZU_APPID : "MZ-120344",//魅族平台注册的appid
qqappid : "1105070461",
APPLICATIONID : rootProject.ext.ydl_app["applicationId"]
]
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/proguard/coroutines.pro'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
signingConfigs {
release {
storeFile file("../app/keystore.jks")
storePassword "123456"
keyAlias "ydl"
keyPassword "123456"
}
}
buildTypes {
debug{
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
signingConfigs {
release {
storeFile file("keystore.jks")
storePassword "123456"
keyAlias "ydl"
keyPassword "123456"
}
}
productFlavors {
ydl{}
xlzx{}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
repositories {
flatDir {
dirs 'aar'
}
}
dependencies {
implementation fileTree(dir: 'aar', include: ['*.aar'])
implementation(project(":ydl-flutter-base"))
implementation(project(":ydl-media"))
implementation(project(":ydl-net"))
implementation(project(":ydl-pay"))
implementation(project(":ydl-platform"))
implementation(project(":ydl-tuicore"))
implementation(project(":ydl-utils"))
implementation(project(":ydl-webview"))
implementation(project(":m-article"))
implementation(project(":m-audioim"))
implementation(project(":m-confide"))
implementation(project(":m-consultant"))
implementation(project(":m-course"))
implementation(project(":m-dynamic"))
implementation(project(":m-fm"))
implementation(project(":m-home"))
implementation(project(":m-im"))
implementation(project(":m-js"))
implementation(project(":m-muse"))
implementation(project(":m-tests"))
implementation(project(":m-user"))
implementation('com.ydl.debugkit:debugkit:1.0.0')
implementation('com.ydl.aar:heytap:3.0.0')
implementation "com.ydl.lib:smart_spa:0.0.4"
implementation 'com.volcengine:apm_insight:1.4.6.cn'
implementation 'com.volcengine:apm_insight_crash:1.4.5'
implementation 'com.meituan.android.walle:library:1.1.5'
implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
// 权限库
implementation 'com.hjq:xxpermissions:10.2'
// 时间选择器
implementation 'com.contrarywind:Android-PickerView:4.1.9'
// sophix hotfix
implementation 'com.aliyun.ams:alicloud-android-hotfix:3.3.5'
implementation 'com.github.feeeei:CircleSeekbar:v1.1.2'
//====================极光推送====================
implementation 'cn.jiguang.sdk:jpush:4.6.4'
implementation 'cn.jiguang.sdk:jcore:3.2.4'
implementation 'cn.jiguang.sdk.plugin:oppo:4.6.4'
implementation 'cn.jiguang.sdk.plugin:vivo:4.6.4'
implementation 'cn.jiguang.sdk.plugin:meizu:4.6.4'
implementation 'cn.jiguang.sdk.plugin:huawei:4.6.4'
implementation 'cn.jiguang.sdk.plugin:meizu:4.6.4'
implementation 'cn.jiguang.sdk.plugin:xiaomi:4.6.4'
implementation 'com.huawei.hms:push:5.3.0.304'
//====================云信基础库====================
implementation 'com.ydl:nim-base:1.1.0.7'
implementation 'com.netease.nimlib:basesdk:9.1.1'
implementation 'com.netease.nimlib:avchat:9.1.1'
implementation 'com.netease.nimlib:nrtc:9.1.1'
//OPPO推送需要单独引入
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'commons-codec:commons-codec:1.6'
implementation 'androidx.annotation:annotation:1.1.0'
//====================YDL 功能库====================
implementation "com.ydl.aar:resource:0.0.1-ydl"
}
\ 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 package="com.cxzapp.yidianling">
</manifest>
\ No newline at end of file
......@@ -75,4 +75,5 @@ dependencies {
api project(':ydl-webview')
implementation project(":api:user")
implementation project(":api:im")
implementation project(":api:audioim")
}
......@@ -32,6 +32,7 @@ import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.PayLoad
import com.ydl.audioim.listener.IntentConstants
import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.router.AudioImIn
......
......@@ -398,7 +398,7 @@ class YDLavManager {
@SuppressLint("CheckResult")
fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit) {
if (TextUtils.isEmpty(userId) || userId ?: "0" <= "0") {
if (TextUtils.isEmpty(userId) || (userId ?: "0") <= "0") {
//如果uid为空或小于等于0 ,则不进行登录,因为uid为0也会登录成功,会导致后面uid正确时无法登录
LogUtil.e("[agora]login-uid:$userId")
AliYunRichLogsHelper.getInstance()
......
package com.ydl.audioim.modular
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.api.IAudioImService
import com.ydl.audioim.widget.AxbConfirmDialog
/**
* Created by Ykai on 2022/7/26.
*/
@Route(path = "/audioim/AudioImService")
class AudioImServiceImp : IAudioImService {
override fun yDLAvManagerInit(context: Context, appId: String) {
YDLavManager.instances.init(context, appId)
}
override fun getIsOnlineRtm(): Boolean {
return YDLavManager.isOnlineRtm
}
override fun loginRtm(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit) {
YDLavManager.instances.login(userId, event)
}
override fun loginRtm(userId: String?) {
YDLavManager.instances.login(userId)
}
override fun openAxbDialog(activity: Activity?, type: Int, phoneNumber: String?) {
val dialog = AxbConfirmDialog(activity, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
phoneNumber?.let {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$phoneNumber"))
activity?.startActivity(phoneIntent)
}
}
override fun onClose() {
}
})
dialog.show()
}
override fun callEventSave(status: String, res: String, session: String?, line: String) {
YDLavManager.instances.callEventSave(status, res, session, line)
}
override fun init(context: Context?) {
}
}
\ No newline at end of file
# 声网module
\ No newline at end of file
......@@ -71,10 +71,10 @@ dependencies {
api rootProject.ext.dependencies["ydl-user-router"]
api project(':ydl-media')
api project(':ydl-platform')
api project(':m-audioim')
api project(":ydl-pay")
api project(':ydl-webview')
api project(':ydl-utils')
implementation project(":api:audioim")
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:consultant")
......
......@@ -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
......
......@@ -24,7 +24,7 @@ import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController
import com.jcodecraeer.xrecyclerview.ProgressStyle
import com.jcodecraeer.xrecyclerview.XRecyclerView
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.api.IAudioImService
import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.home.adapter.ConfideHomeAdapter
......@@ -248,10 +248,8 @@ class ConfideHomeActivity :
}
if (!confidedId.isNullOrBlank() && !doctorId.isNullOrBlank()) {
if (!YDLavManager.isOnlineRtm) {
YDLavManager.instances.login(
PhoneCallIn.getUserService().getUserInfo()?.uid
) { _: Boolean, _ ->
if (!findRouteService(IAudioImService::class.java).getIsOnlineRtm()) {
findRouteService(IAudioImService::class.java).loginRtm(PhoneCallIn.getUserService().getUserInfo()?.uid) { _: Boolean, _ ->
showPayOrDetail(confidedId, doctorId)
}
} else {
......
......@@ -4,14 +4,12 @@ import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.text.TextUtils
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.audioim.api.IAudioImService
import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.ConfideHomeActivity
......@@ -20,6 +18,7 @@ import com.ydl.confide.home.bean.ConfideConnectResponse
import com.ydl.webview.TellData
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.YDLCacheUtils
/**
......@@ -73,7 +72,7 @@ class ConfdieServiceImpl : IConfideService {
override fun ydlAvManagerLogin(uid: String?) {
YDLavManager.instances.login(uid)
findRouteService(IAudioImService::class.java).loginRtm(uid)
}
override fun startCondifeHomePage(context: Context, isSplash: Boolean) {
......@@ -91,17 +90,17 @@ class ConfdieServiceImpl : IConfideService {
//debug包根据url判断使用正式或者测试key
val cacheAppEnv = YDLCacheUtils.getCacheApi()
if (!TextUtils.isEmpty(cacheAppEnv)) {
avManagerKey = if (!TextUtils.isEmpty(cacheAppEnv)) {
if (YDLConstants.ENV_TEST == cacheAppEnv) {
avManagerKey = "13b1536698f64905a1e7e5bb978ba821"
"13b1536698f64905a1e7e5bb978ba821"
} else {
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
"3387e9b251f3491e9221a9877e8f7830"
}
} else {
if (YDLConstants.ENV_TEST == appEnv || YDLConstants.ENV_AUTO_TEST == appEnv) {
avManagerKey = "13b1536698f64905a1e7e5bb978ba821"
"13b1536698f64905a1e7e5bb978ba821"
} else {
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
"3387e9b251f3491e9221a9877e8f7830"
}
}
} else {
......@@ -109,27 +108,11 @@ class ConfdieServiceImpl : IConfideService {
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
}
YDLavManager.instances.init(app, avManagerKey)
}
override fun isOnlineRtm(): Boolean {
return YDLavManager.isOnlineRtm
findRouteService(IAudioImService::class.java).yDLAvManagerInit(app, avManagerKey)
}
override fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?) {
val dialog = AxbConfirmDialog(activity, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
phoneNumber?.let {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber!!))
activity?.startActivity(phoneIntent)
}
}
override fun onClose() {
}
})
dialog.show()
findRouteService(IAudioImService::class.java).openAxbDialog(activity, type, phoneNumber)
}
override fun closePlayer() {
......
......@@ -3,15 +3,12 @@ package com.ydl.confide.home.modular.service
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.text.TextUtils
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.audioim.IntentConstants
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.api.IAudioImService
import com.ydl.audioim.bean.ExpertInfoBean
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.audioim.listener.IntentConstants
import com.ydl.confide.home.ConfidePermissionDialog
import com.ydl.confide.home.bean.ConfideConnectResponse
import com.ydl.confide.home.bean.ConnectParamJava
......@@ -109,7 +106,7 @@ class ConfideWebServiceImpl {
data: ConfideConnectResponse?
) {
val expertInfo = data?.dialDetail?.agoraExpertInfo ?: return
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
if (!findRouteService(IAudioImService::class.java).getIsOnlineRtm()) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return
}
......@@ -128,21 +125,9 @@ class ConfideWebServiceImpl {
* axb 通话
* */
fun axb(activity: Activity, phone: String?) {
if (phone.isNullOrEmpty()) return
val dialog = AxbConfirmDialog(
activity,
1,
object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:${phone}"))
activity.startActivity(phoneIntent)
}
override fun onClose() {
}
})
dialog.show()
if (phone.isNullOrEmpty())
return
findRouteService(IAudioImService::class.java).openAxbDialog(activity,1,phone)
}
//java版axb和声网接口
......@@ -154,8 +139,8 @@ class ConfideWebServiceImpl {
tellData: TellData?,
callType: String?
) {
if (!YDLavManager.isOnlineRtm) {
YDLavManager.instances.login(PhoneCallIn.getUserService().getUserInfo()?.uid) { isSuccess: Boolean, _ ->
if (!findRouteService(IAudioImService::class.java).getIsOnlineRtm()) {
findRouteService(IAudioImService::class.java).loginRtm(PhoneCallIn.getUserService().getUserInfo()?.uid) { isSuccess: Boolean, _ ->
if (isSuccess) {
toDial(id, type, callType, activity, tellData)
} else {
......@@ -340,7 +325,7 @@ class ConfideWebServiceImpl {
expertInfo.remainingTime =
ExpertInfoBean.ListenRemainingTime(expertInfo.totalDuration);
}
YDLavManager.instances.callEventSave("10", "用户点击拨打", expertInfo.channelId, "7")
findRouteService(IAudioImService::class.java).callEventSave("10", "用户点击拨打", expertInfo.channelId, "7")
Loading.close()
ARouter.getInstance().build("/av/AudioHomeActivity")
.withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl)
......
......@@ -398,12 +398,14 @@ class ConfideHomeUtils {
}
}
} else {
for (bodyItem in item.body!!) {
if (item.body != null) {
for (bodyItem in item.body) {
bodyItem.confideIsPlay = false
}
}
}
}
}
/**
* 更新播放状态
......
......@@ -16,7 +16,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.dou361.ijkplayer.widget.IjkVideoView
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.api.IAudioImService
import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.databinding.ItemExpertIntroBinding
......@@ -36,7 +36,6 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.confide_home_activity.*
import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.io.UnsupportedEncodingException
import java.net.URLDecoder
......@@ -123,8 +122,8 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
}
else -> {
if (!item.confideId.isNullOrBlank()) {
if (!YDLavManager.isOnlineRtm) {
YDLavManager.instances.login(
if (!findRouteService(IAudioImService::class.java).getIsOnlineRtm()) {
findRouteService(IAudioImService::class.java).loginRtm(
PhoneCallIn.getUserService().getUserInfo()?.uid
) { _: Boolean, _ ->
showPayOrDetail(item, it)
......
......@@ -4,25 +4,30 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.fragment.app.Fragment
import android.graphics.Rect
import android.text.TextUtils
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.ScreenUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.ydl.webview.H5JsBean
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.consultant.OnBottomWordListener
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.GuideBean
import com.yidianling.consultant.bean.Keyworks
import com.yidianling.consultant.data.ConsultantDataManager
import com.yidianling.consultant.OnBottomWordListener
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils
import com.yidianling.consultant.preview.GPreviewBuilder
import com.yidianling.consultant.preview.UserViewInfo
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
......@@ -149,6 +154,32 @@ class ConsultantServiceImp : IConsultantService {
})
}
override fun resourceToPreview(dataList: List<H5JsBean.MediaInfo>?, params: H5JsBean.H5JsCmd.Params, activity: Activity) {
val mThumbViewInfoList: MutableList<UserViewInfo> = ArrayList()
dataList?.let {
for (mediaInfo in it) {
val userViewInfo =
UserViewInfo(mediaInfo.cover, mediaInfo.url, mediaInfo.sourcesType)
val bounds = Rect()
bounds.left = ScreenUtils.getScreenWidth() / 2
bounds.top = ScreenUtils.getScreenHeight() / 2
bounds.right = ScreenUtils.getScreenWidth() / 2
bounds.bottom = ScreenUtils.getScreenHeight() / 2
userViewInfo.bounds = bounds
mThumbViewInfoList.add(userViewInfo)
}
GPreviewBuilder.form(activity)
.setData(mThumbViewInfoList)
.setCurrentIndex(params.preview_index)
.setFullscreen(true)
.setToUid(params.info?.toUid.toString() + "")
.setDoctorId(params.info?.doctorId)
.setType(GPreviewBuilder.IndicatorType.Dot)
.start()
}
}
override fun resetConsultAssistantDialogStatus() {
ConsultAssistantDialogUtils.INSTANCE.resetStatus()
}
......
......@@ -150,7 +150,6 @@ class TrendsListFragment : BaseLazyFragment(), ITrendsListView,
var id: String? = "0"
trendsDatas?.let { trendsDatas ->
if (trendsDatas.size > 0) {
LogUtil.i("TAG get last content: " + trendsDatas[trendsDatas.size].toString())
id = trendsDatas[trendsDatas.size - 1].id
return if (id == null || id == "") {
0
......
......@@ -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 {
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:muse')
implementation project(':api:js')
implementation project(':api:audioim')
}
\ 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.component.service.web
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.audioim.YDLavManager
import com.ydl.audioim.api.IAudioImService
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.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.ui.Loading
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 com.yidianling.user.UserHelper
import de.greenrobot.event.EventBus
class JsMethod(private val webView: WebView?) {
fun handle(param: String): Boolean {
try {
val obj = JsonParser().parse(param).asJsonObject
......@@ -50,6 +51,7 @@ class JsMethod(private val webView: WebView?) {
}
"close_loading" -> {
// Loading.close()
return true
}
"open_app_eval_list" -> {
......@@ -83,18 +85,19 @@ class JsMethod(private val webView: WebView?) {
}
return true
}
"confide_dial" -> {
//倾诉链接 java接口,支持axb和声网
val id = param.getAsJsonPrimitive("id").asInt
val data = param.getAsJsonObject("data").toString()
val topActivity = BaseActivityMgr.INST.topActivity
if (!YDLavManager.isOnlineRtm) {
if (!findRouteService(IAudioImService::class.java).getIsOnlineRtm()) {
//异常退出或者账号被顶掉,重新登录并拨打
YDLavManager.instances.login(UserHelper.getUserInfo()?.uid) { isSuccess: Boolean, _ ->
findRouteService(IAudioImService::class.java).loginRtm(JsModularService.getIUserService().getUserInfo()?.uid) { isSuccess: Boolean, _ ->
if (isSuccess) {
findRouteService(IConfideService::class.java).confideDial(id, data, topActivity)
findRouteService(IConfideService::class.java).confideDial(id,
data,
topActivity)
} else {
ToastUtil.toastShort("请重新拨打")
}
......@@ -120,6 +123,32 @@ class JsMethod(private val webView: WebView?) {
}
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
}
......
package com.ydl.js
import com.ydl.confide.api.IConfideService
import com.ydl.course.api.ICourseService
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 getIMuseService(): IMuseService {
return ModularServiceManager.provide(IMuseService::class.java)
}
}
}
\ No newline at end of file
package com.ydl.component.service.web
package com.ydl.js
import android.webkit.JavascriptInterface
import androidx.fragment.app.FragmentActivity
......@@ -12,18 +12,20 @@ import com.ydl.webview.IJavascriptHandler
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.user.UserHelper
import com.yidianling.user.api.service.IUserService
/**
* update by harvie on 2017/7/04
*/
class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPro: WebViewClientClickListener?) : IJavascriptHandler() {
class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnventPro: NewH5_WebViewClientClickListener?) : IJavascriptHandler() {
private val js = JsMethod(webView)
......@@ -33,9 +35,8 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
@JavascriptInterface
fun sendDataToOC(params: String) {
LogUtil.i("js", params)
LogUtil.d("sendDataToOC")
LogUtil.e("js", params)
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.WEB, "params:$params")
//js交互路由 后期会去除掉这个路由 统一使用下面的路由
//该路由只有测试记录h5页面在使用 - 测试题支付/测试题详情/测试题结果
val webViewRouter = WebViewRouterManager()
......@@ -47,7 +48,6 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
if (YDLRouterManager.router(params)) {
return
}
if (js.handle(params)) return
val jsData = Gson().fromJson(params, H5JsBean::class.java)
//是否登录
......@@ -60,10 +60,13 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
if (jsData.cmd?.params?.toUid != 0) {
wvEnventPro?.chat(
UserHelper.getUserInfo()?.uid?.toInt()
?: 0, jsData.cmd?.params?.toUid
?: 0, 0, UserHelper.getUserInfo()?.accessToken, jsData.cmd?.params?.isFromQingShu
?: 0)
findRouteService(IUserService::class.java).getUserInfo()?.uid?.toInt() ?: 0,
jsData.cmd?.params?.toUid ?: 0,
0,
findRouteService(IUserService::class.java).getUserInfo()?.accessToken,
jsData.cmd?.params?.isFromQingShu ?: 0,
jsData.cmd?.params?.closeReplaceChat ?: false
)
} else {
wvEnventPro?.openH5(jsData.cmd?.params)
}
......@@ -123,12 +126,22 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
"chat" ->
//私聊
if (wvEnventPro != null) {
wvEnventPro!!.chat(ModularServiceManager.getPlatformUserService()?.getUser()?.userId?.toInt()?:0, jsData.cmd!!.params!!.toUid, 0, ModularServiceManager.getPlatformUserService()?.getUser()?.token, jsData.cmd!!.params!!.isFromQingShu)
wvEnventPro?.chat(findRouteService(IUserService::class.java).getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid, 0,
JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu,
jsData.cmd!!.params!!.closeReplaceChat
)
// 埋点
ActionCountUtils.count("ydl_user_main_page|private_chat_click")
}
"chat_send_message" ->
//跳转私聊:并发送消息
if (wvEnventPro != null) {
wvEnventPro!!.chatSendMessage(ModularServiceManager.getPlatformUserService()?.getUser()?.userId?.toInt()?:0, jsData.cmd!!.params!!.toUid, 0, ModularServiceManager.getPlatformUserService()?.getUser()?.token, jsData.cmd!!.params!!.isFromQingShu)
wvEnventPro!!.chatSendMessage(findRouteService(IUserService::class.java).getUserResponse()?.uid?.toInt() ?: 0,
jsData.cmd!!.params!!.toUid,
0, JsModularService.getIUserService().getUserInfo()?.accessToken,
jsData.cmd!!.params!!.isFromQingShu)
}
"chat_team" ->
//群聊
......@@ -379,6 +392,9 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
"chatUnread" -> {
wvEnventPro?.sendUnReadNum(jsData.cmd!!.params?.callBack, jsData.cmd!!.params?.uid.toString())
}
"switch_push_status" -> {
wvEnventPro?.switchPushStatus(jsData.cmd?.params)
}
"showTitleBar" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.shouldShowTitleBar(it.isShowTitleBar!!)
......@@ -389,10 +405,23 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
wvEnventPro?.setSelfPageType(it.selfPageType)
}
}
"chat_close_bottom_webview" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.chatCloseBottomWebView()
"setBootomFitViewColor" -> {
wvEnventPro?.setBootomFitViewColor(jsData.cmd?.params?.bottomfitViewColor ?: "")
}
// 打开时间选择器
"requestSelectTime"->{
if (Utils.isFastClick()){
return
}
wvEnventPro?.openTimePicker(jsData.cmd?.params?.callBack,jsData.cmd?.params?.day,jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.orderId)
}
// 返回上一页并刷新
"goBackAndReload"->{
wvEnventPro?.goBackAndReload(jsData.cmd?.params?.url)
}
// 跳转到第三方app
"toThirdApp" ->{
wvEnventPro?.toThirdApp(jsData.cmd?.params?.url)
}
......@@ -438,7 +467,7 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
jsData.cmd?.params?.let{
val rgb = it.color
val alpha = it.alpha
wvEnventPro?.setWebViewBG(rgb,alpha)
wvEnventPro?.setBG(rgb,alpha)
}
}
......@@ -457,15 +486,10 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
findRouteService(IConfideService::class.java).showExpertDetailDialog(topActivity, url, doctorId, uid ?: "")
}
}
"switch_push_status" -> {
wvEnventPro?.switchPushStatus(jsData.cmd?.params)
}
// 打开时间选择器
"requestSelectTime"->{
if (Utils.isFastClick()){
return
"chat_close_bottom_webview" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.chatCloseBottomWebView()
}
wvEnventPro?.openTimePicker(jsData.cmd?.params?.callBack,jsData.cmd?.params?.day,jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.orderId)
}
"open_article_comment_dialog" -> {
......@@ -481,7 +505,6 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
wvEnventPro?.showDocBooking(jsData.cmd?.params)
}
}
}
}
package com.ydl.component.service.web;
package com.ydl.js;
import com.ydl.webview.H5JsBean;
......@@ -8,7 +8,7 @@ import com.ydl.webview.H5JsBean;
* Created by harvie on 2017/7/4 0004.
*/
public interface WebViewClientClickListener {
public interface NewH5_WebViewClientClickListener {
void openH5(H5JsBean.H5JsCmd.Params jsData);
......@@ -36,7 +36,8 @@ public interface WebViewClientClickListener {
void openTest(H5JsBean.H5JsCmd.Params params);
void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu);
//注册引导页--跳转私聊界面
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);
......@@ -170,49 +171,63 @@ public interface WebViewClientClickListener {
//关闭页面
void closeWebKit();
void goHome(H5JsBean.H5JsCmd.Params params);
//保存图片
// void storePic();
/**
* 向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);
//关闭私聊窗口立即咨询webview
void chatCloseBottomWebView();
void setBootomFitViewColor(String color);
/**打开时间选择器*/
void openTimePicker(String jsCallBackName, String day, String doctorId, String orderId);
default void playMeditation(int mediaId,long meditationId,int meditationType,String mediaCoverUrl){}
/**返回上一页并刷新*/
void goBackAndReload(String url);
default void switchSound(int mediaId,long meditationId,int meditationType,int businessType,
String buried,String mediaUrl,String mediaCoverUrl,String title,
String desc,int status){
/**跳转第三方APP*/
void toThirdApp(String url);
}
//页面内跳转url
/**页面内跳转url*/
void reloadUrl(String url);
default void setWebViewBG(String rgb,String alpha){}
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);
//h5页面是否需要打开推送
void switchPushStatus(H5JsBean.H5JsCmd.Params params);
/**
* 关闭私聊窗口立即咨询webview
*/
void chatCloseBottomWebView();
//显示评论弹窗
void showCommentArticleDialog(H5JsBean.H5JsCmd.Params params);
void resourceToPreview(H5JsBean.H5JsCmd.Params params);
void showDocBooking(H5JsBean.H5JsCmd.Params params);
// 打开时间选择器
void openTimePicker(String jsCallBackName,String day,String doctorId,String orderId);
}
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.audioim.api.IAudioImService
import com.ydl.webview.*
import com.ydl.ydlcommon.modular.findRouteService
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 (!findRouteService(IAudioImService::class.java).getIsOnlineRtm()) {
//异常退出或者账号被顶掉,重新登录并拨打
findRouteService(IAudioImService::class.java).loginRtm(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,4 +5,6 @@ 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'
':api:course', ':api:user', ':api:tests', ':api:im',':api:home',':api:muse',':api:js',':api:audioim'
include ':m-js'
include ':app2'
......@@ -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,6 +47,9 @@ 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')
......
......@@ -28,7 +28,7 @@ import okio.BufferedSource;
* Des: 解析框架中的网络请求和响应结果并打印
*/
public class RequestLogInterceptor implements Interceptor {
private DefaultFormatPrinter mPrinter = new DefaultFormatPrinter();
// private DefaultFormatPrinter mPrinter = new DefaultFormatPrinter();
private boolean mIsDebug;
private RequestHandler mRequestHandler;
......@@ -40,18 +40,18 @@ public class RequestLogInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//打印请求信息
if (request.body() != null && isParseable(request.body().contentType())) {
mPrinter.printJsonRequest(request, parseParams(request));
} else {
mPrinter.printFileRequest(request);
}
if (mRequestHandler != null) {
request = mRequestHandler.onHttpRequestBefore(chain, request);
}
long t1 = System.nanoTime();
//
// //打印请求信息
// if (request.body() != null && isParseable(request.body().contentType())) {
// mPrinter.printJsonRequest(request, parseParams(request));
// } else {
// mPrinter.printFileRequest(request);
// }
//
// if (mRequestHandler != null) {
// request = mRequestHandler.onHttpRequestBefore(chain, request);
// }
// long t1 = System.nanoTime();
Response originalResponse;
try {
originalResponse = chain.proceed(request);
......@@ -59,35 +59,35 @@ public class RequestLogInterceptor implements Interceptor {
NetLogUtils.debugInfo("Http Error: " + e);
throw e;
}
long t2 = System.nanoTime();
// long t2 = System.nanoTime();
ResponseBody responseBody = originalResponse.body();
// ResponseBody responseBody = originalResponse.body();
//打印响应结果
String bodyString = null;
if (responseBody != null && isParseable(responseBody.contentType())) {
bodyString = printResult(request, originalResponse);
if (mRequestHandler != null) {
mRequestHandler.onHttpResultResponse(bodyString, chain, originalResponse);
}
}
if (mIsDebug) {
final List<String> segmentList = request.url().encodedPathSegments();
final String header = originalResponse.headers().toString();
final int code = originalResponse.code();
final boolean isSuccessful = originalResponse.isSuccessful();
final String message = originalResponse.message();
final String url = originalResponse.request().url().toString();
if (responseBody != null && isParseable(responseBody.contentType())) {
mPrinter.printJsonResponse(TimeUnit.NANOSECONDS.toMillis(t2 - t1), isSuccessful,
code, header, responseBody.contentType(), bodyString, segmentList, message, url);
} else {
mPrinter.printFileResponse(TimeUnit.NANOSECONDS.toMillis(t2 - t1),
isSuccessful, code, header, segmentList, message, url);
}
}
// String bodyString = null;
// if (responseBody != null && isParseable(responseBody.contentType())) {
// bodyString = printResult(request, originalResponse);
// if (mRequestHandler != null) {
// mRequestHandler.onHttpResultResponse(bodyString, chain, originalResponse);
// }
// }
//
// if (mIsDebug) {
// final List<String> segmentList = request.url().encodedPathSegments();
// final String header = originalResponse.headers().toString();
// final int code = originalResponse.code();
// final boolean isSuccessful = originalResponse.isSuccessful();
// final String message = originalResponse.message();
// final String url = originalResponse.request().url().toString();
//
// if (responseBody != null && isParseable(responseBody.contentType())) {
// mPrinter.printJsonResponse(TimeUnit.NANOSECONDS.toMillis(t2 - t1), isSuccessful,
// code, header, responseBody.contentType(), bodyString, segmentList, message, url);
// } else {
// mPrinter.printFileResponse(TimeUnit.NANOSECONDS.toMillis(t2 - t1),
// isSuccessful, code, header, segmentList, message, url);
// }
// }
return originalResponse;
}
......
......@@ -35,8 +35,6 @@ import okio.BufferedSink
import java.io.EOFException
import java.nio.charset.Charset
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
/**
......@@ -142,8 +140,8 @@ class HttpConfig {
commonParams(),
requestHead(appName),
addEncryptionHeaderParamsInterceptor(),
responseErrorInterceptor()
// respErrorInterceptor()
responseErrorInterceptor(),
respErrorInterceptor(),
)
.setRequestHandler(getRequestHandler())
.setReadTimeout(15)
......@@ -193,22 +191,29 @@ class HttpConfig {
val code = resp.code()
val message = resp.message()
val api = req.url().encodedPath()
if (api.contains("data/bigdata/maidian/writeMaiDianData")) {
return@Interceptor resp
}
if (!resp.isSuccessful) {
Apm.reportEventWithExt("network_api", "resp_fail", api, mapOf("code" to code.toString(), "msg" to message))
Apm.reportEventWithExt("network_api_android", "resp_fail", api, mapOf("code" to code.toString(), "msg" to message))
} else {
try {
val body = resp.body() ?: return@Interceptor resp
val buffer = body.source().buffer()
val source = body.source()
source.request(Long.MAX_VALUE)
val buffer = source.buffer()
if (!isPlaintext(buffer)) return@Interceptor resp
val readString = buffer.clone().readString(Charset.forName("UTF-8"))
val fromJson = Gson().fromJson<BaseAPIResponse<Any>>(readString, BaseAPIResponse::class.java)
if (fromJson == null) {
return@Interceptor resp
}
if (fromJson.code != "200" && fromJson.code != "0") {
Apm.reportEventWithExt("network_api", "business_fail", api, mapOf("code" to code.toString(), "msg" to message))
Apm.reportEventWithExt("network_api_android", "business_fail", api, mapOf("code" to code.toString(), "msg" to message))
}
} catch (throwable: Throwable) {
LogUtil.e(throwable.message)
Apm.reportEventWithExt("network_api_android", "throwable", api, mapOf("msg" to (throwable.message ?: "")))
}
}
return@Interceptor resp
}
......
......@@ -76,10 +76,16 @@ object ModularServiceManager {
private val routerMap: HashMap<String, IProvider> = HashMap()
@Deprecated("使用findRouteService代替",
ReplaceWith("findRouteService(IPlatformUserModuleService::class.java)", "import com.ydl.ydlcommon.modular.findRouteService")
)
fun getPlatformUserService(): IPlatformUserModuleService? {
return provide(IPlatformUserModuleService::class.java)
}
@Deprecated("使用findRouteService代替",
ReplaceWith("findRouteService(clz)", "import com.ydl.ydlcommon.modular.findRouteService")
)
fun <T : IProvider> provide(clz: Class<T>, path: String): T {
var provider: IProvider? = null
......@@ -106,6 +112,9 @@ object ModularServiceManager {
return provider as T
}
@Deprecated("使用findRouteService代替",
ReplaceWith("findRouteService(clz)", "import com.ydl.ydlcommon.modular.findRouteService")
)
fun <T : IProvider> provide(clz: Class<T>): T {
var provider: IProvider? = null
......
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