Commit 57c13dc2 by 王佳洋

Merge remote-tracking branch 'origin/d/v4.4.07' into feat/wjy/audioPlay

# Conflicts:
#	config.gradle
#	gradle/wrapper/gradle-wrapper.properties
#	ydl-media/src/main/java/com/ydl/media/audio/PlayService.kt
parents 224f9f90 f79f4b0f
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.4'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.3'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.ydl.home.api">
</manifest>
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.3'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
apply from: "../../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
......@@ -116,6 +116,8 @@ interface IUserService : IProvider {
* */
fun loginByOneKeyLogin(context: Context, isOpenDialog: Boolean) :Boolean
fun checkOneLoginEnvAvailable(): Boolean
/**
* 调用优先使用一键登录,并返回调用时的登录状态,
* @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
......
......@@ -31,7 +31,6 @@ android {
flavorDimensions "versionCode"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"]
}
}
......@@ -178,6 +177,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.github.feeeei:CircleSeekbar:v1.1.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation(rootProject.ext.dependencies["appcompat-v7"])
testImplementation 'junit:junit:4.13.2'
......
......@@ -20,7 +20,6 @@ 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
import com.ydl.ydlcommon.base.config.HttpConfig
......@@ -78,15 +77,6 @@ class DemoAppLifecycles : IAppLifecycles {
// YDLCommonPlugin plugin = new YDLCommonPlugin();
// flutterEngine.getLocalizationChannel().channel.setMethodCallHandler(plugin);
val intent = Intent(application, PlayService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
application.startForegroundService(intent)
}else{
application.startService(intent)
}
// application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
}
}
......
package com.ydl.component.service.web;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Rect;
import android.text.TextUtils;
......@@ -61,7 +62,11 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
@Override
public void contactYi() {
try {
ModularServiceManager.INSTANCE.provide(IImService.class)
.startP2PSession(mContext, -1, "14", "14", "客服小壹", "14");
} catch (Exception e) {
}
}
@Override
......@@ -111,7 +116,17 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
@Override
public void chat(int id, int toUid, int canTalk, String accessToken, int isFromQingShu) {
if ((toUid + "").equals("14")) {
//找客服私聊不需要积分
contactYi();
} else {
try {
ModularServiceManager.INSTANCE.provide(IImService.class)
.startChatCloseReplaceChat(mContext, String.valueOf(toUid));
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
......@@ -576,6 +591,15 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
}
}
/**
* 打开时间选择器
*/
@SuppressLint("CheckResult")
@Override
public void openTimePicker(String jsCallBackName, String day, String doctorId, String orderId) {
}
@Override
public void showCommentArticleDialog(H5JsBean.H5JsCmd.Params params) {
......
......@@ -14,6 +14,7 @@ import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.user.UserHelper
......@@ -459,6 +460,13 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
"switch_push_status" -> {
wvEnventPro?.switchPushStatus(jsData.cmd?.params)
}
// 打开时间选择器
"requestSelectTime"->{
if (Utils.isFastClick()){
return
}
wvEnventPro?.openTimePicker(jsData.cmd?.params?.callBack,jsData.cmd?.params?.day,jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.orderId)
}
"open_article_comment_dialog" -> {
wvEnventPro?.showCommentArticleDialog(jsData.cmd?.params)
......
......@@ -211,4 +211,8 @@ public interface WebViewClientClickListener {
void resourceToPreview(H5JsBean.H5JsCmd.Params params);
void showDocBooking(H5JsBean.H5JsCmd.Params params);
// 打开时间选择器
void openTimePicker(String jsCallBackName,String day,String doctorId,String orderId);
}
......@@ -3,7 +3,7 @@ apply from: "config.gradle"
buildscript {
ext {
kotlin_version = '1.3.50'
kotlin_version = '1.6.10'
support_version = '26.1.0'
minSdkVersion = 21
targetSdkVersion = 28
......@@ -13,42 +13,45 @@ buildscript {
arouter_compiler = '1.2.2'
ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2'
componentVersion = "0.3.0.18"
}
repositories {
maven {
url 'http://nexus.yidianling.com/repository/android/'
credentials {
username "admin"
password "fjoi#1+#@"
}
}
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
google()
mavenLocal()
// maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.android.tools.build:gradle:7.2.1'
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'
}
}
allprojects {
allprojects { p ->
if (p.path.startsWith(":ydl-")) {
p.version = componentVersion
}
if (p.path.startsWith(":m-")) {
p.version = componentVersion
}
if (p.path.startsWith(":api:")) {
p.version = componentVersion
}
repositories {
//壹点灵android maven私服 开发版
maven {
url 'http://nexus.yidianling.com/repository/android/'
allowInsecureProtocol true
credentials {
username "admin"
password "fjoi#1+#@"
}
}
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
google()
maven {
url 'http://maven.aliyun.com/nexus/content/groups/public/'
allowInsecureProtocol true
}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
mavenLocal()
}
}
......@@ -56,26 +59,6 @@ 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 {
......@@ -88,27 +71,3 @@ subprojects {
}
}
}
apply plugin: 'modular-plugin'
modular {
compileSdkVersion 28
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
maven {
url 'http://nexus.yidianling.com/repository/AndroidReleases/'
credentials {
username "admin"
password "fjoi#1+#@"
}
}
}
}
ext {
dev_mode = true//组件发布的时候需要设置为false
ydl2PublishVersion = "0.2.0.20-wjy"
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.50",
"m-consultant" : "0.0.60.78",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.72",
"m-home" : "0.0.24.09",
"m-im" : "0.0.21.69",
"m-dynamic" : "0.0.7.80",
"m-article" : "0.0.0.11",
"m-muse" : "0.0.28.87",
"m-tests" : "0.0.24.24",
"m-course" : "0.0.43.39",
//-------------- 功能组件 --------------
//mdt 组件
"ydl-tuicore" : "0.0.25",
//第一步
"ydl-platform" : "0.0.41.54",
//第二步 若干
"ydl-webview" : "0.2.0.7",
"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-home-api" : "0.0.4.4",
]
ydl_app = [
appName : "壹点灵心理咨询",
applicationId: "com.cxzapp.yidianling",
......@@ -134,12 +98,6 @@ ext {
"xxpermission" : "com.hjq:xxpermissions:10.2",
"rxerrorhandler2" : "me.jessyan:rxerrorhandler:2.1.1",
//tools
// "dagger2" : "com.google.dagger:dagger:${version["dagger2SdkVersion"]}",
// "dagger2-android" : "com.google.dagger:dagger-android:${version["dagger2SdkVersion"]}",
// "dagger2-android-support" : "com.google.dagger:dagger-android-support:${version["dagger2SdkVersion"]}",
// "dagger2-compiler" : "com.google.dagger:dagger-compiler:${version["dagger2SdkVersion"]}",
// "dagger2-android-processor" : "com.google.dagger:dagger-android-processor:${version["dagger2SdkVersion"]}",
"androideventbus" : "org.simple:androideventbus:1.0.5.1",
"otto" : "com.squareup:otto:1.3.8",
"gson" : "com.google.code.gson:gson:2.8.5",
......@@ -208,33 +166,9 @@ ext {
"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.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:${ydl2PublishVersion}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.56@aar", //flutter aar
// "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号
"ydl-platform" : "com.ydl:ydl-platform:${ydl2PublishVersion}",
"ydl-tuicore" : "com.ydl:ydl-tuicore:${ydlPublishVersion["ydl-tuicore"]}",
//功能组件 <<--- 再发这些,发完改这里的版本号
"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: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.3",
"ydl-m-home-api" : "com.ydl:m-home-api:${ydlPublishVersion["m-home-api"]}",
"ydl-m-consultant-api" : "com.ydl:m-consultant-api:1.0.3",
"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",
]
}
#Fri Jul 22 17:29:41 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
......@@ -2,7 +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'
apply from: "../publish.gradle"
kapt {
arguments {
......@@ -44,7 +44,7 @@ android {
}
dependencies {
api fileTree(dir: 'libs', include: ['*.aar','*.jar'])
api fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
......@@ -59,17 +59,7 @@ dependencies {
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')
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
implementation rootProject.ext.dependencies["ydl-flutter-base"]
}
api project(':ydl-webview')
api project(':ydl-platform')
implementation project(':ydl-flutter-base')
}
......@@ -2,7 +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"
apply from: "../publish.gradle"
kapt {
arguments {
......@@ -71,19 +71,8 @@ dependencies {
api "com.ydl:ydl-av:1.4.4"
implementation 'com.volcengine:apm_insight:1.4.6.cn'
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-platform')
api project(':ydl-webview')
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-im-api"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
}
api project(':ydl-platform')
api project(':ydl-webview')
implementation project(":api:user")
implementation project(":api:im")
}
......@@ -48,6 +48,7 @@ import com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler
import com.ydl.ydl_av.voice.manager.YDLVoiceManager
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydlcommon.app.Apm
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
......@@ -318,6 +319,7 @@ class AudioHomeActivity :
if (err == 0 || err == 18) {
return
}
Apm.reportEvent("agora_android", "occur_error", "$err")
channelId?.let { YDLavManager.instances.callEndStatusUpdate(it, 4, "频道的错误回调信息$err") }
}
......@@ -369,8 +371,8 @@ class AudioHomeActivity :
override fun onRtcStats(stats: IRtcEngineEventHandler.RtcStats?) {
super.onRtcStats(stats)
writeAgoraLog("声网onRtcStats:users:${stats?.users}")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "声网onRtcStats:users:${stats?.users} channelId:${channelId}")
// AliYunRichLogsHelper.getInstance()
// .sendRichLog(AliYunLogConfig.AGORA, "声网onRtcStats:users:${stats?.users} channelId:${channelId}")
// 不需要移动端做离开房间逻辑,服务端会判断进行踢人逻辑
//因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断
// if (isConnectSuccess && null != stats?.users && stats.users == 1) {
......@@ -388,6 +390,7 @@ class AudioHomeActivity :
override fun onConnectionStateChanged(state: Int, reason: Int) {
super.onConnectionStateChanged(state, reason)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
Apm.reportEvent("agora_android", "rtc_connection_failure", "$state,$reason")
if (reason == 3) {
callEventSave("50", "通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason}")
writeAgoraLog("通话结束:网络连接被服务器中止 该情况现在是因为后端踢人逻辑,原因(${reason})")
......@@ -1063,6 +1066,7 @@ class AudioHomeActivity :
*/
voiceManage = YDLVoiceManager(this, BuildConfig.AGORA_APPID, mRtcEventHandler)
voiceManage?.init()
voiceManage?.getVoiceApi()?.setAudioProfile(Constants.AUDIO_PROFILE_DEFAULT,Constants.AUDIO_SCENARIO_CHATROOM_GAMING)
}
/**
......
......@@ -166,7 +166,7 @@ class YDLavManager {
LogUtil.e("[agora]呼叫${response?.calleeId}用户失败:${response?.response}")
AliYunRichLogsHelper.getInstance().sendRichLog(
AliYunLogConfig.AGORA,
"呼叫${response?.calleeId}用户失败:${response?.response}"
"呼叫${response?.calleeId}用户失败:${response?.response},${errorCode}"
)
val dimension = hashMapOf(
"call" to "call_fail",
......@@ -432,7 +432,7 @@ class YDLavManager {
override fun onFailure(msg: String?) {
if (msg != "LOGIN_ERR_ALREADY_LOGGED_IN") {
Apm.reportCustom("agora_login_error", msg ?: "", Exception(msg))
Apm.reportEvent("rtm_android", "connectionstate_error", msg ?: "")
}
LogUtil.e("[agora]实时消息登录失败:$msg")
writeAgoraLog(
......@@ -449,6 +449,7 @@ class YDLavManager {
}
})
} else {
Apm.reportEvent("rtm_android", "login_failure", "${it.code},${it.msg}")
LogUtil.e("声网token获取失败uid:" + userId + " error:" + it.msg)
LogHelper.getInstance()
.writeLogSync("声网token获取失败uid:" + userId + " error:" + it.msg)
......
......@@ -692,7 +692,9 @@ class ConsultantAudioHomeActivity :
* param mRtcEventHandler 事件回调(SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
*/
voiceManage = YDLVoiceManager(this, BuildConfig.AGORA_APPID, mRtcEventHandler)
voiceManage!!.init()
voiceManage?.init()
voiceManage?.getVoiceApi()?.setAudioProfile(Constants.AUDIO_PROFILE_DEFAULT,Constants.AUDIO_SCENARIO_CHATROOM_GAMING)
}
/**
......
......@@ -2,7 +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'
apply from: "../publish.gradle"
kapt {
arguments {
......@@ -69,30 +69,14 @@ dependencies {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-media')
api project(':ydl-platform')
api project(':m-audioim')
api project(":ydl-pay")
api project(':ydl-webview')
api project(':ydl-utils')
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:consultant")
implementation project(':api:confide')
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-media"]
api rootProject.ext.dependencies["m-audioim"]
api rootProject.ext.dependencies["ydl-pay"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
}
api project(':ydl-media')
api project(':ydl-platform')
api project(':m-audioim')
api project(":ydl-pay")
api project(':ydl-webview')
api project(':ydl-utils')
implementation project(":api:im")
implementation project(":api:user")
implementation project(":api:consultant")
implementation project(':api:confide')
}
......@@ -54,7 +54,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.io.UnsupportedEncodingException
import java.net.URLDecoder
import java.util.*
import kotlin.math.roundToInt
class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
......@@ -97,6 +96,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
var shouldShow: Boolean? = false
var uid: String? = null
var listen_free: Boolean = false
private var hasOnResume = false
fun showBottomSheetDialog(
activity: FragmentActivity,
jumpUrl: String,
......@@ -367,6 +367,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
fun onEventMainThread(event: ConfideDialogEvent) {
if(!hasOnResume) return
// 第一位表示拨打按钮,第二位代表再换一位按钮
val show = event.show
// if (show == 0) {
......@@ -568,8 +569,14 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
return false
}
override fun onPause() {
super.onPause()
hasOnResume = false
}
override fun onResume() {
super.onResume()
hasOnResume = true
if (doctorId.isNotBlank() && layoutCall.visibility == View.VISIBLE) {
onLoadDialStatus(doctorId)
}
......
......@@ -2,7 +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"
apply from: "../publish.gradle"
kapt {
arguments {
......@@ -43,29 +43,18 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'in.xiandan:count-down-timer:1.0.3'
kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
api rootProject.ext.dependencies["ydl-user-router"]
implementation(rootProject.ext.dependencies["ydl-ijkplayer-jjdxm"]) {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
if (rootProject.ext.dev_mode){
//开发时使用
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 {
//发布时使用
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
}
}
implementation project(":api:user")
implementation project(":api:im")
implementation project(":api:home")
implementation project(":api:consultant")
api project(":ydl-webview")
api project(":ydl-platform")
}
......@@ -82,6 +82,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
YDLImageCacheManager.showImage(this, url, imgView, ops)
}
override fun showPromptPayment(promptPaymentBean: PromptPaymentBean) {
}
override fun showImage(
url: String?,
imgView: ImageView,
......
......@@ -31,9 +31,11 @@ import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.base.config.ChannelConfig
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.ui.LogoLoadingView
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.DisplayUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
......@@ -42,8 +44,8 @@ import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.bean.FunctionWordConsultBean
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.dialog.ConsultSubPayDialog
import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import com.yidianling.consultant.listener.OnExpertClickListener
import com.yidianling.consultant.listener.OnFilterConfirmListener
......@@ -57,6 +59,7 @@ import com.yidianling.consultant.ui.view.FilterPopupWindow
import com.yidianling.consultant.ui.view.SortPopupWindow
import com.yidianling.consultant.ui.view.topView.RecommendListView
import com.yidianling.home.api.event.HomeModuleTabEvent
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -81,6 +84,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
var endTime = 0L
private var mIdssign1: String = "" // 列表埋点咨询师列表id拼接参数
var bottomWordDisposable: Disposable? = null
var isShow: Boolean = false
private lateinit var bottomWordlist: List<FunctionWordBean>
override fun layoutResId(): Int {
return R.layout.consultant_activity_expert_search_list
......@@ -125,6 +129,19 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
var consultSubPayDialog: ConsultSubPayDialog? = null
override fun showPromptPayment(promptPaymentBean: PromptPaymentBean) {
if (promptPaymentBean.toPayTime != 0L) {
//有订单
consultSubPayDialog = activity?.let { ConsultSubPayDialog(it, promptPaymentBean) }
consultSubPayDialog?.show()
consultSubPayDialog?.setOnDismissListener {
consultSubPayDialog = null
}
}
}
override fun showImage(
url: String?,
imgView: ImageView,
......@@ -306,6 +323,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
isShow = isVisibleToUser
if (isVisibleToUser && isResumed) {
startTime = System.currentTimeMillis()
} else {
......@@ -1465,6 +1483,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//
needRefresh = true
}
val orderToPayTime = SharedPreferencesEditor.getString("orderToPayTime")
val timeLimit = if (TextUtils.isEmpty(orderToPayTime)) {
0L
} else {
orderToPayTime.toLong()
}
if (isShow && !(consultSubPayDialog != null && consultSubPayDialog?.isShowing == true)) {
if (findRouteService(IUserService::class.java).isLogin() && System.currentTimeMillis() > timeLimit) {
getPresenter().fetchPromptPayment()
}
}
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_PAGE_VISIT)
ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit", "6")
}
......
......@@ -278,4 +278,18 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
}
})
}
@SuppressLint("CheckResult")
fun fetchPromptPayment() {
SearchApi.getSearchApi()
.promptPayment()
.compose(RxLifecycleUtils.bindToLifecycle(mView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { resp ->
mView.showPromptPayment(resp)
}
}
}
\ No newline at end of file
......@@ -4,10 +4,7 @@ import android.widget.ImageView
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.consultant.bean.FunctionWordConsultBean
import com.yidianling.consultant.model.bean.ExpertServiceItem
import com.yidianling.consultant.model.bean.Extras
import com.yidianling.consultant.model.bean.FunctionWordBean
import com.yidianling.consultant.model.bean.HeadData
import com.yidianling.consultant.model.bean.*
/**
* Created by zqk on 17-9-19.
......@@ -38,4 +35,6 @@ interface IExpertSearchView : IView {
*/
fun showImage(url : String?, imgView : ImageView, ops : SimpleImageOpConfiger)
fun showPromptPayment(promptPaymentBean: PromptPaymentBean)
}
\ No newline at end of file
package com.yidianling.consultant.dialog
import `in`.xiandan.countdowntimer.CountDownTimerSupport
import `in`.xiandan.countdowntimer.OnCountDownTimerListener
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.R
import com.yidianling.consultant.model.bean.PromptPaymentBean
import java.text.DecimalFormat
import java.text.SimpleDateFormat
import java.util.*
/**
* 咨询助理浮层
* Created by xj on 2019/10/30.
*/
class ConsultSubPayDialog(
private val mContext: Context,
private val promptPaymentBean: PromptPaymentBean
) : Dialog(mContext, R.style.dialog_default_style) {
var mTimer: CountDownTimerSupport? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.consultant_expert_consult_sub_pay_dialog)
val params = window.attributes
params.width = WindowManager.LayoutParams.WRAP_CONTENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
params.gravity = Gravity.CENTER
window.attributes = params
setCanceledOnTouchOutside(false)
initView();
}
private fun initView() {
var titleTv = findViewById<TextView>(R.id.tv_title)
var timeTv = findViewById<TextView>(R.id.tv_time)
titleTv.paint.isFakeBoldText = true
Glide.with(mContext)
.load(promptPaymentBean.smallImage).into(findViewById<ImageView>(R.id.avaterIv))
findViewById<TextView>(R.id.nameTv).text = promptPaymentBean.name
findViewById<TextView>(R.id.desTv).text = promptPaymentBean.productName
val decimalFormat = DecimalFormat("###.##")
val price = decimalFormat.format(promptPaymentBean.price)
findViewById<TextView>(R.id.priceTv).text = "¥$price"
var format = SimpleDateFormat("HH:mm:ss");
format.timeZone = TimeZone.getTimeZone("GMT+0");
var millisInFuture =
promptPaymentBean.toPayTime?.minus(promptPaymentBean.currentTime ?: 0) ?: 0
mTimer = CountDownTimerSupport(millisInFuture, 1000)
mTimer?.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) {
val time = format.format(millisUntilFinished)
timeTv.text = time
}
override fun onFinish() {
var nextShowTime =
System.currentTimeMillis() + ((promptPaymentBean.orderToPayTime ?: 1) * 1000)
SharedPreferencesEditor.putString("orderToPayTime", nextShowTime.toString())
dismiss()
}
override fun onCancel() {
// 倒计时手动停止
}
})
mTimer?.start()
findViewById<TextView>(R.id.tv_close).setOnClickListener {
var nextShowTime =
System.currentTimeMillis() + ((promptPaymentBean.orderToPayTime ?: 1) * 1000)
SharedPreferencesEditor.putString("orderToPayTime", nextShowTime.toString())
mTimer?.stop()
dismiss()
}
findViewById<View>(R.id.pay).setOnClickListener {
if (!TextUtils.isEmpty(promptPaymentBean.orderDetailUrl)) {
val h5Params = H5Params(promptPaymentBean.orderDetailUrl!!, null)
NewH5Activity.start(context, h5Params)
dismiss()
} else {
ToastUtil.toastShort("跳转失败")
dismiss()
}
var nextShowTime =
System.currentTimeMillis() + ((promptPaymentBean.orderToPayTime ?: 1) * 1000)
SharedPreferencesEditor.putString("orderToPayTime", nextShowTime.toString())
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
if (mTimer != null) {
mTimer?.stop()
mTimer = null
}
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.yidianling.consultant.bean.*
import com.yidianling.consultant.model.bean.ExpertBean
import com.yidianling.consultant.model.bean.FunctionWordBean
import com.yidianling.consultant.model.bean.HeadData
import com.yidianling.consultant.model.bean.PromptPaymentBean
import io.reactivex.Observable
import retrofit2.http.*
......@@ -112,4 +113,10 @@ interface SearchApi {
): Observable<BaseAPIResponse<Long>>
//搜索条件
@GET("consult/user/order/promptPayment")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun promptPayment(): Observable<BaseAPIResponse<PromptPaymentBean>>
}
\ No newline at end of file
package com.yidianling.consultant.model.bean
data class PromptPaymentBean(
var uid: String? = "",
var orderId: String? = "",
var toPayTime: Long? = 0,
var smallImage: String? = "",
var name: String? = "",
var price: Float? = 0.00f,
var productName: String? = "",
var doctorId: String? = "",
var productId: String? = "",
var createTime: String? = "",
var orderToPayTime: Long? = 0,
var orderDetailUrl: String? = "",
var currentTime: Long? = 0
)
......@@ -90,9 +90,11 @@ class ConsultAssistantDialogUtils private constructor() {
origin: String,
fromActivity: Boolean = false
) {
consultAssistantDialogFromHomePage?.dismiss()
consultAssistantFragmentDialog?.dismiss()
consultAssistantDialogFromMine?.dismiss()
if (!fromActivity){ // 不是咨询师二级列页的时候再所有的dialog dismiss
consultAssistantDialogFromHomePage?.dismiss()
consultAssistantFragmentDialog?.dismiss()
consultAssistantDialogFromMine?.dismiss()
}
when (origin) {
"home_index" -> {
showFromYdlHome(activity)
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/platform_dp_20" />
<solid android:color="#FF6B5D" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp"/>
<solid android:color="#F6F6F7" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp"/>
<solid android:color="#ffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="307dp"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
app:cardCornerRadius="12dp"
android:layout_centerInParent="true">
<RelativeLayout
android:layout_width="307dp"
android:layout_height="wrap_content"
android:background="@color/white"
android:layout_centerInParent="true">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/platform_dp_16"
android:text="你还有订单等待付款"
android:textColor="#1C1F28"
android:textSize="18sp" />
<LinearLayout
android:id="@+id/ll_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_4"
android:layout_below="@+id/tv_title"
android:layout_centerHorizontal="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="还剩"
android:textColor="#1C1F28"
android:textSize="@dimen/platform_sp_14" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="00:12:21"
android:layout_marginLeft="@dimen/platform_dp_2"
android:layout_marginRight="@dimen/platform_dp_2"
android:textColor="#FF9534"
android:textSize="@dimen/platform_sp_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="订单将关闭"
android:textColor="#1C1F28"
android:textSize="@dimen/platform_sp_14" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_content"
android:layout_below="@+id/ll_time"
android:layout_width="match_parent"
android:layout_height="66dp"
android:background="@drawable/consultant_bg_sub_pay"
android:layout_marginTop="@dimen/platform_dp_16"
android:layout_marginLeft="@dimen/platform_dp_16"
android:layout_marginRight="@dimen/platform_dp_16"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/platform_dp_12"
android:layout_marginRight="@dimen/platform_dp_8"
app:cardCornerRadius="4dp">
<ImageView
android:id="@+id/avaterIv"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/nameTv"
android:layout_marginTop="@dimen/platform_dp_11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#1C1F28"
android:maxLines="1"
android:ellipsize="end"
android:layout_marginRight="@dimen/platform_dp_12"
/>
<TextView
android:id="@+id/desTv"
android:layout_marginTop="@dimen/platform_dp_6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#62636F"
android:maxLines="1"
android:ellipsize="end"
android:layout_marginBottom="@dimen/platform_dp_11"
android:layout_marginRight="@dimen/platform_dp_12"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/pay"
android:layout_below="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_40"
android:padding="@dimen/platform_dp_9"
android:layout_marginLeft="@dimen/platform_dp_16"
android:layout_marginRight="@dimen/platform_dp_16"
android:gravity="center"
android:background="@drawable/consultant_bg_radius_red_20"
android:layout_marginTop="@dimen/platform_dp_28">
<TextView
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="@dimen/sp_16"
android:text="去付款"
/>
<TextView
android:id="@+id/priceTv"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="@dimen/sp_16"
android:layout_marginLeft="@dimen/platform_dp_5"
android:text="¥200"
/>
</LinearLayout>
<TextView
android:id="@+id/tv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="稍后再说"
android:layout_below="@+id/pay"
android:layout_centerHorizontal="true"
android:textSize="@dimen/platform_sp_14"
android:paddingLeft="@dimen/platform_dp_5"
android:paddingRight="@dimen/platform_dp_5"
android:paddingBottom="@dimen/platform_dp_3"
android:paddingTop="@dimen/platform_dp_3"
android:textColor="#62636F"
android:layout_marginTop="@dimen/platform_dp_16"
android:layout_marginBottom="@dimen/platform_dp_16"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
......@@ -45,4 +45,12 @@
</style>
<style name="dialog_default_style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/consultant_bg_sub_pay_dialog</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>
......@@ -2,7 +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"
apply from: "../publish.gradle"
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......@@ -51,35 +51,15 @@ dependencies {
api rootProject.ext.dependencies["ydl-user-router"]
compileOnly "com.ydl.aar:resource:0.0.1-ydl"
if (rootProject.ext.dev_mode){
//开发时使用
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")
api project(":ydl-pay")
implementation project(':ydl-flutter-base')
} else {
//发布时使用
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"]){
transitive = true
}
api rootProject.ext.dependencies["ydl-pay"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
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")
api project(":ydl-pay")
implementation project(':ydl-flutter-base')
implementation rootProject.ext.dependencies["ydl-flutter-base"]
}
}
......@@ -2,7 +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'
apply from: "../publish.gradle"
kapt {
arguments {
......@@ -72,33 +72,16 @@ dependencies {
implementation 'com.daimajia.numberprogressbar:library:1.4@aar'
implementation 'me.toptas.fancyshowcase:fancyshowcaseview:1.1.5'
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-webview')
api project(':ydl-platform')
api project(":ydl-pay")
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 {
//发布时使用
api rootProject.ext.dependencies["ydl-pay"]
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies["ydl-m-tests-api"]
compileOnly rootProject.ext.dependencies["ydl-m-course-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
}
api project(':ydl-webview')
api project(':ydl-platform')
api project(":ydl-pay")
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')
}
......@@ -2,7 +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'
apply from: "../publish.gradle"
kapt {
arguments {
......@@ -51,22 +51,11 @@ dependencies {
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
api rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
api project(":ydl-platform")
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
}
}
api project(":ydl-platform")
implementation project(":api:user")
implementation project(":api:dynamic")
implementation project(":api:fm")
implementation project(':ydl-media')
}
......@@ -3,6 +3,8 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply from: "../publish.gradle"
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
......@@ -62,37 +64,20 @@ dependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api "com.airbnb.android:lottie:3.4.0"
api(rootProject.ext.dependencies["ydl-device"])
implementation "com.alibaba:arouter-api:$arouter_api"
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation rootProject.ext.dependencies["ydl-user-router"]
if (rootProject.ext.dev_mode){
//开发时使用
implementation project(":api:consultant")
implementation project(":api:user")
implementation project(":api:tests")
implementation modularPublication('com.ydl:m-home-api')
implementation project(":api:im")
implementation project(':api:confide')
implementation project(':ydl-webview')
implementation project(':ydl-media')
implementation project(":ydl-platform")
} else {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-home-api"]
compileOnly rootProject.ext.dependencies['ydl-m-tests-api']
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api (rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
api rootProject.ext.dependencies["ydl-webview"]
api rootProject.ext.dependencies["ydl-media"]
api rootProject.ext.dependencies["ydl-media"]
}
implementation project(":api:consultant")
implementation project(":api:user")
implementation project(":api:tests")
implementation project(":api:home")
implementation project(":api:im")
implementation project(':api:confide')
implementation project(':ydl-webview')
implementation project(':ydl-media')
implementation project(":ydl-platform")
}
modular {
//模块包名
packageName "com.yidianling.home"
// 模块发布需要的参数
publish {
modules {
xlzx {
groupId = "com.ydl"
artifactId = "m-home-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
groupId = "com.ydl"
artifactId = "m-home-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
// 壹点灵/心理咨询 业务模块 API层 jar包的发布信息
groupId = "com.ydl"
artifactId = "m-home-api"
//开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
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.home
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.yidianling.home.test", appContext.packageName)
}
}
......@@ -1048,6 +1048,9 @@
"type": 10004
},
{
"type": 10005
},
{
"courseBean": {
"pageNum": 1,
"pageSize": 3,
......@@ -1303,7 +1306,7 @@
}
]
},
"type": 10005
"type": 10006
},
{
"askBean": {
......@@ -5568,8 +5571,9 @@
}
]
},
"type": 10006
"type": 10007
},
{ "type": 1000101},
{
"articleBean": {
"list": [
......@@ -5740,9 +5744,9 @@
}
]
},
"type": 10007
"type": 10008
},
{
"type": 10008
"type": 10009
}
]
\ No newline at end of file
......@@ -21,7 +21,6 @@ import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.model.bean.MeditationModuleBean
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_fragment.*
class MeditationTypeAdapter(
private val context: Context,
......
......@@ -102,4 +102,7 @@ class HomeBaseHttp {
return RxUtils.mapObservable(cmd).flatMap { getHomePagerApi().askFocus(it) }
}
fun getMeditationInfo(): Observable<BaseAPIResponse<MeditationModuleBean>> {
return getHomePagerApi().getMeditation()
}
}
\ No newline at end of file
......@@ -111,5 +111,8 @@ interface HomeBasePagerApi {
@POST("sq-active/focus")
fun askFocus(@FieldMap params: Map<String, String>): Observable<BaseResponse<AskResultBean>>
@GET("cms/meditation/index")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getMeditation(): Observable<BaseAPIResponse<MeditationModuleBean>>
}
\ No newline at end of file
package com.yidianling.home.ui.view
package com.yidianling.home.view
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.yidianling.home.R
import kotlinx.android.synthetic.ydl.home_common_title_view.view.*
import kotlinx.android.synthetic.main.home_common_title_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......
package com.yidianling.home.ui.view
package com.yidianling.home.view
import android.annotation.SuppressLint
import android.content.Context
......@@ -21,10 +21,8 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.home.adapter.MeditationViewPagerAdapter
import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.IHomeEvent
import com.yidianling.home.model.bean.MeditationModuleBean
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import kotlinx.android.synthetic.main.home_muse_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......@@ -33,7 +31,7 @@ import kotlinx.android.synthetic.ydl.home_muse_view.view.*
* @Company 壹点灵
* @date 2019/09/10
*/
class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEvent?) :
class HomeMuseView(private val mContext: Context) :
LinearLayout(mContext) {
private val meditationTitles = mutableListOf<String>()
......@@ -51,7 +49,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
)
layoutParams = params
View.inflate(mContext, R.layout.home_muse_view, this)
homeModuleMuseViewHomeCommonTitleView.setTitle(HomeViewConfig.getOrder().museTitle)
homeModuleMuseViewHomeCommonTitleView.setTitle("助眠·冥想")
}
fun initData(bean: MeditationModuleBean?) {
......
......@@ -7,7 +7,7 @@
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleMuseViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white_60">#99FFFFFF</color>
</resources>
......@@ -10,7 +10,14 @@
<item name="colorPrimaryDark">@color/platform_main_theme</item>
<item name="colorAccent">@color/platform_main_theme</item>
</style>
<style name="MeditationTabLayoutStyle" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">@color/white</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabIndicatorFullWidth">false</item>
<item name="tabSelectedTextColor">@color/white</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/white_60</item>
</style>
</resources>
\ No newline at end of file
package com.yidianling.home
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)
}
}
package com.yidianling.home.adapter
import android.content.Context
import android.graphics.Color
import android.media.MediaPlayer
import androidx.recyclerview.widget.RecyclerView
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.data.PlatformDataManager
import com.yidianling.home.R
import com.yidianling.home.constract.YdlHomeViewHolderConstract
import com.yidianling.home.event.HomeImpl
......@@ -17,6 +17,8 @@ import com.yidianling.home.model.bean.HomeConfideBean
import com.yidianling.home.model.bean.HomeConsultBean
import com.yidianling.home.model.bean.HomePagerDataBean
import com.yidianling.home.ui.view.*
import com.yidianling.home.view.HomeMuseView
import kotlinx.android.synthetic.main.home_muse_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......@@ -126,6 +128,11 @@ class YdlHomeAdapter(
YdlHomeViewHolderConstract.ASSUAGE_GRIEF_VIEW -> {
return HomeAssuageGriefViewHolder(HomeAssuageGriefView(mContext, homeEvent))
}
//壹点*冥想模块
YdlHomeViewHolderConstract.MUSE_VIEW -> {
return HomeMuseViewHolder(HomeMuseView(mContext))
}
//文章*阅读模块
YdlHomeViewHolderConstract.ARTICLE_VIEW -> {
return HomeArticleViewHolder(HomeArticleView(mContext, homeEvent))
......@@ -157,21 +164,6 @@ class YdlHomeAdapter(
list[position].headerBean?.askCategoryData
)
}
//倾诉*排解模块
// is HomeConfideViewHolder -> {
// if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) {
// val parm = holder.itemView.layoutParams
// parm.height = 0
// holder.itemView.layoutParams = parm
// } else {
// holder.confideViewView.setTitle(
// list[position].headerBean?.listenCategoryDate,
// confideSelectPosition
// )
// holder.confideViewView.setConfideExpertInfoView(list[position].confideBean?.body)
// confidePosition = position
// }
// }
//课程*成长模块
is HomeCourseViewHolder -> {
holder.courseViewView.initData(list[position].courseBean?.list)
......@@ -202,6 +194,17 @@ class YdlHomeAdapter(
is HomeTestViewHolder -> {
holder.testView.initData(list[position].testListBean)
}
is HomeMuseViewHolder -> {
holder.museViewView.video_view?.setOnInfoListener { mp, what, extra ->
if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) {
holder.museViewView.video_view?.setBackgroundColor(Color.TRANSPARENT)
}
true
}
holder.museViewView.video_view?.start()
holder.museViewView.initData(list[position].meditationBean)
}
}
}
......@@ -255,6 +258,10 @@ class YdlHomeAdapter(
*/
inner class HomeArticleViewHolder(val articleViewView: HomeArticleView) :
RecyclerView.ViewHolder(articleViewView)
/**
* 解忧*问答模块 ViewHolder
*/
inner class HomeMuseViewHolder(val museViewView: HomeMuseView) : RecyclerView.ViewHolder(museViewView)
/**
* 底部提示语模块 ViewHolder
......
......@@ -62,6 +62,6 @@ class IHomeContract {
*/
fun getCoupons(uid: String): Observable<BaseResponse<List<CouponBean>>>
fun getMeditation(): Observable<MeditationModuleBean>
}
}
\ No newline at end of file
......@@ -29,26 +29,32 @@ class YdlHomeViewHolderConstract {
* 测试模块
*/
val TEST_VIEW = 10004
/**
* 冥想模块
*/
val MUSE_VIEW = 10005
/**
* 课程*成长模块
*/
val COURSE_VIEW = 10005
val COURSE_VIEW = 10006
/**
* 解忧*问答模块
*/
val ASSUAGE_GRIEF_VIEW = 10006
val ASSUAGE_GRIEF_VIEW = 10007
/**
* 文章*阅读模块
*/
val ARTICLE_VIEW = 10007
val ARTICLE_VIEW = 10008
/**
* 底部提示语模块
*/
val FOOTER_VIEW = 10008
val FOOTER_VIEW = 10009
/**
* 倾诉*排解模块
*/
val CONFIDE_VIEW = 1000100
}
}
\ No newline at end of file
......@@ -2,9 +2,13 @@ package com.yidianling.home.model
import com.yidianling.home.http.HomeHttp
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.yidianling.home.constract.IHomeContract
import com.yidianling.home.http.HomeBaseHttp
import com.yidianling.home.model.bean.*
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......@@ -26,5 +30,9 @@ class HomeModelImpl: BaseHomeModelImpl(), IHomeContract.Model {
return HomeHttp.getInstance().getCoupons(uid)
}
override fun getMeditation(): Observable<MeditationModuleBean> {
return HomeBaseHttp.getInstance().getMeditationInfo().compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.onErrorReturn { MeditationModuleBean(true) }
}
}
\ No newline at end of file
......@@ -145,10 +145,15 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
if (dataBean.isRealEmpty || dataBean !is HomeAskBean) homeTempData.askBean else dataBean
mHomeAskBean = item.askBean
}
YdlHomeViewHolderConstract.MUSE_VIEW -> {
item.meditationBean =
if (dataBean.isRealEmpty || dataBean !is MeditationModuleBean) homeTempData.meditationBean else dataBean
}
YdlHomeViewHolderConstract.ARTICLE_VIEW -> {
item.articleBean =
if (dataBean.isRealEmpty || dataBean !is HomeArticleBean) homeTempData.articleBean else dataBean
}
}
return item
}
......@@ -220,6 +225,11 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
)
)
},
mModel.getMeditation()
.compose(RxUtils.applySchedulers(mView)).map {
//首页问答数据
homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.MUSE_VIEW))
},
mModel.askRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页问答数据
......@@ -243,7 +253,7 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
mView.homeDataFail(msg)
}
}, Action {
if (homeList.size != 9){
if (homeList.size != 10){
mView.homeDataFail("")
return@Action
}
......
......@@ -346,23 +346,10 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser && isResumed) {
showConsultAssistantDialog()
} else {
hideConsultAssistantDialog()
}
if (isVisibleToUser && isResumed) {
onResume()
}
}
private fun showConsultAssistantDialog() {
ModularServiceManager.provide(IConsultantService::class.java)
.showConsultAssistantDialog(mActivity!!)
}
private fun hideConsultAssistantDialog() {
ModularServiceManager.provide(IConsultantService::class.java).hideConsultAssistantDialog()
}
override fun onStop() {
super.onStop()
endTime = System.currentTimeMillis()
......@@ -381,10 +368,8 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
}
mPresenter?.prepareCoupon(mActivity!!)
mPresenter?.prepareCoupon(mActivity)
//走咨询助理浮层展示逻辑,是否展示由内部条件与接口判断
showConsultAssistantDialog()
}
}
......
......@@ -14,7 +14,8 @@ import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.HomeImpl
import com.yidianling.home.model.bean.*
import com.yidianling.home.ui.view.*
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import com.yidianling.home.view.HomeMuseView
import kotlinx.android.synthetic.main.home_muse_view.view.*
/**
......@@ -178,7 +179,7 @@ class YdlHomeAdapter(private val mContext: Context,
}
//壹点*冥想模块
HomeViewConfig.getOrder().museIndex -> {
return HomeMuseViewHolder(HomeMuseView(mContext, homeEvent),viewType)
return HomeMuseViewHolder(HomeMuseView(mContext), viewType)
}
//底部提示语模块
else -> {
......@@ -301,7 +302,7 @@ class YdlHomeAdapter(private val mContext: Context,
/**
* 文章*阅读模块 ViewHolder
*/
inner class HomeMuseViewHolder(val museViewView: HomeMuseView,val viewType:Int) : RecyclerView.ViewHolder(museViewView)
inner class HomeMuseViewHolder(val museViewView: HomeMuseView, val viewType:Int) : RecyclerView.ViewHolder(museViewView)
/**
* 文章*阅读模块 ViewHolder
......
......@@ -22,6 +22,6 @@ class IHomeContract {
*/
fun museRequest(): Observable<MuseModuleBean>
fun getMeditation():Observable<MeditationModuleBean>
fun getMeditation(): Observable<MeditationModuleBean>
}
}
\ No newline at end of file
......@@ -39,8 +39,5 @@ class HomeHttp {
return getHomePagerApi().getMuseData()
}
fun getMeditationInfo():Observable<BaseAPIResponse<MeditationModuleBean>>{
return getHomePagerApi().getMeditation()
}
}
\ No newline at end of file
......@@ -23,8 +23,5 @@ interface HomePagerApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getMuseData(): Observable<BaseAPIResponse<MuseModuleBean>>
@GET("cms/meditation/index")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getMeditation(): Observable<BaseAPIResponse<MeditationModuleBean>>
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yidianling.home.model
import com.ydl.ydlcommon.data.http.RxUtils
import com.yidianling.home.constract.IHomeContract
import com.yidianling.home.http.HomeBaseHttp
import com.yidianling.home.http.HomeHttp
import com.yidianling.home.model.bean.MeditationModuleBean
import com.yidianling.home.model.bean.MuseModuleBean
......@@ -28,7 +29,7 @@ class HomeModelImpl : BaseHomeModelImpl(), IHomeContract.Model {
}
override fun getMeditation(): Observable<MeditationModuleBean> {
return HomeHttp.getInstance().getMeditationInfo().compose(RxUtils.resultJavaData())
return HomeBaseHttp.getInstance().getMeditationInfo().compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.onErrorReturn { MeditationModuleBean(true) }
}
......
......@@ -47,10 +47,9 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.home_muse_view.*
import kotlinx.android.synthetic.ydl.home_fragment.*
import kotlinx.android.synthetic.ydl.home_fragment.tab_layout
import kotlinx.android.synthetic.ydl.home_muse_view.*
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import java.util.concurrent.TimeUnit
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleArticleViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleAssuageGriefViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleConfideViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleCourseViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -4,7 +4,7 @@
android:layout_height="wrap_content"
>
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleIntelligentViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -4,7 +4,7 @@
android:layout_height="wrap_content"
>
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleIntelligentViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white_60">#99FFFFFF</color>
<color name="white">#FFFFFF</color>
<color name="home_confide_61CEAC">#61CEAC</color>
......
......@@ -11,13 +11,5 @@
<item name="android:windowIsTranslucent">true</item>
</style>
<style name="MeditationTabLayoutStyle" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">@color/white</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabIndicatorFullWidth">false</item>
<item name="tabSelectedTextColor">@color/white</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/white_60</item>
</style>
</resources>
\ No newline at end of file
......@@ -2,7 +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"
apply from: "../publish.gradle"
kapt {
arguments {
......@@ -63,31 +63,20 @@ dependencies {
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
api 'com.tencent.tbs.tbssdk:sdk:43903'
if (rootProject.ext.dev_mode){
//开发时使用
api project(':ydl-webview')
api project(':ydl-platform')
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 {
//发布时使用
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
compileOnly rootProject.ext.dependencies["ydl-m-tests-api"]
compileOnly rootProject.ext.dependencies["ydl-m-course-api"]
compileOnly rootProject.ext.dependencies["ydl-m-fm-api"]
compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api rootProject.ext.dependencies["ydl-webview"]
api(rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
implementation('com.netease.yunxin.kit:call-ui:1.5.9-SNAPSHOT') {
exclude group: "com.netease.nimlib", module: "avsignalling"
exclude group: "com.netease.nimlib", module: "basesdk"
}
implementation "com.netease.nimlib:avsignalling:9.1.1"
api project(':ydl-webview')
api project(':ydl-platform')
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')
}
......@@ -10,6 +10,7 @@ import androidx.annotation.DrawableRes;
import com.alibaba.fastjson.JSON;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.SDKOptions;
import com.netease.nimlib.sdk.auth.LoginInfo;
import com.netease.nimlib.sdk.mixpush.MixPushMessageHandler;
import com.netease.nimlib.sdk.mixpush.NIMPushClient;
......@@ -42,6 +43,7 @@ import de.greenrobot.event.EventBus;
public class NimApplication {
private String appKey;
private NimApplication() {
}
......@@ -54,10 +56,16 @@ public class NimApplication {
return InstanceHolder.nimApplication;
}
public String getAppKey() {
return appKey;
}
public void initIm(Application app, Class activity, IMInitConfigBean configBean) {
IMCache.setContext(app);
// 初始化云信SDK
NIMClient.init(app, loginInfo(), NimSDKOptionConfig.prepareSDKOptions(app,activity,configBean));
SDKOptions sdkOptions = NimSDKOptionConfig.prepareSDKOptions(app, activity, configBean);
appKey = sdkOptions.appKey;
NIMClient.init(app, loginInfo(), sdkOptions);
// 以下逻辑只在主进程初始化时执行
if (NIMUtil.isMainProcess(app)) {
......
......@@ -31,7 +31,7 @@ import java.io.IOException;
* 云信sdk 自定义的SDK选项设置
*/
class NimSDKOptionConfig {
public class NimSDKOptionConfig {
static SDKOptions prepareSDKOptions(Context context, Class activity, IMInitConfigBean configBean) {
SDKOptions options = new SDKOptions();
......@@ -93,7 +93,7 @@ class NimSDKOptionConfig {
* 配置 APP 保存图片/语音/文件/log等数据的目录
* 这里示例用SD卡的应用扩展存储目录
*/
static String getAppCacheDir(Context context) {
public static String getAppCacheDir(Context context) {
String storageRootPath = null;
try {
// SD卡应用扩展存储区(APP卸载后,该目录下被清除,用户也可以在设置界面中手动清除),请根据APP对数据缓存的重要性及生命周期来决定是否采用此缓存目录.
......
......@@ -17,6 +17,7 @@ import com.netease.nimlib.sdk.msg.model.IMMessage
import com.netease.nimlib.sdk.msg.model.RevokeMsgNotification
import com.netease.nimlib.sdk.team.TeamServiceObserver
import com.netease.nimlib.sdk.team.model.Team
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.utils.LogUtil
import com.yidianling.im.api.bean.IMRegisterObserverCustomNotificationCallBack
import com.yidianling.im.api.event.AccountChangeEvent
......@@ -91,6 +92,9 @@ class ImObserversHelper {
if (code.wontAutoLoginForever()) {
EventBus.getDefault().post(AccountChangeEvent(1))
}
if (code == StatusCode.LOGINED) {
NimUICallInit.initNim2(BaseApp.getApp())
}
}
private var messageRevokeObserver: Observer<RevokeMsgNotification> = NimMessageRevokeObserver()
......
......@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
import com.yidianling.im.session.extension.CustomAttachmentFilter;
import com.yidianling.nimbase.common.ToastHelper;
import com.netease.nimlib.sdk.NIMClient;
......@@ -120,6 +121,9 @@ public class NIMInitManager{
return true;
}
}
if(message.getMsgType() == MsgTypeEnum.nrtc_netcall){
return true;
}
return false;
}
});
......
package com.yidianling.im.helper;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.TextUtils;
import com.netease.lava.nertc.sdk.NERtcEx;
import com.netease.lava.nertc.sdk.NERtcOption;
import com.netease.lava.nertc.sdk.video.NERtcEncodeConfig;
import com.netease.lava.nertc.sdk.video.NERtcVideoConfig;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.yunxin.nertc.nertcvideocall.bean.InvitedInfo;
import com.netease.yunxin.nertc.ui.CallKitNotificationConfig;
import com.netease.yunxin.nertc.ui.CallKitUI;
import com.netease.yunxin.nertc.ui.CallKitUIOptions;
import com.netease.yunxin.nertc.ui.extension.SelfConfigExtension;
import com.netease.yunxin.nertc.ui.service.DefaultIncomingCallEx;
import com.ydl.ydlcommon.modular.ModularServiceManagerKt;
import com.ydl.ydlcommon.utils.log.XLog;
import com.yidianling.im.R;
import com.yidianling.im.config.NimApplication;
import com.yidianling.im.config.NimSDKOptionConfig;
import com.yidianling.im.http.ImHttpImpl;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.api.service.IUserService;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
public class NimUICallInit {
private static boolean hasReportSupportLine = false;
private static String curChannelName;
public static void initNim2(Context context) {
UserResponseBean.UserInfo userInfo = ModularServiceManagerKt.findRouteService(IUserService.class).getUserInfo();
if (userInfo == null) return;
String userId = userInfo.getUid();
android.util.Log.e("qwert", userId);
String appKey = NimApplication.getInstance().getAppKey();
CallKitUIOptions options = new CallKitUIOptions.Builder()
// 必要:音视频通话 sdk appKey,用于通话中使用
.rtcAppKey(appKey)
.logRootPath(NimSDKOptionConfig.getAppCacheDir(context) + "/yidianling")
// 必要:当前用户 AccId
.currentUserAccId(userId)
.currentUserRtcUId(Long.parseLong(userId))
// 通话接听成功的超时时间单位 毫秒,默认30s
.timeOutMillisecond(30 * 1000L)
.rtcCallExtension(new SelfConfigExtension(){
@Override
public void configVideoConfig() {
NERtcVideoConfig videoConfig = new NERtcVideoConfig();
videoConfig.frameRate = NERtcEncodeConfig.NERtcVideoFrameRate.FRAME_RATE_FPS_15;
videoConfig.bitrate = 600;
videoConfig.width = 640;
videoConfig.height = 480;
NERtcEx.getInstance().setLocalVideoConfig(videoConfig);
}
})
// 此处为 收到来电时展示的 notification 相关配置,如图标,提示语等。
.notificationConfigFetcher(invitedInfo -> new CallKitNotificationConfig(R.drawable.avchat_imcoming_call))
// 收到被叫时若 app 在后台,在恢复到前台时是否自动唤起被叫页面,默认为 true
.resumeBGInvitation(true)
.incomingCallEx(new DefaultIncomingCallEx() {
@Override
public boolean onIncomingCall(@NotNull InvitedInfo invitedInfo) {
XLog.INSTANCE.i("incomingCallEx", invitedInfo.toString());
curChannelName = invitedInfo.channelName;
return super.onIncomingCall(invitedInfo);
}
})
.enableOrder(false)
// .p2pAudioActivity(TestActivity.class)
// .p2pVideoActivity(TestActivity.class)
// 请求 rtc token 服务,若非安全模式则不需设置
.rtcTokenService((uid, callback) -> requestRtcToken(uid, callback)) // 自己实现的 token 请求方法
// 设置初始化 rtc sdk 相关配置,按照所需进行配置
.rtcSdkOption(new NERtcOption())
// 呼叫组件初始化 rtc 范围,true-全局初始化,false-每次通话进行初始化以及销毁
// 全局初始化有助于更快进入首帧页面,当结合其他组件使用时存在rtc初始化冲突可设置false
.rtcInitScope(true)
.build();
// 若重复初始化会销毁之前的初始化实例,重新初始化
CallKitUI.init(context.getApplicationContext(), options);
}
@SuppressLint("CheckResult")
private static void requestRtcToken(long uid, RequestCallback<String> callback) {
Map<String, String> body = new HashMap<>();
if (curChannelName != null) {
body.put("channelName", curChannelName);
}
body.put("uid", String.valueOf(uid));
ImHttpImpl.Companion.getInstance().getImApi().nim2Token(body)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe(resp -> {
curChannelName = null;
if (resp.code == 200) {
callback.onSuccess(resp.data);
} else {
XLog.INSTANCE.i("requestRtcToken", resp.msg);
callback.onFailed(resp.code);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
curChannelName = null;
callback.onException(throwable);
}
});
}
@SuppressLint("CheckResult")
public static void reportSupportLine() {
if (hasReportSupportLine) return;
Map<String, Object> report = new HashMap<>();
report.put("callKeys", new String[]{"netease_app2"});//支持云信2.0呼叫通话
ImHttpImpl.Companion.getInstance().getImApi()
.reportSupportLine(report)
.subscribeOn(Schedulers.io())
.subscribe(resp -> {
if (TextUtils.equals(resp.code, "200")) {
hasReportSupportLine = true;
}
});
}
}
......@@ -5,8 +5,12 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.im.api.bean.*
import com.yidianling.im.bean.*
import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.api.bean.MsgDetail
import com.yidianling.im.api.bean.UpdateStatusBean
import com.yidianling.im.bean.MsgData
import com.yidianling.im.bean.MsgHome
import com.yidianling.im.bean.SystemMsgBean
import com.yidianling.im.ui.page.fragment.bean.ChatModelBean
import com.yidianling.im.ui.page.fragment.bean.InteractBean
import com.yidianling.im.ui.page.fragment.bean.NoticeItemBean
......@@ -21,6 +25,14 @@ import retrofit2.http.*
*/
interface ImApi {
@POST("call/v2/dial/yunxin")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun nim2Token(@Body body: Map<String, String>): Observable<BaseResponse<String?>>
@POST("counselor/device/callline")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun reportSupportLine(@Body body: Map<String, @JvmSuppressWildcards Any>): Observable<BaseAPIResponse<Any?>>
//获得消息列表
@FormUrlEncoded
@POST("sms/list")
......
......@@ -41,7 +41,7 @@ class ImHttpImpl private constructor() : ImHttp {
private var imApi: ImApi? = null
private var imJavaApi: ImApi? = null
private fun getImApi(): ImApi {
fun getImApi(): ImApi {
if (imApi == null) {
imApi = YDLHttpUtils.obtainApi(ImApi::class.java)
}
......
......@@ -27,6 +27,7 @@ import com.yidianling.fm.api.service.IFMService
import com.yidianling.im.api.bean.ReceiveRedPacketParam
import com.yidianling.im.api.service.IImService
import com.yidianling.im.config.constants.UserPreferences
import com.yidianling.im.helper.NimUICallInit
import com.yidianling.im.preference.IMCache
import com.yidianling.tests.api.service.ITestsApiService
import com.yidianling.uikit.api.NimUIKit
......@@ -202,6 +203,8 @@ object ImIn {
IMCache.setAccount(uid)
//此代码进行登录,并且会进行回调
NimUIKit.login(info, callback);
NimUICallInit.reportSupportLine()//登录nim时上报支持的线路
}
fun loginIm(uid : String,pwd : String,callback: RequestCallback<LoginInfo>){
......
......@@ -44,6 +44,7 @@ import com.yidianling.im.session.extension.CustomAttachConsult;
import com.yidianling.im.session.extension.CustomAttachConsultCallStatus;
import com.yidianling.im.session.extension.CustomAttachConsultPerfectData;
import com.yidianling.im.session.extension.CustomAttachConsultSubScript;
import com.yidianling.im.session.extension.CustomAttachConsultSubScriptPayment;
import com.yidianling.im.session.extension.CustomAttachLingXiJumpConfideList;
import com.yidianling.im.session.extension.CustomAttachLingxiAnswerQuestion;
import com.yidianling.im.session.extension.CustomAttachLingxiFirstQuestion;
......@@ -85,6 +86,7 @@ import com.yidianling.im.session.viewholder.MsgViewHolderConfirmOrder;
import com.yidianling.im.session.viewholder.MsgViewHolderConsult;
import com.yidianling.im.session.viewholder.MsgViewHolderConsultCallStatus;
import com.yidianling.im.session.viewholder.MsgViewHolderConsultSubScribe;
import com.yidianling.im.session.viewholder.MsgViewHolderConsultSubScribePayment;
import com.yidianling.im.session.viewholder.MsgViewHolderCustomTip;
import com.yidianling.im.session.viewholder.MsgViewHolderCustomerServiceCard;
import com.yidianling.im.session.viewholder.MsgViewHolderDefCustom;
......@@ -479,6 +481,7 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachLingxiAnswerQuestion.class, MsgViewHolderLingxiAnswerQuestion.class);//灵犀2.0-回答问题
NimUIKit.registerMsgItemViewHolder(CustomAttachLingxiFirstQuestion.class, MsgViewHolderLingxiFirstQuestion.class);//灵犀2.0-首问语
NimUIKit.registerMsgItemViewHolder(CustomAttachLingXiJumpConfideList.class, MsgViewHolderLingXiJumpConfideList.class);//灵犀2.0-倾诉列表
// NimUIKit.registerMsgItemViewHolder(CustomAttachConsultSubScriptPayment.class, MsgViewHolderConsultSubScribePayment.class);//咨询预约支付
}
......
package com.yidianling.im.session.extension;
import com.alibaba.fastjson.JSONObject;
/**
* 确认预约时间
* Created by harvie on 2017/1/10.
*/
public class CustomAttachConsultSubScriptPayment extends CustomAttachment {
private String TITLE = "title";
private String PRODUCT_NAME = "productName";
private String CONSULT_DATE = "bookingTime";
private String CONSULT_TIME = "consultDuration";
private String CONSULT_TYPE = "serviceType";
private String FLAG = "flag";
private String URL = "url";
private String IS_PACKAGE = "isPackage";
private static final String NEWSORDERID = "newOrderId";//用于跳转新版订单详情
private static final String STATUS = "status";//状态,1代表已确认,0代表待确认
private String FROM_CONTENT = "from_content";
private String TO_CONTENT = "to_content";
public String title; //自定义消息标题
public String productName;//商品名称
public String consultDate;//咨询时间
public String consultTime;//咨询时长
public String consultType;//咨询方式
public String url;//跳转url
public int flag;//0 未确认 1已确认
public byte isPackage = 0; //是否套餐 1单次 2套餐
/***新订单*/
public String newOrderId;
public String from_content;
public String to_content;
public CustomAttachConsultSubScriptPayment() {
super(CustomAttachmentType.TYPE_CONSULT_SUBSCRIBE_PAY);
}
@Override
protected void parseData(JSONObject data) {
title = data.getString(TITLE);
productName = data.getString(PRODUCT_NAME);
consultDate = data.getString(CONSULT_DATE);
consultTime = data.getString(CONSULT_TIME);
consultType = data.getString(CONSULT_TYPE);
url = data.getString(URL);
flag = data.getInteger(FLAG);
isPackage = data.getByte(IS_PACKAGE);
this.newOrderId = data.getString(NEWSORDERID);
from_content = data.getString(FROM_CONTENT);
to_content = data.getString(TO_CONTENT);
}
@Override
protected JSONObject packData() {
JSONObject data = new JSONObject();
data.put(TITLE,title);
data.put(PRODUCT_NAME,productName);
data.put(CONSULT_DATE,consultDate);
data.put(CONSULT_TIME,consultTime);
data.put(CONSULT_TYPE,consultType);
data.put(URL,url);
data.put(FLAG,flag);
data.put(IS_PACKAGE,isPackage);
data.put(NEWSORDERID, newOrderId);
data.put(FROM_CONTENT, from_content);
data.put(TO_CONTENT, to_content);
return data;
}
}
This diff is collapsed. Click to expand it.
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