Commit ef86e01f by 万齐军

Merge branch 'd/v_confide_optimized' into 'release'

D/v confide optimized

See merge request app_android_lib/YDL-Component!203
parents 894ab661 316ef646
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.3'
version = '1.0.4'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
......@@ -20,6 +20,9 @@ interface IConfideService : IProvider {
fun connectionJava(id: Int, type: Int, activity: Activity, tellData: String?, callType:String?)
//直接拨打倾诉或者axb电话
fun confideDial(id: Int, data: String, activity: Activity)
fun ydlAvManagerLogin(uid: String?)
fun startCondifeHomePage(context: Context, isSplash: Boolean)
......@@ -36,4 +39,6 @@ interface IConfideService : IProvider {
)
fun isOnlineRtm():Boolean
fun requestConfidePermission(activity: FragmentActivity, call: ((Boolean) -> Unit)?)
}
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
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 package="com.ydl.consultant.api">
</manifest>
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
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 package="com.ydl.course.api">
</manifest>
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
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 package="com.ydl.dynamic.api">
</manifest>
\ No newline at end of file
package com.yidianling.dynamic.api
import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
......
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
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 package="com.ydl.fm.api">
</manifest>
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.2'
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 "com.google.code.gson:gson:2.8.5"
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 package="com.ydl.im.api">
</manifest>
\ No newline at end of file
package com.yidianling.im.api.bean;
import androidx.annotation.DrawableRes;
/**
* Created by haorui on 2020/3/6.
* Des:
*/
public class IMInitConfigBean {
@DrawableRes public int notificationIconRes;
/**
* 测试环境AppKey
*/
......
......@@ -110,6 +110,8 @@ interface IImService : IProvider {
*/
fun registerObserveCustomNotification(callback: IMRegisterObserverCustomNotificationCallBack)
fun unregisterObserveCustomNotification(callback: IMRegisterObserverCustomNotificationCallBack)
fun getMultiMessageFragment(): Fragment
......@@ -178,8 +180,6 @@ interface IImService : IProvider {
toUid: Int
)
fun initIm(app: Application, activity: Class<out Activity>)
fun initIm(app: Application, activity: Class<out Activity>, imInitBean: IMInitConfigBean)
fun isWifiOr3G(activity: Activity): Boolean
......
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
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 package="com.ydl.tests.api">
</manifest>
\ No newline at end of file
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
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 package="com.ydl.user.api">
</manifest>
\ No newline at end of file
......@@ -182,6 +182,7 @@ dependencies {
implementation(rootProject.ext.dependencies["appcompat-v7"])
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
implementation "com.ydl.aar:resource:0.0.1-ydl"
// kapt rootProject.ext.dependencies["dagger2-compiler"]
implementation(rootProject.ext.dependencies["design"])
......@@ -192,12 +193,14 @@ dependencies {
implementation fileTree(dir: 'aars', include: ['*.aar'])
implementation project(':m-user')
implementation modularPublication('com.ydl:m-user-api')
implementation(project(':m-user')){
exclude group: "com.ydl.aar", module: 'resource'
}
implementation project(":api:user")
implementation project(':m-confide')
implementation project(':api:confide')
api project(':m-consultant')
implementation modularPublication('com.ydl:m-consultant-api')
implementation project(":api:consultant")
api project(':m-tests')
api project(':m-home')
api project(':m-confide')
......@@ -209,14 +212,13 @@ dependencies {
implementation project(':ydl-media')
implementation project(':m-muse')
implementation project(':m-im')
implementation modularPublication('com.ydl:m-im-api')
implementation project(":api:im")
implementation project(':m-dynamic')
implementation project(':m-course')
implementation project(':m-article')
implementation project(':m-audioim')
implementation modularPublication('com.ydl:m-audioim-api')
implementation project(':m-fm')
implementation modularPublication('com.ydl:m-fm-api')
implementation project(":api:fm")
implementation project(':ydl-tuicore')
......
......@@ -12,6 +12,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<application
android:name=".base.ComponentTestApp"
......
......@@ -7,10 +7,9 @@ import android.content.Intent
import android.os.Build
import android.os.Looper
import android.os.Process
import androidx.annotation.RequiresApi
import android.util.Log
import androidx.annotation.RequiresApi
import com.channel.ydl_flutter_base.plugin.YDLCommonPlugin
import com.facebook.stetho.Stetho
import com.meituan.android.walle.WalleChannelReader
import com.tencent.bugly.crashreport.CrashReport
import com.tencent.smtt.sdk.QbSdk
......@@ -20,6 +19,7 @@ import com.umeng.socialize.PlatformConfig
import com.umeng.socialize.UMShareAPI
import com.ydl.component.BuildConfig
import com.ydl.component.MainActivity
import com.ydl.component.R
import com.ydl.media.audio.PlayService
import com.ydl.ydlcommon.actions.crash.Cockroach
import com.ydl.ydlcommon.actions.crash.ExceptionHandler
......@@ -31,6 +31,7 @@ import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMInitConfigBean
import com.yidianling.im.config.NimApplication
import io.flutter.view.FlutterMain
import io.reactivex.functions.Action
......@@ -86,14 +87,15 @@ class DemoAppLifecycles : IAppLifecycles {
}
// application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
Stetho.initializeWithDefaults(application)
}
}
override fun onTerminate(application: Application) {}
private fun moduleInit(application: Application) {
NimApplication.getInstance().initIm(application, MainActivity::class.java)
val imInitConfigBean = IMInitConfigBean()
imInitConfigBean.notificationIconRes = R.drawable.im_ic_launcher
NimApplication.getInstance().initIm(application, MainActivity::class.java, imInitConfigBean)
}
......
......@@ -2,13 +2,17 @@ package com.ydl.component.service;
import android.app.Activity;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.ydl.component.service.web.WebJavascriptHandler;
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.
......@@ -24,7 +28,7 @@ public class WebServiceImpl implements IWebService {
@NotNull
@Override
public IJavascriptHandler getJavascripHandler(@NotNull Activity activity, @NotNull TellData tellData) {
return new WebJavascriptHandler(new WVClickAbstractListener(activity));
public IJavascriptHandler getJavascripHandler(@NotNull Activity activity, @Nullable WebView webView, @NotNull TellData tellData) {
return new WebJavascriptHandler(webView, new WVClickAbstractListener(activity));
}
}
package com.ydl.component.service.web
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.confide.api.IConfideService
import com.ydl.confide.home.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
import de.greenrobot.event.EventBus
class JsMethod {
class JsMethod(private val webView: WebView?) {
fun handle(param: String): Boolean {
......@@ -44,7 +52,7 @@ class JsMethod {
// Loading.close()
return true
}
"open_app_eval_list"->{
"open_app_eval_list" -> {
val url = param.getAsJsonPrimitive("url").asString
val topActivity = BaseActivityMgr.INST.getTopActivity()
NewH5Activity.start(topActivity, H5Params(url, ""))
......@@ -57,6 +65,61 @@ class JsMethod {
}
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 (!YDLavManager.isOnlineRtm) {
//异常退出或者账号被顶掉,重新登录并拨打
YDLavManager.instances.login(UserHelper.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
}
else -> {
return false
}
......
......@@ -3,6 +3,7 @@ package com.ydl.component.service.web
import android.webkit.JavascriptInterface
import androidx.fragment.app.FragmentActivity
import com.google.gson.Gson
import com.tencent.smtt.sdk.WebView
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.api.IConfideService
import com.ydl.js_module.manager.WebViewRouterManager
......@@ -21,18 +22,13 @@ import com.yidianling.user.UserHelper
* update by harvie on 2017/7/04
*/
class WebJavascriptHandler : IJavascriptHandler{
class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPro: WebViewClientClickListener?) : IJavascriptHandler() {
private val js = JsMethod()
private val js = JsMethod(webView)
override fun getUriAppendSuffix(): String {
return "platform_main_theme=00C9E2&platform_main_theme_light=00D4DF&platform_main_theme_bright=EAFAFC"
}
var wvEnventPro: WebViewClientClickListener? = null
constructor(listener: WebViewClientClickListener) : super() {
this.wvEnventPro = listener
}
@JavascriptInterface
fun sendDataToOC(params: String) {
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
......@@ -229,8 +228,9 @@
</LinearLayout>
<com.ydl.ydlcommon.mvp.lce.view.YDLStateView
android:id="@+id/lce_state_view"
android:layout_width="match_parent"
android:layout_height="30dp" />
android:id="@+id/lce_state_view"
android:layout_width="match_parent"
android:layout_height="30dp"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<color name="text_user" tools:ignore="MissingDefaultResource">#5195cb</color>
<color name="black" tools:ignore="MissingDefaultResource">#FF000000</color>
<color name="white">@android:color/white</color>
<resources>
<color name="white_24p">#3DFFFFFF</color>
<color name="white_50p">#80FFFFFF</color>
<color name="black_50p">#80000000</color>
<color name="red">#F44336</color>
<color name="red_30p">#4CF44336</color>
<color name="blue">#2196F3</color>
<color name="grey">#9E9E9E</color>
<color name="color_white">#ffffff</color>
......@@ -24,42 +18,4 @@
<color name="color_main_bg">#F1F3F8</color>
<color name="color_main_text">#333333</color>
<!-- ============ 标准颜色 ============ -->
<!--主题色 - 用于TabBar、突出文字、按钮和icon-->
<color name="platform_main_theme">#fdbd00</color>
<!--辅助色 1 - 主色系浅色-->
<color name="platform_main_theme_light">#FFEC8C</color>
<!--辅助色 2 - 主色系亮色-->
<color name="platform_main_theme_bright">#fffae0</color>
<!-- ============ 背景颜色 ============ -->
<!-- 标签背景色-->
<color name="platform_tag_bg_color">#F7F7F7</color>
<!-- 大面积背景颜色-->
<color name="platform_big_bg_color">#F0F0F0</color>
<!-- 分割线颜色-->
<color name="platform_dividing_line_color">#EBEBEB</color>
<!-- 主题色渐变背景颜色 -->
<color name="platform_main_gradient_start_color">#fdbd00</color>
<color name="platform_main_gradient_end_color">#FFD814</color>
<!-- 主题色渐变未选中背景颜色 -->
<color name="platform_main_gradient_start_color_un">#66fdbd00</color>
<color name="platform_main_gradient_end_color_un">#66FFD814</color>
<!-- ============ 文字颜色 ============ -->
<!-- 一级类目,标题、点缀文字颜色-->
<color name="platform_text_dark_color">#242424</color>
<!-- 二级类目文字颜色-->
<color name="platform_text_light_color">#666666</color>
<!-- 三级次要文字颜色-->
<color name="platform_text_bright_color">#999999</color>
<!-- 四级编辑框提示文字颜色-->
<color name="platform_text_hint_color">#BFBFBF</color>
<!-- ============ 按钮颜色 ============ -->
<!--确认文字按钮颜色 - 亮色模式下与深色模式相反-->
<color name="platform_but_text_color">#242424</color>
<!--按钮字体颜色 - 亮色模式下与深色模式近似-->
<color name="platform_but_text_color_unselected">#555555</color>
<color name="platform_but_text_color_selected">#242424</color>
</resources>
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="text_size_common">16sp</dimen>
</resources>
......@@ -33,7 +33,6 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.ydl.plugins:modular:1.0.3'
classpath 'com.ydl:notracepoint-gradle-plugin:0.0.3'
classpath 'com.ydl.plugins:restools:1.0.1'
}
}
......@@ -57,7 +56,26 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
task packYdl1 {
doLast {
println("doLast packYdl1!!!!")
}
}
task packYdl2 {
doLast {
println("doLast packYdl2!!!!")
}
}
task packYdl {
doLast {
println("doLast packYdl!!!!")
}
}
task packM{
doLast {
println("doLast packM!!!!")
}
}
subprojects {
project.configurations.all {
......
ext {
kotlin_version = "1.3.21"
dev_mode = false //组件发布的时候需要设置为false
dev_mode = false //组件发布的时候需要设置为false
ydl2PublishVersion = "0.2.0.4-SNAPSHOT"
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
......@@ -29,24 +28,12 @@ ext {
"m-audioim" : "0.0.49.30.23",
"ydl-flutter-base": "0.0.14.44",
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.3.94",
"ydl-utils" : "0.0.3.12",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
"m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.24",
"m-home-api" : "0.0.4.4",
"m-im-api" : "0.0.12.24",
"m-dynamic-api" : "0.0.3.71",
]
ydl_app = [
appName : "壹点灵心理咨询",
......@@ -84,55 +71,6 @@ ext {
canarySdkVersion : "1.5.4"
]
ydlCompileVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.50",
"m-consultant" : "0.0.60.78",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.72",
"m-home" : "0.0.24.00",
"m-im" : "0.0.21.69",
"m-dynamic" : "0.0.7.80",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.87",
"m-tests" : "0.0.24.24",
"m-course" : "0.0.43.39",
//-------------- 功能组件 --------------
//mdt 组件
"ydl-tuicore" : "0.0.25",
//第一步
"ydl-platform" : "0.0.41.54",
//第二步 若干
"ydl-webview" : "0.0.39.03",
"ydl-media" : "0.0.21.52",
"ydl-pay" : "0.0.18.21",
"m-audioim" : "0.0.49.30.23",
"ydl-flutter-base": "0.0.14.44",
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.3.94",
"ydl-utils" : "0.0.3.12",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "1.0.3",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
"m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.2",
"m-user-api" : "0.0.10.24",
"m-home-api" : "0.0.4.4",
"m-im-api" : "0.0.12.24",
"m-dynamic-api" : "0.0.3.71",
]
dependencies = [
//support
"appcompat-v7" : 'androidx.appcompat:appcompat:1.2.0',
......@@ -249,8 +187,6 @@ ext {
//删除集成调试库,其功能合并到umeng基础组件库。
//"umeng-debug" : "com.umeng.sdk:debug:1.0.0",
"tablayout" : "com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar",
"stetho" : "com.facebook.stetho:stetho:1.5.0",
"stetho-okhttp3" : "com.facebook.stetho:stetho-okhttp3:1.4.1",
"aspectjrt" : "org.aspectj:aspectjrt:1.8.9",
"bugly-crashreport" : "com.tencent.bugly:crashreport:2.8.6.0",
"bugly-nativecrashreport" : "com.tencent.bugly:nativecrashreport:3.6.0.1",
......@@ -271,36 +207,34 @@ ext {
"blankUtil" : "com.blankj:utilcode:1.25.9",
"ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
"ydl-device" : "com.ydl:device-id:0.0.30@aar",
"ydl-net" : "com.ydl:ydl-net:${ydlCompileVersion["ydl-net"]}",
"ydl-utils" : "com.ydl:ydl-utils:${ydlCompileVersion["ydl-utils"]}",
"ydl-device" : "com.ydl:device-id:0.0.31",
"ydl-net" : "com.ydl:ydl-net:${ydl2PublishVersion}",
"ydl-utils" : "com.ydl:ydl-utils:${ydl2PublishVersion}",
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydl2PublishVersion}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.51@aar", //flutter aar
// "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号
"ydl-platform" : "com.ydl:ydl-platform:${ydlCompileVersion["ydl-platform"]}@aar",
"ydl-tuicore" : "com.ydl:ydl-tuicore:${ydlCompileVersion["ydl-tuicore"]}@aar",
"ydl-platform" : "com.ydl:ydl-platform:${ydl2PublishVersion}",
"ydl-tuicore" : "com.ydl:ydl-tuicore:${ydlPublishVersion["ydl-tuicore"]}",
//功能组件 <<--- 再发这些,发完改这里的版本号
"ydl-webview" : "com.ydl:ydl-webview:${ydlCompileVersion["ydl-webview"]}@aar",
"ydl-media" : "com.ydl:ydl-media:${ydlCompileVersion["ydl-media"]}@aar",
"ydl-pay" : "com.ydl:ydl-pay:${ydlCompileVersion["ydl-pay"]}@aar",
"m-audioim" : "com.ydl:m-audioim:${ydlCompileVersion["m-audioim"]}@aar",
"ydl-webview" : "com.ydl:ydl-webview:${ydl2PublishVersion}",
"ydl-media" : "com.ydl:ydl-media:${ydl2PublishVersion}",
"ydl-pay" : "com.ydl:ydl-pay:${ydl2PublishVersion}",
"m-audioim" : "com.ydl:m-audioim:${ydl2PublishVersion}",
//业务组件 <<--- 最后发这些(只发改过的)
"ydl-m-user-api" : "com.ydl:m-user-api:${ydlCompileVersion["m-user-api"]}",
"ydl-m-muse-api" : "com.ydl:m-muse-api:${ydlCompileVersion["m-muse-api"]}",
"ydl-m-fm-api" : "com.ydl:m-fm-api:${ydlCompileVersion["m-fm-api"]}",
"ydl-m-tests-api" : "com.ydl:m-tests-api:${ydlCompileVersion["m-tests-api"]}",
"ydl-m-audioim-api" : "com.ydl:m-audioim-api:${ydlCompileVersion["m-audioim-api"]}",
"ydl-m-im-api" : "com.ydl:m-im-api:${ydlCompileVersion["m-im-api"]}",
"ydl-m-home-api" : "com.ydl:m-home-api:${ydlCompileVersion["m-home-api"]}",
"ydl-m-consultant-api" : "com.ydl:m-consultant-api:${ydlCompileVersion["m-consultant-api"]}",
"ydl-m-dynamic-api" : "com.ydl:m-dynamic-api:${ydlCompileVersion["m-dynamic-api"]}",
"ydl-m-confide-api" : "com.ydl:m-confide-api:${ydlCompileVersion["m-confide-api"]}",
"ydl-m-course-api" : "com.ydl:m-course-api:${ydlCompileVersion["m-course-api"]}",
"ydl-m-user-api" : "com.ydl:m-user-api:1.0.0",
"ydl-m-fm-api" : "com.ydl:m-fm-api:1.0.0",
"ydl-m-tests-api" : "com.ydl:m-tests-api:1.0.0",
"ydl-m-im-api" : "com.ydl:m-im-api:1.0.2",
"ydl-m-home-api" : "com.ydl:m-home-api:${ydlPublishVersion["m-home-api"]}",
"ydl-m-consultant-api" : "com.ydl:m-consultant-api:1.0.0",
"ydl-m-dynamic-api" : "com.ydl:m-dynamic-api:1.0.0",
"ydl-m-confide-api" : "com.ydl:m-confide-api:1.0.4",
"ydl-m-course-api" : "com.ydl:m-course-api:1.0.0",
]
}
......@@ -2,13 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'article_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from : '../maven_push.gradle'
kapt {
arguments {
......@@ -34,9 +28,6 @@ android {
arguments = [AROUTER_MODULE_NAME: "article"]
}
}
flavorDimensions "versionCode"//Flavor 维度信息
}
buildTypes {
......@@ -46,25 +37,6 @@ android {
}
}
//前缀的名字
// resourcePrefix "article_"
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
res.srcDirs = [
'src/main/res'
]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
......
modular {
//模块包名
packageName "com.yidianling.article"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-article-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-article-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
//壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-article-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
implementation 'de.greenrobot:eventbus:2.4.0'
}
}
}
}
\ No newline at end of file
......@@ -3,13 +3,6 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: "../maven_push.gradle"
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'audioim_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
kapt {
arguments {
......@@ -82,14 +75,12 @@ dependencies {
//开发时使用
api project(':ydl-platform')
api project(':ydl-webview')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-audioim-api')
implementation modularPublication('com.ydl:m-im-api')
implementation project(":api:user")
implementation project(":api:im")
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-webview"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-audioim-api"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
......@@ -25,6 +25,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.google.gson.Gson
import com.hjq.permissions.OnPermissionCallback
import com.hjq.permissions.XXPermissions
import com.ydl.audioim.bean.AgoraInvitationBean
import com.ydl.audioim.bean.AgoraLogInfoBean
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.command.ConnectCommand
......@@ -49,6 +50,7 @@ import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.StatusBarUtils
......@@ -58,6 +60,8 @@ import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
......@@ -227,6 +231,44 @@ class AudioHomeActivity :
private var canChangeRoute: Boolean = false
private var hasHandleRefused = false
private val notificationCallback = object : IMRegisterObserverCustomNotificationCallBack {
override fun onObserverCustomNotification(fromUid: String, toUid: String, content: String) {
if (fromUid == listenerUid) {
try {
val bean = Gson().fromJson(content, AgoraInvitationBean::class.java)
when (bean.callType) {
"2" -> {//接受
runOnUiThread {
joinChannel()
}
}
"4" -> {//拒绝
onCallRefused()
}
}
} catch (throwable: Throwable) {
LogUtil.e(throwable.message)
}
}
}
}
fun onCallRefused() {
runOnUiThread {
if (hasHandleRefused) return@runOnUiThread
hasHandleRefused = true
YDLavManager.instances.callEndStatusUpdate(channelId ?: "", 2, "被叫拒绝")
ToastUtil.toastShort("对方已挂断")
writeAgoraLog("被叫(专家)拒绝了通话邀请")
//通话结束或挂断时,上传日志文件
uploadLog()
leaveChannel()
uploadExceptionStatus("对方已拒绝", 2)
}
}
/**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
*/
......@@ -484,6 +526,7 @@ class AudioHomeActivity :
setClickEvent()
//权限申请
requestPermission()
findRouteService(IImService::class.java).registerObserveCustomNotification(notificationCallback)
ActionCountUtils.record("call_phone_page", "call_phone_page_visit", listenerUid ?: "0", "1")
}
......@@ -1545,6 +1588,7 @@ class AudioHomeActivity :
override fun onDestroy() {
super.onDestroy()
findRouteService(IImService::class.java).unregisterObserveCustomNotification(notificationCallback)
uploadLog()
phoneHandler?.removeCallbacksAndMessages(null)
if (isConnectSuccess) {
......
......@@ -30,8 +30,6 @@ import com.ydl.ydlcommon.utils.LogUtil
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.ToastUtil
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import com.yidianling.im.api.bean.IMSendCustomNotificationResultCallBack
import com.yidianling.user.api.event.UserLoginEvent
import com.yidianling.user.api.event.UserLogoutEvent
......@@ -139,15 +137,7 @@ class YDLavManager {
onConfideEvent(dimension, response?.ChannelId)
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) {
act.runOnUiThread {
callEndStatusUpdate(response?.ChannelId!!, 2, "被叫拒绝")
ToastUtil.toastShort("对方已挂断")
act.writeAgoraLog("被叫(专家)拒绝了通话邀请")
//通话结束或挂断时,上传日志文件
act.uploadLog()
act.leaveChannel()
act.uploadExceptionStatus("对方已拒绝", 2)
}
act.onCallRefused()
}
}
......@@ -316,16 +306,6 @@ class YDLavManager {
}
}
})
AudioImIn.registerObserveCustomNotification(object :
IMRegisterObserverCustomNotificationCallBack {
override fun onObserverCustomNotification(
fromUid: String,
toUid: String,
content: String
) {
}
})
}
fun rtcCall(listenerUid: String?, channelId: String?, sendDoctocrMsg: String?) {
......
......@@ -76,9 +76,9 @@ dependencies {
api project(":ydl-pay")
api project(':ydl-webview')
api project(':ydl-utils')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-consultant-api')
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:consultant")
implementation project(':api:confide')
}else {
//发布时使用
......
package com.ydl.confide
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.m_confide.test", appContext.packageName)
}
}
......@@ -37,6 +37,7 @@ import com.ydl.webview.ProgressWebView
import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.ScreenUtil
import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
......@@ -291,7 +292,10 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
val layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL }
).apply {
gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
bottomMargin = ScreenUtil.getNavBarHeight(context)
}
dialog?.window?.addContentView(itemView, layoutParams)
bottomSheet =
(it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout?
......@@ -414,7 +418,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
wv_content?.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
mJtoJHandle = WebModularServiceUtils.getWebService()
.getJavascripHandler(requireActivity(), tellData = TellData())
.getJavascripHandler(requireActivity(), wv_content, tellData = TellData())
wv_content?.addJavascriptInterface(mJtoJHandle, "javascriptHandler")
// var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1"
......
package com.ydl.confide.home
import android.Manifest
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.DialogFragment
import com.blankj.utilcode.constant.PermissionConstants
import com.blankj.utilcode.util.PermissionUtils
import com.ydl.confide.R
import com.ydl.confide.databinding.DialogConfidePermissionBinding
import com.ydl.ydlcommon.view.dialog.CommonDialog
class ConfidePermissionDialog : DialogFragment() {
var callback: ((Boolean) -> Unit)? = null
private lateinit var binding: DialogConfidePermissionBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val granted = PermissionUtils.isGranted(Manifest.permission.RECORD_AUDIO)
if (granted) {
callback?.invoke(true)
dismissAllowingStateLoss()
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
binding = DataBindingUtil.inflate(inflater, R.layout.dialog_confide_permission, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
binding.ivClose.setOnClickListener {
reject()
}
binding.tvBtn.setOnClickListener {
PermissionUtils
.permission(PermissionConstants.MICROPHONE)
.callback(object : PermissionUtils.FullCallback {
override fun onGranted(permissionsGranted: MutableList<String>?) {
callback?.invoke(true)
dismissAllowingStateLoss()
}
override fun onDenied(permissionsDeniedForever: MutableList<String>?, permissionsDenied: MutableList<String>?) {
reject()
}
}).request()
}
}
private fun reject() {
dismissAllowingStateLoss()
CommonDialog(context)
.setMessage("由于您尚未同意获取麦克风权限,本次通话将使用传统电话方式拨打")
.setRightClick("确定") {
callback?.invoke(false)
}
.setCancelAble(false)
.show()
}
override fun onStart() {
super.onStart()
isCancelable = false
val width = (resources.displayMetrics.widthPixels * 0.85).toInt()
dialog?.window?.setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT)
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
}
}
\ No newline at end of file
......@@ -35,6 +35,11 @@ interface ConfideHomeApi {
@GET("auth/listen/dial")
fun connectJava(@QueryMap params: Map<String, String>): Observable<BaseAPIResponse<ConfideConnectResponse>>
//拨打前 下单支付接口
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@GET("auth/listen/submitOrderAndPay")
fun submitOrderAndPay(@QueryMap params: Map<String, String>): Observable<BaseAPIResponse<ConfideConnectResponse>>
// 1=在线 3-通话中 2-离线
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
@GET("auth/listen/dialchangestatus")
......
......@@ -70,4 +70,11 @@ class ConfideHomeHttpImpl private constructor() : IConfideHomeHttp {
YDLHttpUtils.obtainApi(ConfideHomeApi::class.java).connectJava(it)
}
}
override fun submitOrderAndPay(connectParam: ConnectParamJava): Observable<BaseAPIResponse<ConfideConnectResponse>> {
return RxUtils.mapObservable(connectParam)
.flatMap { it ->
YDLHttpUtils.obtainApi(ConfideHomeApi::class.java).submitOrderAndPay(it)
}
}
}
\ No newline at end of file
......@@ -24,6 +24,13 @@ interface IConfideHomeHttp {
*/
fun recommendList(param: ConfideRecommendParam): Observable<BaseAPIResponse<ConfideHomeDataBean>>
//倾诉链接,java接口,支持axb和声网
/**
* 倾诉链接,java接口,支持axb和声网
*/
fun connectionJava(connectParam: ConnectParamJava): Observable<BaseAPIResponse<ConfideConnectResponse>>
/**
* 拨打前 下单支付接口
* */
fun submitOrderAndPay(connectParam: ConnectParamJava): Observable<BaseAPIResponse<ConfideConnectResponse>>
}
\ No newline at end of file
......@@ -15,10 +15,11 @@ import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.confide.home.ConfidePermissionDialog
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.ui.Loading
import com.ydl.ydlcommon.utils.YDLCacheUtils
/**
......@@ -53,11 +54,24 @@ class ConfdieServiceImpl : IConfideService {
}
override fun connectionJava(id: Int, type: Int, activity: Activity, tellData: String?, callType: String?) {
Loading.show(activity)
val myTellData: TellData? = if (tellData == null ) null else Gson().fromJson(tellData, TellData::class.java)
ConfideWebServiceImpl().connectionJava(id, type, activity, myTellData, callType)
}
/**
* 直接拨打
* */
override fun confideDial(id: Int, data: String, activity: Activity) {
val gson = Gson()
val bean = gson.fromJson(data, ConfideConnectResponse::class.java)
if (bean?.dialDetail?.callConnectType == 3) {
ConfideWebServiceImpl().agora(id, activity, bean)
} else {
ConfideWebServiceImpl().axb(activity, bean?.dialDetail?.phoneNu)
}
}
override fun ydlAvManagerLogin(uid: String?) {
YDLavManager.instances.login(uid)
}
......@@ -126,4 +140,8 @@ class ConfdieServiceImpl : IConfideService {
ConfideBottomSheetDialogFragment().showBottomSheetDialog(activity, jumpUrl, doctorId, false, uid)
}
override fun requestConfidePermission(activity: FragmentActivity, call: ((Boolean) -> Unit)?) {
ConfidePermissionDialog().apply { callback = call }.show(activity.supportFragmentManager, "ConfidePermissionDialog")
}
}
\ No newline at end of file
......@@ -6,11 +6,14 @@ 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.bean.ExpertInfoBean
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.home.ConfidePermissionDialog
import com.ydl.confide.home.bean.ConfideConnectResponse
import com.ydl.confide.home.bean.ConnectParamJava
import com.ydl.confide.home.constants.FinalString
import com.ydl.confide.home.http.ConfideHomeDataManager
......@@ -18,8 +21,10 @@ import com.ydl.confide.router.PhoneCallIn
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.TellData
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.ui.Loading
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.ToastUtil
......@@ -31,6 +36,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
/**
* Created by haorui on 2019-10-10.
* Des: 对应主项目中的WebServiceImpl
......@@ -38,7 +44,7 @@ import io.reactivex.schedulers.Schedulers
class ConfideWebServiceImpl {
//倾诉支付弹窗
fun confidePayDialog(
private fun confidePayDialog(
id: Int?,
type: Int?,
activity: Activity,
......@@ -65,6 +71,80 @@ class ConfideWebServiceImpl {
.show(confidePay)
}
private fun needPay(
id: Int,
type: Int,
activity: Activity,
callType: String?,
data: ConfideConnectResponse?
) {
//支付弹窗
//参数转换
val confidePay = ConfidePayParams(
data?.payTitle ?: "倾诉服务",
data?.listenOrderPrice,
data?.coupon?.couponMoney ?: 0.00,
data?.userBaseInfoRespDto?.availableMoney ?: 0.00,
data?.payId ?: "",
"",
""
)
confidePayDialog(id, type, activity, confidePay, callType)
}
private fun needBindPhone(activity: Activity) {
CommonDialog(activity)
.setCancelAble(false)
.setMessage(FinalString.TEL_BINDPHONE)
.setLeftOnclick("忍痛放弃", null)
.setRightClick("果断绑定") {
findRouteService(IUserService::class.java).wxBindToInputhonePage(activity)
}
.show()
}
fun agora(
id: Int,
activity: Context,
data: ConfideConnectResponse?
) {
val expertInfo = data?.dialDetail?.agoraExpertInfo ?: return
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return
}
callAgora(
activity,
id,
expertInfo,
data.callId ?: "0",
data.listenOrderId ?: 0L,
data.isShowAxb,
data.dialDetail?.dialStatus.toString()
)
}
/**
* 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()
}
//java版axb和声网接口
@SuppressLint("CheckResult")
fun connectionJava(
......@@ -95,83 +175,91 @@ class ConfideWebServiceImpl {
activity: Activity,
tellData: TellData?
) {
Loading.show(activity)
ConfideHomeDataManager.getHttp()
.connectionJava(ConnectParamJava("" + id, "" + type, callType))
.submitOrderAndPay(ConnectParamJava("" + id, "" + type, callType ?: ""))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Loading.close()
if ("200" == it.code) {
if (it.data?.dialDetail?.dialStatus != null) {
if (100007 == it.data?.dialDetail?.dialStatus) {
//支付弹窗
//参数转换
var confidePay = ConfidePayParams(
it.data?.payTitle ?: "倾诉服务",
it.data?.listenOrderPrice,
it.data?.coupon?.couponMoney ?: 0.00,
it.data?.userBaseInfoRespDto?.availableMoney ?: 0.00,
it.data?.payId ?: "",
"",
""
)
confidePayDialog(id, type, activity, confidePay, callType)
} else if (100008 == it.data?.dialDetail?.dialStatus) {
CommonDialog(activity)
.setCancelAble(false)
.setMessage(FinalString.TEL_BINDPHONE)
.setLeftOnclick("忍痛放弃", null)
.setRightClick("果断绑定") { view ->
try {
ModularServiceManager.provide(IUserService::class.java)
.wxBindToInputhonePage(activity)
} catch (e: Exception) {
}
}
.show()
} else if (0 == it.data?.dialDetail?.dialStatus) {
//连接成功
if (it.data?.dialDetail?.callConnectType ?: -1 == 3) {
//声网
it.data?.dialDetail?.agoraExpertInfo ?: return@subscribe
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return@subscribe
}
callAgora(
activity,
id,
it.data!!.dialDetail!!.agoraExpertInfo!!,
it.data.callId ?: "0",
it.data.listenOrderId ?: 0L,
tellData,
it.data.isShowAxb,
it.data?.dialDetail?.dialStatus.toString()
)
when (it.data?.dialDetail?.dialStatus) {
0 -> {//连接成功
if (type == 3) {
//checkpermission
checkPermission(id, type, activity, callType)
} else {
//axb
val dialog = AxbConfirmDialog(
activity,
1,
object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
var phoneIntent = Intent(
Intent.ACTION_DIAL,
Uri.parse("tel:${it.data?.dialDetail?.phoneNu ?: 0}")
)
activity.startActivity(phoneIntent)
}
listenDial(id, type, activity, callType ?: "")
}
}
100007 -> {
needPay(id, type, activity, callType, it.data)
}
100008 -> {
needBindPhone(activity)
}
else -> {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
}
} else {
ToastHelper.show(it.msg)
}
}, {
Loading.close()
ToastHelper.show(it.message ?: "连接失败")
})
}
override fun onClose() {
/**
* 检查权限
* */
@SuppressLint("CheckResult")
private fun checkPermission(id: Int, type: Int, activity: Activity, callType: String?) {
(activity as? FragmentActivity)?.let {
ConfidePermissionDialog().apply {
callback = { granted ->
if (granted) {
listenDial(id, type, activity, callType ?: "")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "请求音频权限通过")
} else {
listenDial(id, 1, activity, callType ?: "")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "权限拒绝 转axb")
}
}
})
dialog.show()
}
}.show(it.supportFragmentManager, "ConfidePermissionDialog")
}
}
@SuppressLint("CheckResult")
fun listenDial(
id: Int,
type: Int,
activity: Activity,
callType: String
) {
ConfideHomeDataManager.getHttp()
.connectionJava(ConnectParamJava("" + id, "" + type, callType))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if ("200" == it.code) {
when (it.data?.dialDetail?.dialStatus) {
0 -> {//连接成功
if (it.data?.dialDetail?.callConnectType == 3) {
agora(id, activity, it.data)
} else {
axb(activity, it.data?.dialDetail?.phoneNu)
}
} else {
}
else -> {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.msg)
......@@ -179,6 +267,7 @@ class ConfideWebServiceImpl {
}, {
ToastHelper.show(it.message ?: "连接失败")
})
}
fun connectionJava(
......@@ -190,57 +279,40 @@ class ConfideWebServiceImpl {
): Disposable {
Loading.show(activity)
return ConfideHomeDataManager.getHttp()
.connectionJava(ConnectParamJava("" + id, "" + type, callType))
.submitOrderAndPay(ConnectParamJava("" + id, "" + type, callType ?: ""))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Loading.close()
if ("200" == it.code) {
if (it.data?.dialDetail?.dialStatus != null) {
if (100007 == it.data?.dialDetail?.dialStatus) {
//支付弹窗
when (it.data?.dialDetail?.dialStatus) {
0 -> {//连接成功
if (type == 3) {
//检查音频权限
checkPermission(id, type, activity as Activity, callType)
} else {
//axb
listenDial(id, type, activity as Activity, callType ?: "")
}
}
100007 -> {
otherwise?.invoke()
} else if (100008 == it.data?.dialDetail?.dialStatus) {
CommonDialog(activity)
.setCancelAble(false)
.setMessage(FinalString.TEL_BINDPHONE)
.setLeftOnclick("忍痛放弃", null)
.setRightClick("果断绑定") { view ->
try {
ModularServiceManager.provide(IUserService::class.java)
.wxBindToInputhonePage(activity as Activity)
} catch (e: Exception) {
}
}
.show()
} else if (0 == it.data?.dialDetail?.dialStatus && it.data?.dialDetail?.callConnectType == 3) {
it.data?.dialDetail?.agoraExpertInfo ?: return@subscribe
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return@subscribe
}
100008 -> {
if (activity is Activity) {
needBindPhone(activity)
}
callAgora(
activity,
id,
it.data!!.dialDetail!!.agoraExpertInfo!!,
it.data.callId ?: "0",
it.data.listenOrderId ?: 0L,
null,
it.data.isShowAxb,
it.data?.dialDetail?.dialStatus.toString()
)
} else {
}
else -> {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.msg)
}
}, {
ToastHelper.show(it.message ?: "连接失败")
Loading.close()
})
}
......@@ -251,7 +323,6 @@ class ConfideWebServiceImpl {
expertInfo: ExpertInfoBean,
call_id: String,
relation_id: Long,
tellData: TellData?,
isShowAXB: Boolean,
dialStatus: String
) {
......
......@@ -2,11 +2,11 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="22dp"
android:bottomLeftRadius="22dp"/>
<corners android:radius="30dp" />
<gradient
android:angle="0"
android:startColor="#DDFF7A5C"
android:endColor="#DDFF406C"/>
android:angle="180"
android:endColor="#42c1ff"
android:startColor="#ff1da1f2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="@drawable/bg_confide_permission">
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:text="温馨提示"
android:textColor="@color/white"
android:textSize="21sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="为能正常倾诉通话,请务必开启以下权限"
android:textColor="@color/white"
android:textSize="12sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvTitle" />
<ImageView
android:id="@+id/ivMicro"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="144dp"
android:src="@drawable/ic_confide_microphone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvPermission"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:text="麦克风权限"
android:textColor="#1c1f28"
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/tvPermissionDesc"
app:layout_constraintLeft_toRightOf="@+id/ivMicro"
app:layout_constraintTop_toTopOf="@+id/ivMicro" />
<TextView
android:id="@+id/tvPermissionDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:text="启用麦克风,以正常进行语音沟通"
android:textColor="#9d9ea7"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/ivMicro"
app:layout_constraintLeft_toRightOf="@+id/ivMicro"
app:layout_constraintTop_toBottomOf="@+id/tvPermission" />
<TextView
android:id="@+id/tvBtn"
android:layout_width="0dp"
android:layout_height="47dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="38dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="24dp"
android:background="@drawable/bg_confide_gradient_main_color"
android:gravity="center"
android:text="一键启用"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivMicro" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/ivClose"
android:layout_width="33dp"
android:layout_height="33dp"
android:layout_gravity="top|right"
android:padding="6dp"
android:src="@drawable/ic_confide_permission_close" />
</FrameLayout>
</layout>
\ No newline at end of file
package com.ydl.confide
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
......@@ -2,13 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'consultant_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from: "../maven_push.gradle"
kapt {
arguments {
......@@ -33,7 +27,6 @@ android {
}
}
flavorDimensions "versionCode"
}
buildTypes {
......@@ -42,23 +35,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//前缀的名字
resourcePrefix "consultant_"
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
}
}
dependencies {
......@@ -72,9 +48,10 @@ dependencies {
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-im-api')
implementation project(":api:user")
implementation project(":api:im")
implementation modularPublication('com.ydl:m-home-api')
implementation project(":api:consultant")
api project(":ydl-webview")
api project(":ydl-platform")
} else {
......@@ -82,6 +59,7 @@ dependencies {
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-home-api"]
compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
......
modular {
//模块包名
packageName "com.yidianling.consultant"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-consultant-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-consultant-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
// 壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-consultant-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation 'androidx.annotation:annotation:1.1.0'
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.yidianling.consultant;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.yidianling.consultant;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.yidianling.consultant;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
......@@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: "../maven_push.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......@@ -23,7 +24,6 @@ android {
}
}
flavorDimensions "versionCode"
}
buildTypes {
......@@ -32,26 +32,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
res.srcDirs = [
'src/main/res'
]
}
}
}
dependencies {
......@@ -66,11 +50,13 @@ dependencies {
api 'com.github.princekin-f:EasyFloat:1.3.2'
api rootProject.ext.dependencies["ydl-user-router"]
compileOnly "com.ydl.aar:resource:0.0.1-ydl"
if (rootProject.ext.dev_mode){
//开发时使用
implementation modularPublication('com.ydl:m-consultant-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation project(":api:consultant")
implementation project(":api:user")
implementation project(":api:dynamic")
implementation project(":api:course")
api project(":ydl-webview")
api project(":ydl-platform")
api project(":ydl-media")
......@@ -82,6 +68,7 @@ dependencies {
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies['ydl-m-consultant-api']
compileOnly rootProject.ext.dependencies['ydl-m-course-api']
// compileOnlyrootProject.ext.dependencies['com.ydl:m-consultant-api']
api rootProject.ext.dependencies["ydl-webview"]
api (rootProject.ext.dependencies["ydl-media"]){
......
modular {
//模块包名
packageName "com.ydl.course"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-course-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-course-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
// 壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-course-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
......@@ -2,13 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'dynamic_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from : '../maven_push.gradle'
kapt {
arguments {
......@@ -35,7 +29,6 @@ android {
}
}
flavorDimensions "versionCode"//Flavor 维度信息
vectorDrawables.useSupportLibrary = true
}
......@@ -46,16 +39,6 @@ android {
}
}
//前缀的名字
//resourcePrefix "dynamic_"
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
......@@ -94,13 +77,13 @@ dependencies {
api project(':ydl-webview')
api project(':ydl-platform')
api project(":ydl-pay")
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-tests-api')
implementation modularPublication('com.ydl:m-course-api')
implementation modularPublication('com.ydl:m-fm-api')
implementation modularPublication('com.ydl:m-consultant-api')
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:dynamic")
implementation project(":api:tests")
implementation project(":api:course")
implementation project(":api:fm")
implementation project(":api:consultant")
implementation project(':api:confide')
}else {
//发布时使用
......
modular {
//模块包名
packageName "com.yidianling.dynamic"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-dynamic-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-dynamic-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
//壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-dynamic-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
package com.yidianling.dynamic
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("com.yidianling.dynamic", appContext.packageName)
}
}
package com.yidianling.dynamic
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
......@@ -2,13 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'fm_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from : '../maven_push.gradle'
kapt {
arguments {
......@@ -26,14 +20,8 @@ android {
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
flavorDimensions "versionCode"
}
lintOptions {
abortOnError false
}
buildTypes {
......@@ -43,13 +31,6 @@ android {
}
}
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
......@@ -73,14 +54,16 @@ dependencies {
if (rootProject.ext.dev_mode){
//开发时使用
api project(":ydl-platform")
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation project(":api:user")
implementation project(":api:dynamic")
implementation project(":api:fm")
implementation project(':ydl-media')
} else {
//发布时使用
implementation rootProject.ext.dependencies["ydl-media"]
implementation rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
implementation (rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
......
modular {
//模块包名
packageName "com.yidianling.fm"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-fm-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-fm-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
// 壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-fm-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
package com.ydl.ydl_fm;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ydl.ydl_fm.test", appContext.getPackageName());
}
}
package com.ydl.ydl_fm;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
......@@ -2,13 +2,6 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'home_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
kapt {
arguments {
......@@ -77,11 +70,11 @@ dependencies {
if (rootProject.ext.dev_mode){
//开发时使用
implementation modularPublication('com.ydl:m-consultant-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-tests-api')
implementation project(":api:consultant")
implementation project(":api:user")
implementation project(":api:tests")
implementation modularPublication('com.ydl:m-home-api')
implementation modularPublication('com.ydl:m-im-api')
implementation project(":api:im")
implementation project(':api:confide')
implementation project(':ydl-webview')
implementation project(':ydl-media')
......
......@@ -2,13 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'im_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from: "../maven_push.gradle"
kapt {
arguments {
......@@ -24,22 +18,12 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: "im"]
}
}
flavorDimensions "versionCode"//Flavor 维度信息
ndk {
abiFilters "arm64-v8a"
}
}
buildTypes {
......@@ -49,19 +33,9 @@ android {
}
}
//前缀的名字
//resourcePrefix "im_"
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
res.srcDirs = [
'src/main/res',
'src/main/res_avchat',
......@@ -79,9 +53,6 @@ android {
dependencies {
api fileTree(dir: 'libs', include: ['*.aar','*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation 'com.ydl:nim-base:1.1.0.7'
......@@ -96,13 +67,13 @@ dependencies {
//开发时使用
api project(':ydl-webview')
api project(':ydl-platform')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-tests-api')
implementation modularPublication('com.ydl:m-course-api')
implementation modularPublication('com.ydl:m-fm-api')
implementation modularPublication('com.ydl:m-consultant-api')
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:dynamic")
implementation project(":api:tests")
implementation project(":api:course")
implementation project(":api:fm")
implementation project(":api:consultant")
implementation project(':api:confide')
}else {
//发布时使用
......
modular {
//模块包名
packageName "com.yidianling.im"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-im-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-im-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
//壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-im-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
......@@ -6,6 +6,8 @@ import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import androidx.annotation.DrawableRes;
import com.alibaba.fastjson.JSON;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.auth.LoginInfo;
......@@ -52,10 +54,6 @@ public class NimApplication {
return InstanceHolder.nimApplication;
}
public void initIm(Application app,Class activity) {
initIm(app,activity,null);
}
public void initIm(Application app, Class activity, IMInitConfigBean configBean) {
IMCache.setContext(app);
// 初始化云信SDK
......@@ -70,7 +68,7 @@ public class NimApplication {
// 云信sdk相关业务初始化
NIMInitManager.getInstance().init(true);
// 初始化音视频模块
initAVChatKit(activity);
initAVChatKit(activity, configBean.notificationIconRes);
//注册状态观察者
ImObserversHelper.Companion.getInstance().registerObserver(true);
// 初始化听筒模式
......@@ -134,7 +132,7 @@ public class NimApplication {
return options;
}
private void initAVChatKit(Class activity) {
private void initAVChatKit(Class activity, @DrawableRes int notificationIconRes) {
AVChatOptions avChatOptions = new AVChatOptions() {
@Override
public void logout(Context context) {
......@@ -142,7 +140,7 @@ public class NimApplication {
}
};
avChatOptions.entranceActivity = activity;
avChatOptions.notificationIconRes = R.mipmap.im_ic_launcher;
avChatOptions.notificationIconRes = notificationIconRes;
AVChatKit.init(avChatOptions);
// 设置用户相关资料提供者
......
......@@ -5,6 +5,8 @@ import android.graphics.Color;
import android.os.Environment;
import android.text.TextUtils;
import androidx.annotation.DrawableRes;
import com.netease.nimlib.sdk.SDKOptions;
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
import com.netease.nimlib.sdk.mixpush.MixPushConfig;
......@@ -41,7 +43,7 @@ class NimSDKOptionConfig {
options.appKey = getIMAppKey(configBean);
// 如果将新消息通知提醒托管给SDK完成,需要添加以下配置。
initStatusBarNotificationConfig(context, options, activity);
initStatusBarNotificationConfig(context, options, activity, configBean.notificationIconRes);
// 配置 APP 保存图片/语音/文件/log等数据的目录
options.sdkStorageRootPath = getAppCacheDir(context) + "/yidianling"; // 可以不设置,那么将采用默认路径
......@@ -108,9 +110,9 @@ class NimSDKOptionConfig {
return storageRootPath;
}
private static void initStatusBarNotificationConfig(Context context, SDKOptions options, Class activity) {
private static void initStatusBarNotificationConfig(Context context, SDKOptions options, Class activity,@DrawableRes int notificationIconRes) {
// load 应用的状态栏配置
StatusBarNotificationConfig config = loadStatusBarNotificationConfig(context, activity);
StatusBarNotificationConfig config = loadStatusBarNotificationConfig(context, activity, notificationIconRes);
// load 用户的 StatusBarNotificationConfig 设置项
StatusBarNotificationConfig userConfig = UserPreferences.getStatusConfig();
......@@ -131,11 +133,11 @@ class NimSDKOptionConfig {
}
// 这里开发者可以自定义该应用初始的 StatusBarNotificationConfig
private static StatusBarNotificationConfig loadStatusBarNotificationConfig(Context context, Class activity) {
private static StatusBarNotificationConfig loadStatusBarNotificationConfig(Context context, Class activity, @DrawableRes int notificationIconRes) {
StatusBarNotificationConfig config = new StatusBarNotificationConfig();
// 点击通知需要跳转到的界面
config.notificationEntrance = activity;
config.notificationSmallIconId = R.mipmap.im_ic_launcher;
config.notificationSmallIconId = notificationIconRes;
config.notificationColor = IMCache.getContext().getResources().getColor(R.color.platform_color_blue_3a9efb);
// 通知铃声的uri字符串
// config.notificationSound = "android.resource://com.yidianling.im/raw/msg";
......
......@@ -41,10 +41,7 @@ import java.util.concurrent.Executors
* Des:
*/
class ImObserversHelper {
var imCustomNotificationCallBack: IMRegisterObserverCustomNotificationCallBack? = null
set(value) {
field = value
}
internal val imCustomNotificationCallBack: MutableList<IMRegisterObserverCustomNotificationCallBack> = arrayListOf()
companion object {
fun getInstance(): ImObserversHelper {
......@@ -172,9 +169,9 @@ class ImObserversHelper {
false
}
private var receiveSystemMessageObserver: Observer<CustomNotification> = Observer<CustomNotification> {
LogUtil.e(it.content)
imCustomNotificationCallBack?.onObserverCustomNotification(it.fromAccount, it.sessionId, it.content)
private var receiveSystemMessageObserver: Observer<CustomNotification> = Observer<CustomNotification> { notification ->
LogUtil.e(notification.content)
imCustomNotificationCallBack.forEach { it.onObserverCustomNotification(notification.fromAccount, notification.sessionId, notification.content) }
}
private var msgRevokeFilter = MsgRevokeFilter { message ->
......
......@@ -39,7 +39,6 @@ import com.yidianling.im.session.SessionHelper
import com.yidianling.im.session.extension.CustomAttachModifyTime
import com.yidianling.im.session.extension.CustomAttachSubScriptTime
import com.yidianling.im.session.extension.CustomAttachmentTest
import com.yidianling.im.ui.activity.CmsExamQuestionPaperActivity
import com.yidianling.im.ui.page.NewMultiMessageFragment
import com.yidianling.nimbase.common.media.picker.PickImageHelper
import com.yidianling.uikit.api.NimUIKit
......@@ -257,7 +256,11 @@ class IMServiceImpl : IImService {
}
override fun registerObserveCustomNotification(callback: IMRegisterObserverCustomNotificationCallBack) {
ImObserversHelper.getInstance().imCustomNotificationCallBack=callback
ImObserversHelper.getInstance().imCustomNotificationCallBack.add(callback)
}
override fun unregisterObserveCustomNotification(callback: IMRegisterObserverCustomNotificationCallBack) {
ImObserversHelper.getInstance().imCustomNotificationCallBack.remove(callback)
}
override fun getMultiMessageFragment(): Fragment {
......@@ -397,16 +400,12 @@ class IMServiceImpl : IImService {
}
override fun initIm(app: Application, activity: Class<out Activity>) {
NimApplication.getInstance().initIm(app, activity)
}
override fun initIm(
app: Application,
activity: Class<out Activity>,
imInitBean: IMInitConfigBean
) {
NimApplication.getInstance().initIm(app, activity,imInitBean)
NimApplication.getInstance().initIm(app, activity, imInitBean)
}
override fun isWifiOr3G(activity: Activity): Boolean {
......
......@@ -16,15 +16,15 @@ import com.netease.nimlib.sdk.msg.MsgServiceObserve;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.CustomNotification;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.ydlcommon.modular.ModularServiceManagerKt;
import com.ydl.ydlcommon.utils.log.AliYunLogConfig;
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack;
import com.yidianling.im.api.service.IImService;
import com.yidianling.im.bean.ServiceBean;
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl;
import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.helper.ImObserversHelper;
import com.yidianling.im.session.SessionHelper;
import com.yidianling.nimbase.api.model.session.SessionCustomization;
import com.yidianling.nimbase.api.model.user.UserInfoObserver;
......@@ -54,6 +54,7 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
protected YDLMessageFragment messageFragment;
private boolean isChangeDoctor = false;
String oldName="";
private IMRegisterObserverCustomNotificationCallBack notificationCallBack;
/**
* @param context
......@@ -129,23 +130,24 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
NIMClient.getService(MsgService.class).clearUnreadCount(sessionId, SessionTypeEnum.P2P);
// 转客服通知监听
ImObserversHelper.Companion.getInstance().setImCustomNotificationCallBack(new IMRegisterObserverCustomNotificationCallBack() {
notificationCallBack = new IMRegisterObserverCustomNotificationCallBack() {
@Override
public void onObserverCustomNotification(@NotNull String fromUid, @NotNull String toUid, @NotNull String content) {
try {
ServiceBean serviceBean = new Gson().fromJson(content, ServiceBean.class);
// 切换到客服
if (serviceBean != null && serviceBean.getData() != null&&serviceBean.getBusiness()!=null && serviceBean.getBusiness().equals("change_doctor")) {
isChangeDoctor = true;
String serviceUid = String.valueOf(serviceBean.getData().getToUid());
tb.setTitle(serviceBean.getData().getName());
YDLP2PMessageActivity.startChangeDoctor(YDLP2PMessageActivity.this, serviceUid, SessionHelper.getP2pCustomization(-1), null, new P2PCustomActionHandlerImpl(serviceUid, serviceBean.getData().getName(), serviceUid));
}
}catch (Exception e){
com.ydl.ydlcommon.utils.LogUtil.e("exception:"+e.getMessage());
}
try {
ServiceBean serviceBean = new Gson().fromJson(content, ServiceBean.class);
// 切换到客服
if (serviceBean != null && serviceBean.getData() != null && serviceBean.getBusiness() != null && serviceBean.getBusiness().equals("change_doctor")) {
isChangeDoctor = true;
String serviceUid = String.valueOf(serviceBean.getData().getToUid());
tb.setTitle(serviceBean.getData().getName());
YDLP2PMessageActivity.startChangeDoctor(YDLP2PMessageActivity.this, serviceUid, SessionHelper.getP2pCustomization(-1), null, new P2PCustomActionHandlerImpl(serviceUid, serviceBean.getData().getName(), serviceUid));
}
} catch (Exception e) {
com.ydl.ydlcommon.utils.LogUtil.e("exception:" + e.getMessage());
}
}
});
};
ModularServiceManagerKt.findRouteService(IImService.class).registerObserveCustomNotification(notificationCallBack);
}
@Override
......@@ -156,6 +158,10 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
registerObservers(false);
super.onDestroy();
if (notificationCallBack != null) {
ModularServiceManagerKt.findRouteService(IImService.class).registerObserveCustomNotification(notificationCallBack);
}
AliYunRichLogsHelper.Companion.getInstance().sendRichLog(AliYunLogConfig.YUNXIN,"退出聊天页面");
}
......
......@@ -18,7 +18,6 @@ import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
class ExpertConsultWebview : RelativeLayout {
private var doctorID: String
......@@ -53,7 +52,7 @@ class ExpertConsultWebview : RelativeLayout {
jumpUrl =
HttpConfig.MH5_URL + "wb/product/chat/template?doctorId=${doctorID}&cateId=${productBean.getcatenewId()}&productId=${productBean.productDto.id}"
val jtoJHandle = WebModularServiceUtils.getWebService()
.getJavascripHandler(mContext as Activity, tellData = TellData())
.getJavascripHandler(mContext as Activity, wv_content, tellData = TellData())
val url = WebUrlParamsUtils.getSuffix(jumpUrl, jtoJHandle.getUriAppendSuffix())
wv_content.loadUrl(url)
}
......@@ -134,7 +133,7 @@ class ExpertConsultWebview : RelativeLayout {
wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
val jtoJHandle = WebModularServiceUtils.getWebService()
.getJavascripHandler(mContext as Activity, tellData = TellData())
.getJavascripHandler(mContext as Activity, wv_content, tellData = TellData())
wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler")
val url = WebUrlParamsUtils.getSuffix(jumpUrl, jtoJHandle.getUriAppendSuffix())
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
......@@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply from : '../maven_push.gradle'
kapt {
arguments {
......@@ -19,18 +20,10 @@ android {
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
flavorDimensions "versionCode"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
......@@ -39,13 +32,6 @@ android {
}
}
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
......@@ -57,9 +43,6 @@ dependencies {
api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.github.weidongjian:androidWheelView:1.0.0'
implementation 'com.github.feeeei:CircleSeekbar:v1.1.2'
......@@ -77,7 +60,7 @@ dependencies {
//开发时使用
api project(":ydl-platform")
implementation project(':ydl-media')
implementation modularPublication('com.ydl:m-user-api')
implementation project(":api:user")
implementation project(':ydl-flutter-base')
implementation project(':ydl-webview')
......
modular {
//模块包名
packageName "com.yidianling.muse"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-muse-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-muse-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
// 壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-muse-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
package com.ydl.ydl_fm;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ydl.ydl_muse.test", appContext.getPackageName());
}
}
......@@ -62,7 +62,7 @@ class ChooseMusicActivity : BaseActivity() {
super.onCreate(savedInstanceState)
getParam()
var tellData = TellData()
jtoJHandle = getWebService().getJavascripHandler(this, tellData.also { tellData = it })
jtoJHandle = getWebService().getJavascripHandler(this, null, tellData.also { tellData = it })
initView()
}
......
package com.ydl.ydl_fm;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
......@@ -2,14 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'tests_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from: "../maven_push.gradle"
kapt {
arguments {
......@@ -26,15 +19,6 @@ android {
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
flavorDimensions "versionCode"
}
lintOptions {
abortOnError false
}
buildTypes {
......@@ -43,24 +27,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//前缀的名字
resourcePrefix "tests_"
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
......@@ -70,16 +40,17 @@ dependencies {
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
compileOnly "com.ydl.aar:resource:0.0.1-ydl"
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-webview')
api project(':ydl-platform')
implementation project(':ydl-flutter-base')
implementation modularPublication('com.ydl:m-test-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-im-api')
implementation project(":api:tests")
implementation project(":api:user")
implementation project(":api:dynamic")
implementation project(":api:im")
}else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-tests-api"]
......
modular {
//模块包名
packageName "com.yidianling.tests"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-tests-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-tests-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
//壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-tests-api"
//开发时注释掉版本号,发布api时打开
//version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
package com.yidianling.tests;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.yidianling.tests.test", appContext.getPackageName());
}
}
package com.yidianling.tests;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
String[] list1 = {"17826875951", "1782687595", "178268759", "17826875", "1782687", "178268", "17826", "1782", "178", "17", "1", "17826efdg465154",
"165e2244", "111e12345", "我的123是121223423", "我的123456789", "符合规范357545655分好尴尬", "符合规范3555分好尴尬", "订单1234", "订单12345",
"我的QQ号是3386218996", "178 2687 5951", "1q1q1q11q", "123456789a"};
String[] list2 = {"178****5951", "178****595", "178****59", "17****75", "17****7", "17****", "1****", "1782", "178", "17", "1", "1****efdg46****",
"165e2244", "111e1****", "我的123是121****23", "我的123****89", "符合规范357****55分好尴尬", "符合规范3555分好尴尬", "订单1234", "订单1****",
"我的QQ号是338****996", "178 2687 5951", "1q1q1q11q", "123****89a"};
/**
* 用于测试数字替换*的功能,功能与ios一样
*/
@Test
public void set() {
for (int tt = 0; tt < list1.length; tt++) {
String text = list1[tt];
String assertString = list2[tt];
String lastText = "";
int numberIndex = -1;
int numberCount = 0;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) >= 48 && text.charAt(i) <= 57) {
numberIndex = i;
for (int j = i; j < text.length(); j++) {
if (text.charAt(j) >= 48 && text.charAt(j) <= 57) {
numberCount++;
if (j == text.length() - 1) {
if (numberCount >= 5) {
while (i < numberIndex + numberCount / 3) {
lastText += text.charAt(i++);
}
while (i < numberIndex + numberCount / 3 + 4) {
lastText += "*";
i++;
}
while (i <= j) {
lastText += text.charAt(i++);
}
} else {
while (i <= j) {
lastText += text.charAt(i++);
}
}
i = j;
break;
}
} else {
if (numberCount >= 5) {
while (i < numberIndex + numberCount / 3) {
lastText += text.charAt(i++);
}
while (i < numberIndex + numberCount / 3 + 4) {
lastText += "*";
i++;
}
while (i < j) {
lastText += text.charAt(i++);
}
} else {
while (i < j) {
lastText += text.charAt(i++);
}
}
i = j - 1;
numberIndex = -1;
numberCount = 0;
break;
}
}
} else {
lastText += text.charAt(i);
}
}
assertEquals(lastText, assertString);
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
......@@ -2,13 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'user_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from: "../maven_push.gradle"
kapt {
arguments {
......@@ -33,9 +27,6 @@ android {
arguments = [AROUTER_MODULE_NAME: "user"]
}
}
flavorDimensions "versionCode"//Flavor 维度信息
}
buildTypes {
......@@ -45,26 +36,6 @@ android {
}
}
//前缀的名字
resourcePrefix "user_"
//Flavor 信息
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
res.srcDirs = [
'src/main/res'
]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
......@@ -81,6 +52,7 @@ dependencies {
kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.ydl.aar:resource:0.0.1-ydl"
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
......@@ -88,12 +60,12 @@ dependencies {
api project(':ydl-platform')
api project(":ydl-pay")
// implementation project(":ydl-tuicore")
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-course-api')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-fm-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-consultant-api')
implementation project(":api:user")
implementation project(":api:course")
implementation project(":api:im")
implementation project(":api:fm")
implementation project(":api:dynamic")
implementation project(":api:consultant")
}else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
......
modular {
//模块包名
packageName "com.yidianling.user"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-user-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-user-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
//壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-user-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
implementation 'de.greenrobot:eventbus:2.4.0'
}
}
}
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.yidianling.user;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.yidianling.user;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.yidianling.user;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
apply plugin: 'maven'
def mavenRepositoryUrl = "http://nexus.yidianling.com/repository/AndroidReleases/"
def mavenRepositoryUrl2 = "http://nexus.yidianling.com/repository/AndroidSnapshots/"
def getVersionName() {
return hasProperty('VERSION_NAME') ? VERSION_NAME : rootProject.ext.ydlPublishVersion[project.getName()]
def publishVersion = rootProject.ext.ydl2PublishVersion
return publishVersion
}
def isLocal(){
Properties properties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
properties.load(inputStream)
def local = properties.getProperty("packageLocal")
return local
}
task sourceJar(type:Jar){
classifier = 'source'
......@@ -19,11 +28,18 @@ afterEvaluate { project ->
mavenDeployer {
pom.artifactId = project.getName().replace('_', "-")
pom.groupId = "com.ydl"
pom.version = getVersionName()
repository(url: mavenRepositoryUrl) {
authentication(userName: "admin", password: "fjoi#1+#@")
pom.version = getVersionName()
def local = isLocal()
if (local == "true") {
repository(url: mavenLocal().url)
} else if (local == "false") {
def snapshot = getVersionName().endsWith("-SNAPSHOT")
repository(url: snapshot ? mavenRepositoryUrl2 : mavenRepositoryUrl) {
authentication(userName: "admin", password: "fjoi#1+#@")
}
} else {
println("请在local.properties中指定packageLocal的值[true|false]")
}
// repository(url:mavenLocal().url)
}
}
}
......@@ -34,7 +50,23 @@ afterEvaluate { project ->
, project.getName()
, getVersionName()
, "aar"
, "release"
, "packageLocal:" + isLocal()
)
}
// rootProject.getTasksByName("aa",false).forEach{println(it)}
//pay依赖platform,platform依赖utils和net
//confide依赖audioim
if (project.name.startsWith("ydl")) {
if (project.name == "ydl-utils" || project.name == "ydl-net") {
rootProject.getTasksByName("packYdl1", false).forEach { it.dependsOn(uploadArchives) }
}
if (project.name == "ydl-platform") {
rootProject.getTasksByName("packYdl2", false).forEach { it.dependsOn(uploadArchives) }
}
rootProject.getTasksByName("packYdl", false).forEach { it.dependsOn(uploadArchives) }
} else {
if (project.name != "m-audioim") {
rootProject.getTasksByName("packM", false).forEach { it.dependsOn(uploadArchives) }
}
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@ afterEvaluate { project ->
// log
println String.format(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n>>>>> [%s] 正在将[%s]版本的[%s]包上传到Maven的[%s]仓库 >>>>>\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
, project.getName()
, getVersionName()
, project.version
, "aar"
, "release"
)
......
include ':app',
':ydl-flutter-base', ':ydl-net', ':ydl-utils', ':ydl-media',
':ydl-platform', ':ydl-webview', ':ydl-pay', ':m-home',
':ydl-platform', ':ydl-webview', ':ydl-pay', ':m-home', 'ydl-resource',
':m-home',
':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'
":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'
......@@ -39,6 +39,7 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.volcengine:apm_insight:1.4.6.cn'
api rootProject.ext.dependencies["gson"]
api rootProject.ext.dependencies["aliyun"]
......
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils;
import android.widget.Toast;
import com.bytedance.apm.agent.instrumentation.OkHttp3Instrumentation;
import com.ydl.ydlnet.builder.cookie.CookieJarImpl;
import com.ydl.ydlnet.builder.cookie.store.CookieStore;
import com.ydl.ydlnet.builder.factory.ApiFactory;
......@@ -206,7 +207,7 @@ public class OkHttpConfig {
setDebugConfig();
setProxy();
okHttpClient = okHttpClientBuilder.build();
okHttpClient = OkHttp3Instrumentation.build(okHttpClientBuilder);
return okHttpClient;
}
......
......@@ -44,7 +44,7 @@ dependencies {
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-platform')
implementation modularPublication('com.ydl:m-im-api')
implementation project(":api:im")
}else {
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
//发布时使用
......
......@@ -18,19 +18,6 @@ android {
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
flavorDimensions "versionCode"
ndk {
abiFilters "arm64-v8a"
}
vectorDrawables.useSupportLibrary = true
}
lintOptions {
abortOnError false
disable 'MissingTranslation'
}
buildTypes {
......@@ -75,6 +62,7 @@ dependencies {
//====================YDL Repository====================
// api rootProject.ext.dependencies["ydl-pushagent"]
// api rootProject.ext.dependencies["ydl-hnet"]
api "androidx.lifecycle:lifecycle-viewmodel:2.2.0"
implementation 'com.volcengine:apm_insight:1.4.6.cn'
api(rootProject.ext.dependencies["ydl-notracepoint"]) {
transitive = true
......@@ -162,8 +150,6 @@ dependencies {
api rootProject.ext.dependencies["umeng-shareboard"]
api rootProject.ext.dependencies["umeng-wx-guanfang"]
api rootProject.ext.dependencies["umeng-qq-guanfang"]
api rootProject.ext.dependencies["stetho"]
api rootProject.ext.dependencies["stetho-okhttp3"]
api rootProject.ext.dependencies["bugly-crashreport"]
api rootProject.ext.dependencies["bugly-nativecrashreport"]
api rootProject.ext.dependencies["arouter-api"]
......
......@@ -3,7 +3,6 @@ package com.ydl.ydlcommon.base.config
import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import com.facebook.stetho.okhttp3.StethoInterceptor
import com.google.gson.Gson
import com.ydl.pushserver.pushagent.YdlPushAgent
import com.ydl.ydlcommon.app.Apm
......@@ -133,9 +132,7 @@ class HttpConfig {
//获取证书
val cerInputStream = context.resources.openRawResource(com.ydl.ydlcommon.R.raw.ydl_trust);
val builder = OkHttpConfig.Builder(context)
if (appDebug) {
builder.setNetInterceptor(StethoInterceptor())
} else {
if (!appDebug) {
//使用预埋证书,校验服务端证书
builder.setSslSocketFactory(cerInputStream)
}
......@@ -145,8 +142,8 @@ class HttpConfig {
commonParams(),
requestHead(appName),
addEncryptionHeaderParamsInterceptor(),
responseErrorInterceptor(),
respErrorInterceptor()
responseErrorInterceptor()
// respErrorInterceptor()
)
.setRequestHandler(getRequestHandler())
.setReadTimeout(15)
......
......@@ -49,7 +49,6 @@ public class DeviceTool {
} else {
activity.startActivity(getAppDetailSettingIntent());
}
gotoMiuiPermission(activity);
}
/**
......@@ -57,7 +56,7 @@ public class DeviceTool {
*/
private static void gotoMiuiPermission(Activity activity) {
Intent i = new Intent("miui.intent.action.APP_PERM_EDITOR");
ComponentName componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity");
ComponentName componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity");
i.setComponent(componentName);
i.putExtra("extra_pkgname", getPackageName());
try {
......
......@@ -2,8 +2,11 @@ package com.ydl.ydlcommon.utils;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Log;
import com.ydl.ydlcommon.base.BaseApp;
import java.lang.reflect.Field;
......@@ -118,6 +121,7 @@ public class ScreenUtil {
}
public static int getNavBarHeight(Context context) {
if (hasNavBarHide(context)) return 0;
Resources resources = context.getResources();
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
......@@ -125,4 +129,23 @@ public class ScreenUtil {
}
return 0;
}
}
public static boolean hasNavBarHide(Context context){
return Settings.Global.getInt(context.getContentResolver(), getNavBarShowKey(), 0) != 0;
}
private static String getNavBarShowKey() {
String brand = Build.BRAND;
if (brand.equalsIgnoreCase("HUAWEI")) {
return "navigationbar_is_min";
} else if (brand.equalsIgnoreCase("XIAOMI")) {
return "force_fsg_nav_bar";
} else if (brand.equalsIgnoreCase("VIVO")) {
return "navigation_gesture_on";
} else if (brand.equalsIgnoreCase("OPPO")) {
return "navigation_gesture_on";
} else {
return "navigationbar_is_min";
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="platform_main_theme">#1da1f2</color>
<color name="platform_color_1DA1F2">#1DA1F2</color>
<color name="platform_new_divide_color">#f0f0f0</color>
<color name="platform_white">#ffffff</color>
......@@ -87,8 +88,6 @@
<!-- ============================ 业务组件统一主题颜色 ============================ -->
<!-- ============ 标准颜色 ============ -->
<!--主题色 - 用于TabBar、突出文字、按钮和icon-->
<color name="platform_main_theme">#1da1f2</color>
<!--辅助色 1 - 主色系浅色-->
<color name="platform_main_theme_light">#60BDF5</color>
<!--辅助色 2 - 主色系亮色-->
......@@ -101,12 +100,6 @@
<color name="platform_big_bg_color">#F0F0F0</color>
<!-- 分割线颜色-->
<color name="platform_dividing_line_color">#EBEBEB</color>
<!-- 主题色渐变背景颜色 -->
<color name="platform_main_gradient_start_color">#159CEF</color>
<color name="platform_main_gradient_end_color">#22BFFF</color>
<!-- 主题色渐变未选中背景颜色 -->
<color name="platform_main_gradient_start_color_un">#66159CEF</color>
<color name="platform_main_gradient_end_color_un">#6622BFFF</color>
<!--次级按钮背景,和背景冲突时使用,黄色基本不变-->
<color name="platform_specific_bg_color">#FFDD33</color>
......
......@@ -38,8 +38,8 @@
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:layout_marginRight">30dp</item>
<item name="android:layout_marginLeft">30dp</item>
<item name="android:layout_marginRight">0dp</item>
<item name="android:layout_marginLeft">0dp</item>
<item name="android:windowBackground">@drawable/platform_normaldialog_bg</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
......
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
flavorDimensions "versionCode"//Flavor 维度信息
}
productFlavors {
ydl {}
xlzx {}
}
// sourceSets {
// main {
// res.srcDirs = [
// 'src/main/res',
// 'src/ydl/res'
// ]
// }
// }
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
}
\ 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
<manifest package="com.ydl.resource" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 主题色渐变背景颜色 -->
<color name="platform_main_gradient_start_color">#159CEF</color>
<color name="platform_main_gradient_end_color">#22BFFF</color>
<!-- 主题色渐变未选中背景颜色 -->
<color name="platform_main_gradient_start_color_un">#66159CEF</color>
<color name="platform_main_gradient_end_color_un">#6622BFFF</color>
<!--主题色 - 用于TabBar、突出文字、按钮和icon-->
<color name="platform_main_theme">#1da1f2</color>
</resources>
\ No newline at end of file
package com.yidianling.common.tools
import android.app.Activity
import android.content.Context
import android.view.ContextThemeWrapper
import androidx.fragment.app.FragmentActivity
fun Context.asActivity(): Activity? {
if (this is Activity) {
return this
}
if (this is ContextThemeWrapper) {
return this.baseContext.asActivity()
}
return null
}
fun Context.asFragmentActivity(): FragmentActivity? {
if (this is FragmentActivity) {
return this
}
if (this is ContextThemeWrapper) {
return this.baseContext.asFragmentActivity()
}
return null
}
\ No newline at end of file
......@@ -24,11 +24,6 @@ android {
arguments = [AROUTER_MODULE_NAME: "webview"]
}
}
ndk {
abiFilters "arm64-v8a"
}
}
buildTypes {
......@@ -58,9 +53,9 @@ dependencies {
if (rootProject.ext.dev_mode) {
//开发时使用
api project(':ydl-platform')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-dynamic-api')
implementation modularPublication('com.ydl:m-im-api')
implementation project(":api:user")
implementation project(":api:dynamic")
implementation project(":api:im")
} else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
......
/*___Generated_by_IDEA___*/
package com.ydl.webview;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.webview;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.webview;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
\ No newline at end of file
......@@ -2,11 +2,12 @@ package com.ydl.webview
import android.app.Activity
import com.alibaba.android.arouter.facade.template.IProvider
import com.tencent.smtt.sdk.WebView
/**
* Created by haorui on 2019-10-10.
* Des:
*/
interface IWebService : IProvider {
fun getJavascripHandler(activity: Activity, tellData: TellData): IJavascriptHandler
fun getJavascripHandler(activity: Activity, webView: WebView?, tellData: TellData): IJavascriptHandler
}
......@@ -401,7 +401,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
setUrlHeightParams();
EventBus.getDefault().register(this);
jtoJHandle = WebModularServiceUtils.Companion.getWebService().getJavascripHandler(this, tellData = tellData);
jtoJHandle = WebModularServiceUtils.Companion.getWebService().getJavascripHandler(this, wv_content, tellData);
init();
if (startType == 1) {
......
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