Commit aa9ca9ae by fengquan

Merge remote-tracking branch 'origin/release' into feat/fq/fq_consulttant_revision_release

parents 930577b6 446506b0
......@@ -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.7"
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.50",
"m-consultant" : "0.0.60.74",
"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.67",
"m-im" : "0.0.21.69",
"m-dynamic" : "0.0.7.80",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.87",
......@@ -20,7 +19,7 @@ ext {
//mdt 组件
"ydl-tuicore" : "0.0.25",
//第一步
"ydl-platform" : "0.0.41.51",
"ydl-platform" : "0.0.41.54",
//第二步 若干
"ydl-webview" : "0.0.39.03",
......@@ -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.74",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.72",
"m-home" : "0.0.24.00",
"m-im" : "0.0.21.67",
"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.51",
//第二步 若干
"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',
......@@ -227,7 +165,6 @@ ext {
"cube" : "in.srain.cube:cube-sdk:1.0.44@aar",
"support-multidex" : 'androidx.multidex:multidex:2.0.0',
"ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.33",
"robust" : "com.meituan.robust:robust:0.4.87",
"walle" : "com.meituan.android.walle:library:1.1.5",
"jpush" : "cn.jiguang.sdk:jpush:3.3.6",
"jcore" : "cn.jiguang.sdk:jcore:2.1.4",
......@@ -250,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",
......@@ -272,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) {
......
......@@ -5,6 +5,7 @@ import android.content.Context
import android.os.Handler
import android.text.TextUtils
import com.alibaba.android.arouter.launcher.ARouter
import com.apm.insight.log.VLog
import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraInvitationBean
import com.ydl.audioim.http.AudioApiRequestUtil
......@@ -30,8 +31,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
......@@ -54,6 +53,7 @@ class YDLavManager {
companion object {
const val FILE_NAME = "consult.log"
private const val TAG = "YDLavManager"
//当前sdk的登录状态
var sdkStatus = -1
......@@ -139,15 +139,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 +308,6 @@ class YDLavManager {
}
}
})
AudioImIn.registerObserveCustomNotification(object :
IMRegisterObserverCustomNotificationCallBack {
override fun onObserverCustomNotification(
fromUid: String,
toUid: String,
content: String
) {
}
})
}
fun rtcCall(listenerUid: String?, channelId: String?, sendDoctocrMsg: String?) {
......@@ -449,7 +431,9 @@ class YDLavManager {
}
override fun onFailure(msg: String?) {
Apm.reportCustom("agora_login_error", msg ?: "", Exception(msg))
if (msg != "LOGIN_ERR_ALREADY_LOGGED_IN") {
Apm.reportCustom("agora_login_error", msg ?: "", Exception(msg))
}
LogUtil.e("[agora]实时消息登录失败:$msg")
writeAgoraLog(
"声网rtm登录失败:$msg-------Time:${
......@@ -667,7 +651,7 @@ class YDLavManager {
* */
override fun onConnectionStateChanged(state: Int, reason: Int) {
val msg = "state:${state},reason:${reason}"
Apm.reportCustom("agora_connectionstate_error", msg, Exception(msg))
VLog.i(TAG, msg)
sdkStatus = state
writeAgoraLog(
"声网rtm登录状态:${state}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
......@@ -682,10 +666,8 @@ class YDLavManager {
* 如果正在通话中,则不进行退出操作
* */
if (reason == CONNECTION_CHANGE_REASON_REMOTE_LOGIN) {
if (!activityIsExists(ConsultantAudioHomeActivity::class.java) && !activityIsExists(
AudioHomeActivity::class.java
)
) {
if (!activityIsExists(ConsultantAudioHomeActivity::class.java) &&
!activityIsExists(AudioHomeActivity::class.java)) {
isOnlineRtm = false
logout()
} else {
......
......@@ -15,6 +15,6 @@ public class NoticePushCommand extends BaseCommand {
public AudioMessageBean data;//AudioMessageBean的字符串
public String pushId;//专家uid
public String status;//CALL 呼叫 CALL_OFF 取消呼叫
public String title = "您有一条倾诉消息";
public String title = "用户正向您发起呼叫,请接听……";
public String sound = "专家响铃3.mp3";//用于ios设备接到通知响铃
}
......@@ -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 {
......@@ -73,9 +49,10 @@ dependencies {
implementation "com.ydl:jjdxm-ijkplayer:0.0.33"
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 {
......@@ -83,6 +60,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
......@@ -114,10 +114,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private const val FILTER_STATUS_NORMAL = 0 //默认筛选状态
private const val FILTER_STATUS_FILTERED = 1 //非默认筛选状态
private const val FILTER_STATUS_OPEN = 2 //筛选窗打开状态
const val FROM_HOME_SREARCH = 0
const val FROM_FIND_EXPERT = 1
const val FROM_ONLINE_EXPERT = 2
const val PAGE_SIZE = 15
fun newIntent(
activity: Activity,
......@@ -406,6 +403,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
getPresenter().fetchListHead()
recommendListView.requestData(initCategory)
if (isRefresh) {
refresh(false)
}
......@@ -451,7 +449,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
//筛选数据获取后回调
//获取筛选数据
override fun onHeadFetched(headData: HeadData?) {
//头部数据获取到后初始化筛选数据
this.headData = headData
......@@ -1061,8 +1059,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
viewDim.visibility = View.INVISIBLE
viewDim_filter.visibility = View.GONE
if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.doctorEdu.size + allFilter.title.size > 0 || !TextUtils.isEmpty(
allFilter.priceRanges?.minPrice
) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)
allFilter.priceRanges?.min_price
) || !TextUtils.isEmpty(allFilter.priceRanges?.max_price)
) {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED)
} else {
......@@ -1471,7 +1469,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onRefresh() {
refresh(false)
recommendListView.requestData()
recommendListView.requestData(initCategory)
}
//刷新列表
......
......@@ -346,6 +346,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
allFilter.showType.key = initShowType
getPresenter().fetchListHead()
recommendListView.requestData("")
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
......@@ -940,8 +941,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
viewDim.visibility = View.INVISIBLE
viewDim_filter.visibility = View.GONE
if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.doctorEdu.size + allFilter.title.size + allFilter.specialityCrowd.size > 0 || !TextUtils.isEmpty(
allFilter.priceRanges?.minPrice
) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)
allFilter.priceRanges?.min_price
) || !TextUtils.isEmpty(allFilter.priceRanges?.max_price)
) {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED)
} else {
......@@ -1344,8 +1345,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun onRefresh() {
refresh(false)
recommendListView.requestData()
recommendListView.requestData("")
}
/**
......
......@@ -87,10 +87,18 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
filterMap["tags.tag_id"] = categoriesMap
}
// 地区
if (allFilter.region.value == "海外") {
if (allFilter.region.code == "ABROAD") { // 海外
if (allFilter.region.code == allFilter.sub.code){ // 海外不限
val abroadMap = HashMap<String, Any>()
abroadMap["ne"] = "1"
filterMap["country_code"] = abroadMap
}else{
filterMap["country_code"] = allFilter.sub.code!!
}
} else if(allFilter.region.code=="1"&&allFilter.region.code==allFilter.sub.code){ // 全国不限
filterMap["country_code"] = allFilter.sub.code
} else{
if (allFilter.region.code != null&&allFilter.region.code!="1") {
}else{
if (allFilter.region.code != null) {
filterMap["province_code"] = allFilter.region.code
}
if (allFilter.sub.code != null&&allFilter.sub.code!=allFilter.region.code) {
......@@ -108,11 +116,15 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
filterMap["product_specs.spec_id"] = wayMap
}
// 服务均价
if (allFilter.priceRanges != null) {
allFilter.priceRanges?.let {
val avgPriceMap = HashMap<String, Any?>()
avgPriceMap["gte"] = allFilter.priceRanges?.minPrice
avgPriceMap["lte"] = allFilter.priceRanges?.maxPrice
filterMap["avg_price"] = avgPriceMap
if (!TextUtils.isEmpty(it.min_price)){
avgPriceMap["gte"] = it.min_price
}
if (!TextUtils.isEmpty(it.max_price)) {
avgPriceMap["lte"] = it.max_price
}
filterMap[it.key1] = avgPriceMap
}
// 年龄
if (allFilter.ages.isNotEmpty()) {
......
......@@ -25,6 +25,8 @@ class ConsultBIConstants {
const val POSITION_CONSULT_COUNSELOR_LIST_PAGE_VISIT="consult_counselor_list_page_visit" // 咨询师列表页面浏览position
const val POSITION_YDL_USER_ASSOCIATE_WORD_VISIT="ydl_user_associate_word_visit" // 联想词曝光position
const val POSITION_YDL_USER_ASSOCIATE_WORD_CLICK="ydl_user_associate_word_click" // 联想词点击position
// 咨询师列表页 banner 点击事件
const val POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK = "consult_counselor_list_banner_click"
}
//====================APP咨询列表页(app_consult_list_page)====================
......
......@@ -44,17 +44,12 @@ class ExpertSearchHttpImpl : IExpertSearchHttp {
return searchApi!!
}
// override fun searchDoctor(params: String?): Observable<BaseAPIResponse<ExpertSearchBean>> {
// return getSearchApi().searchDoctorService(HttpConfig.JAVA_BASE_URL+ "doctor/nlist?"+params)
//
// }
override fun getExpertList(map: Map<String, Any>): Observable<BaseAPIResponse<ExpertBean>> {
return getSearchApi().getExpertList(map)
}
override fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>> {
return getSearchApi().getBigShotData()
override fun getBigShotData(map:Map<String,Any>): Observable<BaseAPIResponse<ExpertSearchTopShowBean>> {
return getSearchApi().getBigShotData(map)
}
......
......@@ -37,6 +37,6 @@ interface IExpertSearchHttp{
/**
* 获取大咖专区和顶部推荐数据数据
*/
fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
fun getBigShotData(map:Map<String,Any>): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
}
\ No newline at end of file
......@@ -77,7 +77,7 @@ interface SearchApi {
//获取咨询助理uid
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@POST("doctor/querySpecialTopic")
fun getBigShotData(): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
fun getBigShotData(@Body map: Map<String,@JvmSuppressWildcards Any>): Observable<BaseAPIResponse<ExpertSearchTopShowBean>>
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
......
......@@ -10,6 +10,6 @@ data class EnquiryItem(
@field:SerializedName("key")
val key: Int,
val checkRrl: String?,
val unCheckUrl: String?
val check_url: String?,
val un_check_url: String?
)
\ No newline at end of file
......@@ -30,7 +30,7 @@ data class Filters(
/**
* 服务均价
*/
@field:SerializedName("priceRanges")
@field:SerializedName("price_ranges")
val priceRanges: List<PriceRangesItem> = ArrayList(),
/**
......@@ -49,6 +49,6 @@ data class Filters(
/**
* 擅长人群
*/
@field:SerializedName("specialityCrowd")
@field:SerializedName("speciality_crowd")
val specialityCrowd: ArrayList<SpecialityCrowdBean> = ArrayList()
)
\ No newline at end of file
package com.yidianling.consultant.model.bean
import com.google.gson.annotations.SerializedName
data class PriceRangesItem(
@field:SerializedName("minPrice")
var minPrice: String? = null,
@field:SerializedName("maxPrice")
var maxPrice: String? = null,
@SerializedName("recommendPercent")
var recommendPercent: String? = null
var min_price: String? = null,
var max_price: String? = null,
var recommend_percent: String? = null,
var display_range: String? = null,
var key1: String = "avg_price"
)
\ No newline at end of file
......@@ -25,8 +25,6 @@ import com.yidianling.consultant.listener.OnFilterConfirmListener
import com.yidianling.consultant.model.bean.AllFilter
import com.yidianling.consultant.model.bean.Filters
import com.yidianling.consultant.model.bean.PriceRangesItem
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.consultant_item_filter.view.*
import kotlinx.android.synthetic.main.consultant_item_price_range.view.*
import kotlinx.android.synthetic.main.consultant_ui_filter_popup.view.*
......@@ -43,7 +41,6 @@ class FilterPopupWindow(
private val tempFilter: AllFilter
) : PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private val mDisposableList = CompositeDisposable()
private val showTypeViews: ArrayList<View> = ArrayList()
private val enquiryViews: ArrayList<View> = ArrayList()
......@@ -110,6 +107,9 @@ class FilterPopupWindow(
}
view.btnConfirm.setOnClickListener {
if (tempFilter.priceRanges?.key1 == "avg_price" && filterData.priceRanges.isNotEmpty()) {
tempFilter.priceRanges?.key1 = filterData.priceRanges[0].key1
}
biEvent(ConsultBIConstants.POSITION_CONSULT_FILTER_CHECKOUT_CLICK)
onFilterConfirmListener?.onFilterConfirmed()
dismiss()
......@@ -168,7 +168,7 @@ class FilterPopupWindow(
tempFilter.enquiries.forEach {
if (textView.text.toString() == it.value) {
Glide.with(context)
.load(it.unCheckUrl)
.load(it.un_check_url)
.into(ivIcon)
}
}
......@@ -269,15 +269,15 @@ class FilterPopupWindow(
}
if (tempFilter.priceRanges != null) {
sb.append("&minPrice=").append(tempFilter.priceRanges?.minPrice)
sb.append("&maxPrice=").append(tempFilter.priceRanges?.maxPrice)
sb.append("&minPrice=").append(tempFilter.priceRanges?.min_price)
sb.append("&maxPrice=").append(tempFilter.priceRanges?.max_price)
if (ConsultBIConstants.POSITION_AVERAGE_SERVICE_INPUT == biEventName) {
var account = 0.0
if (!TextUtils.isEmpty(tempFilter.priceRanges?.minPrice)) {
account += tempFilter.priceRanges?.minPrice?.toDouble()!!
if (!TextUtils.isEmpty(tempFilter.priceRanges?.min_price)) {
account += tempFilter.priceRanges?.min_price?.toDouble()!!
}
if (!TextUtils.isEmpty(tempFilter.priceRanges?.maxPrice)) {
account += tempFilter.priceRanges?.maxPrice?.toDouble()!!
if (!TextUtils.isEmpty(tempFilter.priceRanges?.max_price)) {
account += tempFilter.priceRanges?.max_price?.toDouble()!!
}
biEventParams = ((account / 2).roundToInt()).toString()
......@@ -334,9 +334,6 @@ class FilterPopupWindow(
}
}
fun addSubscription(disposable: Disposable) {
mDisposableList.add(disposable)
}
/**
* 其他选择
......@@ -573,7 +570,7 @@ class FilterPopupWindow(
llLayout.layoutParams = params
textView.text = enquiry.value
Glide.with(context)
.load(enquiry.unCheckUrl)
.load(enquiry.un_check_url)
.into(ivIcon)
enquiryViews.add(llLayout)
......@@ -581,7 +578,7 @@ class FilterPopupWindow(
llLayout.isSelected = true
textView.paint.isFakeBoldText = true
Glide.with(context)
.load(enquiry.checkRrl)
.load(enquiry.check_url)
.into(ivIcon)
}
llLayout.setOnClickListener {
......@@ -590,14 +587,14 @@ class FilterPopupWindow(
llLayout.isSelected = false
textView.paint.isFakeBoldText = false
Glide.with(context)
.load(enquiry.unCheckUrl)
.load(enquiry.un_check_url)
.into(ivIcon)
} else {
tempFilter.enquiries.add(enquiry)
llLayout.isSelected = true
textView.paint.isFakeBoldText = true
Glide.with(context)
.load(enquiry.checkRrl)
.load(enquiry.check_url)
.into(ivIcon)
}
updateCount(ConsultBIConstants.POSITION_CONSULT_TYPE_CLICK)
......@@ -612,9 +609,9 @@ class FilterPopupWindow(
etMinPrice = priceRange.findViewById(R.id.etMinPrice);
etMaxPrice = priceRange.findViewById(R.id.etMaxPrice);
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
// context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
var listener: TextView.OnEditorActionListener =
val listener: TextView.OnEditorActionListener =
TextView.OnEditorActionListener { _, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE || event != null && event.keyCode == KeyEvent.KEYCODE_ENTER) {
updatePriceFilter()
......@@ -625,8 +622,8 @@ class FilterPopupWindow(
}
if (tempFilter.priceRanges != null) {
etMinPrice?.setText(tempFilter.priceRanges?.minPrice)
etMaxPrice?.setText(tempFilter.priceRanges?.maxPrice)
etMinPrice?.setText(tempFilter.priceRanges?.min_price)
etMaxPrice?.setText(tempFilter.priceRanges?.max_price)
}
etMaxPrice?.setOnEditorActionListener(listener)
......@@ -673,16 +670,11 @@ class FilterPopupWindow(
0
)
textView.layoutParams = params
val maxPriceStr =
if (TextUtils.isEmpty(priceRangesItem.maxPrice)) "+" else "-" + priceRangesItem.maxPrice
val contentStr = String.format(
"%s%s\n%s",
priceRangesItem.minPrice,
maxPriceStr,
priceRangesItem.recommendPercent
"%s\n%s",
priceRangesItem.display_range,
priceRangesItem.recommend_percent
)
val msp = SpannableString(contentStr)
msp.setSpan(
AbsoluteSizeSpan(10, true),
......@@ -690,8 +682,7 @@ class FilterPopupWindow(
contentStr.length,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.text = msp;
textView.text = msp
textView.setSingleLine(false)
textView.setLineSpacing(1.0f, 1.2f)
......@@ -717,13 +708,17 @@ class FilterPopupWindow(
etMaxPrice?.setText("")
etMinPrice?.setText("")
} else {
tempFilter.priceRanges =
priceRangesItem.copy(priceRangesItem.minPrice, priceRangesItem.maxPrice)
tempFilter.priceRanges = priceRangesItem.copy(
min_price = priceRangesItem.min_price,
max_price = priceRangesItem.max_price
)
textView.isSelected = true
textView.paint.isFakeBoldText = true
tempFilter.priceRangesView = textView
etMinPrice?.setText(priceRangesItem.minPrice)
etMaxPrice?.setText(priceRangesItem.maxPrice)
etMinPrice?.setText(priceRangesItem.min_price)
etMaxPrice?.setText(priceRangesItem.max_price)
etMinPrice?.setSelection(etMinPrice?.text!!.length)
etMaxPrice?.setSelection(etMaxPrice?.text!!.length)
}
updateCount(ConsultBIConstants.POSITION_AVERAGE_SERVICE_INPUT)
......@@ -743,8 +738,8 @@ class FilterPopupWindow(
tempFilter.priceRanges = priceRangesItem;
}
tempFilter.priceRanges!!.maxPrice = etMaxPrice?.text.toString()
tempFilter.priceRanges!!.minPrice = etMinPrice?.text.toString()
tempFilter.priceRanges!!.max_price = etMaxPrice?.text.toString()
tempFilter.priceRanges!!.min_price = etMinPrice?.text.toString()
tempFilter.priceRangesView?.isSelected = false
tempFilter.priceRangesView?.paint?.isFakeBoldText = false
tempFilter.priceRangesView = null
......@@ -794,7 +789,6 @@ class FilterPopupWindow(
}
override fun dismiss() {
mDisposableList.clear()
super.dismiss()
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.consultant.R
import com.yidianling.consultant.bean.ExpertSearchBigShotBean
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultEvent.Companion.YDL_USER_CONSULT_TYPE_CLICK
import com.yidianling.consultant.constants.ConsultBIConstants
import kotlinx.android.synthetic.main.consultant_expert_search_big_shot_one.view.*
class BigShotOneView : LinearLayout {
......@@ -54,6 +54,10 @@ class BigShotOneView : LinearLayout {
consultant_one_img_1.setOnClickListener {
val h5Params = H5Params(bean.specialTopicUrl, null)
NewH5Activity.start(context, h5Params)
ActionCountUtils.count(
ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE + "|" + ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK,
bean.specialTopicTitle
)
}
}
}
\ No newline at end of file
......@@ -8,8 +8,10 @@ import android.widget.LinearLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.consultant.R
import com.yidianling.consultant.bean.ExpertSearchBigShotBean
import com.yidianling.consultant.constants.ConsultBIConstants
import kotlinx.android.synthetic.main.consultant_expert_search_big_shot_three.view.*
class BigShotThreeView : LinearLayout {
......@@ -56,16 +58,31 @@ class BigShotThreeView : LinearLayout {
consultant_three_img_1.setOnClickListener {
val h5Params = H5Params(bean1.specialTopicUrl, null)
NewH5Activity.start(context, h5Params)
ActionCountUtils.count(
ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE + "|" + ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK,
bean1.specialTopicTitle
)
}
mContext?.let { GlideApp.with(it).load(bean2.topicImages[2].imageUrl).into(consultant_three_img_2) }
consultant_three_img_2.setOnClickListener {
val h5Params = H5Params(bean2.specialTopicUrl, null)
NewH5Activity.start(context, h5Params)
ActionCountUtils.count(
ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE + "|" + ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK,
bean2.specialTopicTitle
)
}
mContext?.let { GlideApp.with(it).load(bean3.topicImages[2].imageUrl).into(consultant_three_img_3) }
consultant_three_img_3.setOnClickListener {
val h5Params = H5Params(bean3.specialTopicUrl, null)
NewH5Activity.start(context, h5Params)
ActionCountUtils.count(
ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE + "|" + ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK,
bean3.specialTopicTitle
)
}
}
......
......@@ -55,12 +55,22 @@ class BigShotTwoView : LinearLayout {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.YDL_USER_CONSULT_TYPE_CLICK,bean1.specialTopicTitle)
val h5Params = H5Params(bean1.specialTopicUrl, null)
NewH5Activity.start(context, h5Params)
ActionCountUtils.count(
ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE + "|" + ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK,
bean1.specialTopicTitle
)
}
mContext?.let { GlideApp.with(it).load(bean2.topicImages[1].imageUrl).into(consultant_two_img_2) }
consultant_two_img_2.setOnClickListener {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.YDL_USER_CONSULT_TYPE_CLICK,bean2.specialTopicTitle)
val h5Params = H5Params(bean2.specialTopicUrl, null)
NewH5Activity.start(context, h5Params)
ActionCountUtils.count(
ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE + "|" + ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK,
bean2.specialTopicTitle
)
}
}
......
......@@ -4,17 +4,16 @@ import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.R
import com.yidianling.consultant.bean.ExpertSearchRecommandBean
import com.yidianling.consultant.constants.ConsultBIConstants
import kotlinx.android.synthetic.main.consultant_expert_search_top_item_view.view.*
import java.net.URLDecoder
class RecommendItemView : LinearLayout {
......@@ -70,6 +69,11 @@ class RecommendItemView : LinearLayout {
setOnClickListener {
val h5Params = H5Params(bean.specialTopicUrl, null)
NewH5Activity.start(context, h5Params)
ActionCountUtils.count(
ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE + "|" + ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK,
bean.specialTopicTitle
)
}
}
......
......@@ -2,6 +2,7 @@ package com.yidianling.consultant.ui.view.topView
import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import android.util.AttributeSet
......@@ -71,12 +72,16 @@ class RecommendListView : LinearLayout {
recommendViewPagerIndicator.visibility = View.GONE
itemListView.visibility = View.GONE
requestData()
// requestData()
}
@SuppressLint("CheckResult")
fun requestData() {
ExpertSearchHttpImpl.getInstance().getBigShotData()
fun requestData(cateId:String) {
val map = HashMap<String, Any>()
if (!TextUtils.isEmpty(cateId)){
map["entrance"] = cateId
}
ExpertSearchHttpImpl.getInstance().getBigShotData(map)
.subscribeOn(Schedulers.io())
.compose(RxUtils.resultJavaData())
.map { it }
......@@ -114,7 +119,7 @@ class RecommendListView : LinearLayout {
/**
* 设置数据
*/
fun setData() {
private fun setData() {
// 顶部viewpager数据
if (mSceneSpecialTopicList.isNotEmpty()) {
......
......@@ -27,7 +27,6 @@
android:background="@drawable/shape_round_gray_bored"
android:inputType="number"
android:maxLines="1"
android:textCursorDrawable="@color/platform_main_theme"
android:textSize="13sp"
android:maxLength="7"
/>
......@@ -45,9 +44,8 @@
android:layout_marginLeft="10dp"
android:background="@drawable/shape_round_gray_bored"
android:inputType="number"
android:maxLines="1"
android:textCursorDrawable="@color/platform_main_theme"
android:textSize="13sp"
android:maxLines="1"
android:maxLength="7"
/>
......
......@@ -33,7 +33,7 @@
android:width="0dp"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:text="@string/platform_theme"
android:text="困扰"
android:textColor="@color/platform_color_242424" />
<com.ydl.ydlcommon.view.DrawableRightTextView
......
......@@ -59,7 +59,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28"
android:text="服务均价"
android:text="价格"
android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
......@@ -195,15 +195,16 @@
android:background="@color/platform_white"
android:orientation="horizontal">
<TextView
android:id="@+id/btnReset"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_weight="1"
android:background="@drawable/consultant_bg_radius_gray_6"
android:background="@drawable/consultant_stroke_ebebeb_r_8"
android:gravity="center"
android:text="@string/platform_reset"
android:textColor="@color/platform_color_999999"
android:textColor="@color/platform_color_242424"
android:textSize="16sp" />
<TextView
......@@ -212,11 +213,10 @@
android:layout_height="44dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@drawable/consultant_bg_radius_5_dark"
android:background="@drawable/consultant_solid_main_theme_color_r_8"
android:gravity="center"
android:hint="确定"
android:text="确定"
android:textColor="@color/white"
android:textColorHint="@color/platform_color_E0E0E0"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<?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
......@@ -534,6 +534,16 @@ public class AVChatActivity extends AVChatBaseUI implements AVChatVideoUI.TouchZ
avChatVideoUI.peerVideoOn();
}
break;
case AVChatControlCommand.NOTIFY_AUDIO_ON:
AliYunRichLogsHelper.Companion.getInstance()
.sendRichLog(AliYunLogConfig.YUNXIN, "handleCallControl 咨询师打开了麦克风");
break;
case AVChatControlCommand.NOTIFY_AUDIO_OFF:
AliYunRichLogsHelper.Companion.getInstance()
.sendRichLog(AliYunLogConfig.YUNXIN, "handleCallControl 咨询师关闭了麦克风");
break;
default:
ToastUtil.toastShort(this, "对方发来指令值:" + notification.getControlCommand());
break;
......
......@@ -18,4 +18,8 @@ public class SystemConfigByKeywordBean {
*/
public String value1;
/**
* 0:不弹信息卡,1:弹信息卡
* */
public String value2;
}
......@@ -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";
......
......@@ -63,6 +63,8 @@ object IMChatUtil {
private const val USER_TYPE_EXPERT = 2//专家
private const val USER_TYPE_ASSISTANT = 3//助理
private const val USER_TYPE_USER = 1//用户
//展示信息收集卡
private const val SHOW_EMS_POP = 1L
lateinit var doctorId: String
/**
......@@ -98,7 +100,9 @@ object IMChatUtil {
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
val skipTime = it.value1.toLong()
if (isJumpToIm(skipTime)) {
//0:不弹信息卡,1:弹信息卡
val isPopCms = it.value2.toLong()
if (SHOW_EMS_POP != isPopCms || isJumpToIm(skipTime)) {
// 请求接口获取咨询助理的uid
getImJavaApi().getConsultAssistantUidRequest(location, ffrom2)
.subscribeOn(Schedulers.io())
......@@ -191,7 +195,10 @@ object IMChatUtil {
.subscribe {
//请求接口获取 前置信息收集间隔时间
val skipTime = it.value1.toLong()
if (isJumpToIm(skipTime)) {
//0:不弹信息卡,1:弹信息卡
val isPopCms = it.value2.toLong()
if (SHOW_EMS_POP != isPopCms || isJumpToIm(skipTime)) {
//时间内已收集过信息,直接跳转到聊天页
startChat(context, toUid, isFromQingShu)
} else {
......
......@@ -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
......@@ -240,7 +239,7 @@ class IMServiceImpl : IImService {
customNotification.sessionId = toUid
customNotification.config = config
customNotification.content = content
// customNotification.isSendToOnlineUserOnly=false
customNotification.isSendToOnlineUserOnly = true
NIMClient.getService(MsgService::class.java).sendCustomNotification(customNotification).setCallback(object : RequestCallback<Void?> {
override fun onSuccess(param: Void?) {
callback.onSuccess()
......@@ -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
......@@ -5,6 +5,7 @@ import android.os.Looper
import com.umeng.socialize.UMAuthListener
import com.umeng.socialize.UMShareAPI
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.data.http.CustomThrowable
import com.yidianling.user.http.request.ThirdLoginParam
import io.reactivex.Observable
......@@ -72,6 +73,7 @@ class LoginObservable(val activity: Activity, private val media: SHARE_MEDIA): O
}
override fun onError(p0: SHARE_MEDIA?, p1: Int, p2: Throwable?) {
Apm.reportCustom("login", "third_auth_error", p2 ?: Exception("${p0},$p1"))
observer?.onError(p2?:Throwable("未知异常"))
}
......
......@@ -14,6 +14,7 @@ import android.widget.RelativeLayout
import android.widget.TextView
import com.mobile.auth.gatewayauth.*
import com.mobile.auth.gatewayauth.model.TokenRet
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.utils.JPushUtils
......@@ -506,6 +507,7 @@ object OneKeyLoginHelp {
"一键登录失败 msg:${it.msg}"
)
ToastUtil.toastShort(it.msg)
Apm.reportCustom("login", "oneKey_error", Exception("${it.code},${it.msg}"))
mPhoneNumberAuthHelper?.hideLoginLoading()
}
}, {
......@@ -513,6 +515,7 @@ object OneKeyLoginHelp {
AliYunLogConfig.LOGIN,
"一键登录Error msg:${it.message}"
)
Apm.reportCustom("login", "oneKey_error", it)
ToastUtil.toastShort(it.message)
mPhoneNumberAuthHelper?.hideLoginLoading()
})
......@@ -524,6 +527,7 @@ object OneKeyLoginHelp {
}
override fun onTokenFailed(s: String) {
Apm.reportCustom("login", "oneKey_error", Exception("TokenFailed:${s}"))
LogUtil.e("onTokenFailed"+s)
mIsGetTokenSuccess = false
val tokenRet = TokenRet.fromJson(s)
......
......@@ -2,6 +2,7 @@ package com.yidianling.user.ui.login.presenter
import android.annotation.SuppressLint
import android.text.TextUtils
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.StringUtils
......@@ -114,10 +115,12 @@ class InputPassWordPresenterImpl :
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.LOGIN, "手机号密码 登录失败 msg: ${it.msg}")
ToastUtil.toastShort(it.msg)
Apm.reportCustom("login", "password_error", Exception("密码登录失败,$phoneCountryCode-$phone"))
mView.startAnim()
} else {
if (it.data.userInfo?.user_type == 2) {
mView.showNormalDialog()
Apm.reportCustom("login", "isexpert", Exception("登录—专家帐号,$phoneCountryCode-$phone"))
} else {
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
......@@ -137,6 +140,7 @@ class InputPassWordPresenterImpl :
}
}, {
YdlCommonOut.showToast(it.message!!)
Apm.reportCustom("login", "password_error", it)
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.LOGIN, "手机号密码 Error msg: ${it.message}")
......
......@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.text.TextUtils
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.YDLCacheUtils
......@@ -20,7 +21,6 @@ import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.CheckAliAuthParam
import com.yidianling.user.http.request.PhoneLoginAutoParam
import com.yidianling.user.ui.login.OneKeyLoginHelp
import com.yidianling.user.ui.login.contract.ILoginContract
import com.yidianling.user.ui.login.model.LoginModelImpl
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -168,6 +168,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
if (it.data.isRegistered == 1) {
mView.showLoading(false)
mView.showHasBindedDialog()
Apm.reportCustom("login", "mobile_isbind", Exception("登录-手机被绑定,$countryCode-$phone"))
} else {
mView.checkPhoneStatusSuccess(it.data, phone)
}
......@@ -175,6 +176,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
if (it.data.isDoctor == 1) {//是专家账号
mView.showLoading(false)
mView.showNormalDialog()
Apm.reportCustom("login", "isexpert", Exception("登录—专家帐号,$countryCode-$phone"))
} else {
mView.checkPhoneStatusSuccess(it.data, phone)
}
......@@ -212,6 +214,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
.subscribe({
mView.dismissProgressView()
if (it?.data == null) {
Apm.reportCustom("login", "third_login_error", Exception("${it.code},${it.msg}"))
ToastUtil.toastShort(it.msg)
return@subscribe
}
......@@ -265,6 +268,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
}, {
mView.dismissProgressView()
Apm.reportCustom("login", "third_login_error", it)
YdlCommonOut.showToast(it.message!!)
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.LOGIN, media.getName() + "登录失败")
......
......@@ -2,7 +2,7 @@ package com.yidianling.user.ui.login.presenter
import android.annotation.SuppressLint
import android.text.TextUtils
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
......@@ -47,10 +47,12 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
mView.startCountdown(60)
} else {
mView.startAnim()
Apm.reportCustom("login", "getcode_error", Exception("${phone},${it.code},${it.msg}"))
ToastUtil.toastShort(it.msg)
}
}, {
mView.startAnim()
Apm.reportCustom("login", "getcode_error", it)
ToastUtil.toastShort(it.message)
})
}
......@@ -113,11 +115,13 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
} else {
ToastUtil.toastShort(it.msg)//服务端返回{验证码错误&异常}信息
// mView.startAnim()
Apm.reportCustom("login", "bind_mobile_error", Exception("${param.countryCode}-${param.phoneNumber},${it.code},${it.msg}"))
mView.verificationErrorCode()
}
}, {
// mView.startAnim()
mView.verificationErrorCode()
Apm.reportCustom("login", "bind_mobile_error", it)
ToastUtil.toastShort(it.message)
})
......@@ -189,10 +193,12 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
} else {
ToastUtil.toastShort(it.msg)//服务端返回{验证码错误&异常}信息
// mView.startAnim()
Apm.reportCustom("login", "code_error", Exception("${phoneCountryCode}-${phone},${it.code},${it.msg}"))
mView.verificationErrorCode()
}
}, {
mView.startAnim()
Apm.reportCustom("login", "code_error", it)
ToastUtil.toastShort(it.message)
})
}
......
<?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"]
//发布时使用
......
......@@ -239,15 +239,6 @@ public class RxDeviceTool {
return tm.getSimState();
}
/**
* 获取ANDROID ID
*
* @param context
* @return
*/
public static String getAndroidId(Context context) {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}
/**
* 获取设备型号,如MI2SC
......
......@@ -5,8 +5,8 @@ import android.app.Activity
import android.app.Dialog
import android.graphics.Point
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import android.view.*
import androidx.appcompat.app.AlertDialog
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
......@@ -192,7 +192,6 @@ class PayDialog : Dialog {
LogHelper.getInstance().writeLogSync("支付成功")
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.PAY,"支付成功")
this.callBack?.onSuccess()
dismiss()
}, {
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.PAY,"支付失败:${it.message}")
......
......@@ -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
......@@ -150,7 +138,6 @@ dependencies {
api rootProject.ext.dependencies["flowlayout"]
api rootProject.ext.dependencies["androidanimations"]
//====================Tools====================
api rootProject.ext.dependencies["robust"]
api rootProject.ext.dependencies["walle"]
api rootProject.ext.dependencies["jpush"]
api rootProject.ext.dependencies["jcore"]
......@@ -163,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"]
......
......@@ -12,7 +12,10 @@ object Apm {
private var crash: MonitorCrash? = null
private var hasInit = false
fun initApm(context: Context, appId: String, vCode: Long, vName: String, debug: Boolean, uidCall: () -> String?) {
if (debug) return
val channel = if (debug) "debug" else WalleChannelReader.getChannel(context)
crash = MonitorCrash.init(
context,
......@@ -27,7 +30,7 @@ object Apm {
//.cpuMonitor(true)
//.fpsMonitor(true)
//.seriousBlockDetect(true)
.blockDetect(true)
.blockDetect(false)
// .enableWebViewMonitor(true)
.channel(channel)
.debugMode(debug)
......@@ -35,10 +38,13 @@ object Apm {
.setDynamicParams(ApmParams(crash, uidCall))
ApmInsight.getInstance().init(context, builder.build())
VLog.init(context, 20)
hasInit = true
}
fun reportCustom(type: String, msg: String, throwable: Throwable) {
crash?.reportCustomErr(msg, type, throwable)
if (hasInit) {
crash?.reportCustomErr(msg, type, throwable)
}
}
}
......
......@@ -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 {
......
......@@ -10,7 +10,11 @@ import com.ydl.ydlcommon.base.BaseApp
*/
object JPushUtils{
fun getRegistrationID():String{
return JPushInterface.getRegistrationID(BaseApp.getApp());
fun getRegistrationID(): String? {
return if (DeviceTool.checkHasAgreeSecret()) {
JPushInterface.getRegistrationID(BaseApp.getApp());
} else {
null;
}
}
}
\ No newline at end of file
......@@ -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
......@@ -288,10 +288,11 @@ class ActionCountUtils {
baiduActionDataParams.appName(appName)
try {
@SuppressLint("HardwareIds") val id =
Settings.Secure.getString(
RxTool.getContext().contentResolver,
Settings.Secure.ANDROID_ID
)
if (DeviceTool.checkHasAgreeSecret()){
Settings.Secure.getString(RxTool.getContext().contentResolver, Settings.Secure.ANDROID_ID)
}else{
""
}
LogUtil.e("androidid未加密:${id}")
} catch (e: java.lang.Exception) {
......
<?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
......@@ -256,17 +256,6 @@ public class RxDeviceTool {
}
/**
* 获取SIM卡的序列号
*
* @param context
* @return
*/
// public static String getSimSerialNumber(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getSimSerialNumber();
// }
/**
* 获取SIM的状态信息
*
* @param context
......@@ -278,38 +267,6 @@ public class RxDeviceTool {
}
/**
* 获取唯一的用户ID
*
* @param context
* @return
*/
// public static String getSubscriberId(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getSubscriberId();
// }
/**
* 获取语音邮件号码
*
* @param context
* @return
*/
// public static String getVoiceMailNumber(Context context) {
// TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// return tm.getVoiceMailNumber();
// }
/**
* 获取ANDROID ID
*
* @param context
* @return
*/
public static String getAndroidId(Context context) {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}
/**
* 获取设备型号,如MI2SC
*
* @return 设备型号
......@@ -418,69 +375,6 @@ public class RxDeviceTool {
}
return result;
}
/**
* 获取设备信息
*
* @param context
* @return
*/
// public static String getDeviceInfo(Context context) {
// try {
// org.json.JSONObject json = new org.json.JSONObject();
// TelephonyManager tm = (TelephonyManager) context
// .getSystemService(Context.TELEPHONY_SERVICE);
// String device_id = null;
// if (checkPermission(context, Manifest.permission.READ_PHONE_STATE)) {
// device_id = getDeviceIdIMEI(context);
// }
// String mac = null;
// FileReader fstream = null;
// try {
// fstream = new FileReader("/sys/class/net/wlan0/address");
// } catch (FileNotFoundException e) {
// fstream = new FileReader("/sys/class/net/eth0/address");
// }
// BufferedReader in = null;
// if (fstream != null) {
// try {
// in = new BufferedReader(fstream, 1024);
// mac = in.readLine();
// } catch (IOException e) {
// } finally {
// if (fstream != null) {
// try {
// fstream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (in != null) {
// try {
// in.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
// json.put("mac", mac);
// if (TextUtils.isEmpty(device_id)) {
// device_id = mac;
// }
// if (TextUtils.isEmpty(device_id)) {
// device_id = Settings.Secure.getString(context.getContentResolver(),
// Settings.Secure.ANDROID_ID);
// }
// json.put("device_id", device_id);
// return json.toString();
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
// }
/**
* 遍历LOG输出HashMap
*
......@@ -578,9 +472,6 @@ public class RxDeviceTool {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String str = "";
// str += "DeviceId(IMEI) = " + getDeviceIdIMEI(context) + "\n";
// str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n";
// str += "Line1Number = " + tm.getLine1Number() + "\n";
str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n";
str += "NetworkOperator = " + tm.getNetworkOperator() + "\n";
str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n";
......@@ -589,10 +480,7 @@ public class RxDeviceTool {
str += "SimCountryIso = " + tm.getSimCountryIso() + "\n";
str += "SimOperator = " + tm.getSimOperator() + "\n";
str += "SimOperatorName = " + tm.getSimOperatorName() + "\n";
// str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n";
str += "SimState = " + tm.getSimState() + "\n";
// str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";
// str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";
return str;
}
......@@ -607,174 +495,6 @@ public class RxDeviceTool {
}
/**
* 获取手机联系人
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>}</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_CONTACTS"/>}</p>
*
* @param context 上下文;
* @return 联系人链表
*/
// public static List<HashMap<String, String>> getAllContactInfo(Context context) {
// SystemClock.sleep(3000);
// ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
// // 1.获取内容解析者
// ContentResolver resolver = context.getContentResolver();
// // 2.获取内容提供者的地址:com.android.contacts
// // raw_contacts表的地址 :raw_contacts
// // view_data表的地址 : data
// // 3.生成查询地址
// Uri raw_uri = Uri.parse("content://com.android.contacts/raw_contacts");
// Uri date_uri = Uri.parse("content://com.android.contacts/data");
// // 4.查询操作,先查询raw_contacts,查询contact_id
// // projection : 查询的字段
// Cursor cursor = resolver.query(raw_uri, new String[]{"contact_id"},
// null, null, null);
// // 5.解析cursor
// while (cursor.moveToNext()) {
// // 6.获取查询的数据
// String contact_id = cursor.getString(0);
// // cursor.getString(cursor.getColumnIndex("contact_id"));//getColumnIndex
// // : 查询字段在cursor中索引值,一般都是用在查询字段比较多的时候
// // 判断contact_id是否为空
// if (!RxDataTool.isNullString(contact_id)) {//null ""
// // 7.根据contact_id查询view_data表中的数据
// // selection : 查询条件
// // selectionArgs :查询条件的参数
// // sortOrder : 排序
// // 空指针: 1.null.方法 2.参数为null
// Cursor c = resolver.query(date_uri, new String[]{"data1",
// "mimetype"}, "raw_contact_id=?",
// new String[]{contact_id}, null);
// HashMap<String, String> map = new HashMap<String, String>();
// // 8.解析c
// while (c.moveToNext()) {
// // 9.获取数据
// String data1 = c.getString(0);
// String mimetype = c.getString(1);
// // 10.根据类型去判断获取的data1数据并保存
// if (mimetype.equals("vnd.android.cursor.item/phone_v2")) {
// // 电话
// map.put("phone", data1);
// } else if (mimetype.equals("vnd.android.cursor.item/name")) {
// // 姓名
// map.put("name", data1);
// }
// }
// // 11.添加到集合中数据
// list.add(map);
// // 12.关闭cursor
// c.close();
// }
// }
// // 12.关闭cursor
// cursor.close();
// return list;
// }
/**
* 打开手机联系人界面点击联系人后便获取该号码
* <p>参照以下注释代码</p>
*/
public static void getContantNum() {
Log.i("tips", "U should copy the following code.");
/*
Intent intent = new Intent();
intent.setAction("android.intent.action.PICK");
intent.setType("vnd.android.cursor.dir/phone_v2");
startActivityForResult(intent, 0);
@Override
protected void onActivityResult ( int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
if (data != null) {
Uri uri = data.getData();
String num = null;
// 创建内容解析者
ContentResolver contentResolver = getContentResolver();
Cursor cursor = contentResolver.query(uri,
null, null, null, null);
while (cursor.moveToNext()) {
num = cursor.getString(cursor.getColumnIndex("data1"));
}
cursor.close();
num = num.replaceAll("-", "");//替换的操作,555-6 -> 5556
}
}
*/
}
/**
* 获取手机短信并保存到xml中
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_SMS"/>}</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>}</p>
*
* @param context 上下文
*/
// public static void getAllSMS(Context context) {
// // 1.获取短信
// // 1.1获取内容解析者
// ContentResolver resolver = context.getContentResolver();
// // 1.2获取内容提供者地址 sms,sms表的地址:null 不写
// // 1.3获取查询路径
// Uri uri = Uri.parse("content://sms");
// // 1.4.查询操作
// // projection : 查询的字段
// // selection : 查询的条件
// // selectionArgs : 查询条件的参数
// // sortOrder : 排序
// Cursor cursor = resolver.query(uri, new String[]{"address", "date", "type", "body"}, null, null, null);
// // 设置最大进度
// int count = cursor.getCount();//获取短信的个数
// // 2.备份短信
// // 2.1获取xml序列器
// XmlSerializer xmlSerializer = Xml.newSerializer();
// try {
// // 2.2设置xml文件保存的路径
// // os : 保存的位置
// // encoding : 编码格式
// xmlSerializer.setOutput(new FileOutputStream(new File("/mnt/sdcard/backupsms.xml")), "utf-8");
// // 2.3设置头信息
// // standalone : 是否独立保存
// xmlSerializer.startDocument("utf-8", true);
// // 2.4设置根标签
// xmlSerializer.startTag(null, "smss");
// // 1.5.解析cursor
// while (cursor.moveToNext()) {
// SystemClock.sleep(1000);
// // 2.5设置短信的标签
// xmlSerializer.startTag(null, "sms");
// // 2.6设置文本内容的标签
// xmlSerializer.startTag(null, "address");
// String address = cursor.getString(0);
// // 2.7设置文本内容
// xmlSerializer.text(address);
// xmlSerializer.endTag(null, "address");
// xmlSerializer.startTag(null, "date");
// String date = cursor.getString(1);
// xmlSerializer.text(date);
// xmlSerializer.endTag(null, "date");
// xmlSerializer.startTag(null, "type");
// String type = cursor.getString(2);
// xmlSerializer.text(type);
// xmlSerializer.endTag(null, "type");
// xmlSerializer.startTag(null, "body");
// String body = cursor.getString(3);
// xmlSerializer.text(body);
// xmlSerializer.endTag(null, "body");
// xmlSerializer.endTag(null, "sms");
// System.out.println("address:" + address + " date:" + date + " type:" + type + " body:" + body);
// }
// xmlSerializer.endTag(null, "smss");
// xmlSerializer.endDocument();
// // 2.8将数据刷新到文件中
// xmlSerializer.flush();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
/**
* 设置屏幕为横屏
* <p>还有一种就是在Activity中加属性android:screenOrientation="landscape"</p>
* <p>不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次</p>
......
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