Commit f52af397 by ydl

backup

parent 1847e95e
ext {
kotlin_version = "1.3.21"
dev_mode = true
dev_mode = false
ydl_app = [
appName : "心理咨询壹点灵",
......@@ -42,29 +42,29 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.47.2",
"m-confide" : "0.0.47.4",
"m-consultant" : "0.0.56.4",
"m-fm" : "0.0.28",
"m-user" : "0.0.56",
"m-user" : "0.0.57.1",
"m-home" : "0.0.20",
"m-im" : "0.0.13.2",
"m-im" : "0.0.13.3",
"m-dynamic" : "0.0.5.9",
"m-muse" : "0.0.26",
"m-tests" : "0.0.22.1",
"m-course" : "0.0.40.4",
"m-course" : "0.0.40.5",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.1.1",
"m-confide-api" : "0.0.1.4",
"m-consultant-api": "0.0.5.2",
"m-course-api" : "0.0.3.2",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.2",
"m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.2",
"m-user-api" : "0.0.9",
"m-user-api" : "0.0.10.15",
"m-home-api" : "0.0.4.1",
"m-im-api" : "0.0.12.15",
"m-im-api" : "0.0.12.17",
"m-dynamic-api" : "0.0.3.7",
//-------------- 功能组件 --------------
......@@ -102,15 +102,15 @@ ext {
"m-course" : "0.0.34.10",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.1.1",
"m-confide-api" : "0.0.1.4",
"m-consultant-api": "0.0.5.2",
"m-course-api" : "0.0.3.2",
"m-course-api" : "0.0.3.5",
"m-fm-api" : "0.0.2",
"m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.2",
"m-user-api" : "0.0.9",
"m-user-api" : "0.0.10.15",
"m-home-api" : "0.0.4.1",
"m-im-api" : "0.0.12.15",
"m-im-api" : "0.0.12.17",
"m-dynamic-api" : "0.0.3.7",
//-------------- 功能组件 --------------
......@@ -120,7 +120,7 @@ ext {
"ydl-webview" : "0.0.37.1",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"ydl-pay" : "0.0.17.2",
"m-audioim" : "0.0.46.1",
"ydl-flutter-base": "0.0.10",
......
......@@ -79,12 +79,16 @@ dependencies {
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation 'com.alibaba:fastjson:1.2.38'
implementation 'com.ydl:nim-base:1.0.4' // ConfideWebServiceImpl用了里面的网络判断
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')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-confide-api')
......@@ -92,6 +96,8 @@ dependencies {
//发布时使用
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
}
......
......@@ -15,7 +15,7 @@ class ConfideConnectResponse{
var payTitle : String? = null //支付标题
var listenOrderPrice : Double? = null //订单金额
var userBaseInfoRespDto : UserBaseInfoRespDto?=null
var coupon :CouponData? = null //优惠信息
var coupon : CouponData? = null //优惠信息
}
class DialDetail{
......
package com.ydl.confide.home.constants;
/**
* 一些常量字符串
* Created by hgw on 2017/5/20.
*/
public class FinalString {
//绑定手机提示语
public static final String BIND_PHONE = "为了及时接收消息通知,请立即绑定手机";
//用户对用户发起第一次私聊做安全提示
public static final String FIRST_CHAT_TIP = "对方非认证咨询师,请注意保护隐私,以免造成信息泄露";
public static final String MESSAGE_IN_NUM="请注意自我保护!向陌生人发送联系方式,隐私存在被传播泄漏风险,平台内所有联系方式均对双方匿名显示";
public static final String CALL_PHONE = "\n400-114-1010\n(服务时间 早8:30-凌晨2:00)";
//连接倾听未绑定手机提示
public static final String TEL_BINDPHONE = "电话连接需要绑定手机哦~";
}
package com.ydl.confide.home.modular.service
import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.support.v4.app.DialogFragment
import android.text.TextUtils
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.webview.TellData
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.utils.YDLCacheUtils
/**
* Created by haorui on 2019-12-11 .
......@@ -39,6 +49,67 @@ class ConfdieServiceImpl : IConfideService {
context.startActivity(intent)
}
override fun connectionJava(id: Int, type: Int, activity: Activity, tellData: String?, callType: String?) {
var myTellData: TellData? = if (tellData == null ) null else Gson().fromJson(tellData, TellData::class.java)
ConfideWebServiceImpl().connectionJava(id, type, activity, myTellData, callType)
}
override fun ydlAvManagerLogin(uid: String?) {
YDLavManager.instances.login(uid)
}
override fun startCondifeHomePage(context: Context, isSplash: Boolean) {
val intent1 = Intent(context, ConfideHomeActivity::class.java)
intent1.putExtra("isSplash", isSplash)
intent1.flags = Intent.FLAG_ACTIVITY_NEW_TASK
context.startActivity(intent1)
}
override fun initYdlavManager(app: Application) {
var avManagerKey = ""
if (BaseApp.instance.getGlobalConfig().appDebug) {
val appEnv = BaseApp.instance.getGlobalConfig().appEnv
//debug包根据url判断使用正式或者测试key
val cacheAppEnv = YDLCacheUtils.getCacheApi()
if (!TextUtils.isEmpty(cacheAppEnv)) {
if (YDLConstants.ENV_TEST == cacheAppEnv) {
avManagerKey = "13b1536698f64905a1e7e5bb978ba821"
} else {
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
}
} else {
if (YDLConstants.ENV_TEST == appEnv || YDLConstants.ENV_AUTO_TEST == appEnv) {
avManagerKey = "13b1536698f64905a1e7e5bb978ba821"
} else {
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
}
}
} else {
//release包始终使用正式key
avManagerKey = "3387e9b251f3491e9221a9877e8f7830"
}
YDLavManager.instances.init(app, avManagerKey)
}
override fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?) {
val dialog = AxbConfirmDialog(activity, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
phoneNumber?.let {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber!!))
activity?.startActivity(phoneIntent)
}
}
override fun onClose() {
}
})
dialog.show()
}
override fun closePlayer() {
}
......
package com.ydl.confide.home.modular.service
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.text.TextUtils
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.audioim.IntentConstants
import com.ydl.audioim.bean.ExpertInfoBean
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.home.bean.ConnectParamJava
import com.ydl.confide.home.constants.FinalString
import com.ydl.confide.home.http.ConfideHomeDataManager
import com.ydl.webview.*
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.nimbase.common.util.sys.NetworkUtil
import com.yidianling.user.api.service.IUserService
import com.yidianling.ydl_pay.pay.payDialog.CallBack
import com.yidianling.ydl_pay.pay.payDialog.ConfidePayParams
import com.yidianling.ydl_pay.pay.payDialog.PayDialog
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
* Created by haorui on 2019-10-10.
* Des: 对应主项目中的WebServiceImpl
*/
class ConfideWebServiceImpl{
//倾诉支付弹窗
fun confidePayDialog(id: Int?, type : Int?, activity: Activity, confidePay : ConfidePayParams, callType:String?){
PayDialog(activity)
.setCallback(object : CallBack {
override fun onSuccess() {
//支付成功,直接拨打
if (TextUtils.isEmpty(confidePay.confideUrl)){
connectionJava(id?:0,type?:1,activity,null,callType)
}else{
//倾诉订单列表页面过来,会有confideUrl值,则直接跳转此url
NewH5Activity.start(activity, H5Params(confidePay.confideUrl!!,""))
}
}
override fun onError() {
}
})
.show(confidePay)
}
//java版axb和声网接口
@SuppressLint("CheckResult")
fun connectionJava(id: Int, type : Int, activity: Activity, tellData : TellData?, callType:String?){
ConfideHomeDataManager.getHttp().connectionJava(ConnectParamJava(""+id, ""+type,callType))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if ("200".equals(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
callAgora(activity,id,it.data!!.dialDetail!!.agoraExpertInfo!!,it.data.callId?:"0",it.data.listenOrderId?:0L,tellData)
}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)
}
override fun onClose() {
}
})
dialog.show()
}
}else{
ToastHelper.show(it.data?.dialDetail?.dialReason?:"连接失败")
}
}else{
ToastHelper.show(it.data?.dialDetail?.dialReason?:"连接失败")
}
}else{
ToastHelper.show(it.msg)
}
}, {
ToastHelper.show(it.message?:"连接失败")
})
}
//启动声网电话
private fun callAgora(activity: Activity, confideId:Int, expertInfo : ExpertInfoBean, call_id:String, relation_id:Long, tellData: TellData?){
//3G以下或者其他不确定异常能判断出来的
if (!NetworkUtil.isWifiOr3G(activity)) {
CommonDialog.create(activity)
.setTitle("温馨提示")
.setMessage("当前网络异常\n请使用普通电话拨打?")
.setLeftOnclick("暂不拨打") {
}
.setRightClick("普通电话拨号") {
connectionJava(confideId,1,activity,tellData,"0")
}
.show()
} else {
if (expertInfo.listenerStatus != 1) {
ToastHelper.show("老师正在通话中,请稍后重试")
return
}
if (TextUtils.isEmpty(expertInfo.channelId)) {
ToastHelper.show("服务端返回参数异常,请刷新页面后重试")
return
}
if(expertInfo.remainingTime?.remainingTime==null){
expertInfo.remainingTime = ExpertInfoBean.ListenRemainingTime(expertInfo.totalDuration);
}
ARouter.getInstance().build("/av/AudioHomeActivity")
.withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl)
.withString(IntentConstants.INTENT_EXPERT_NAME, expertInfo.expertName)
.withString(IntentConstants.INTENT_EXPERT_TIPS, expertInfo.expertTips)
.withString(IntentConstants.INTENT_ROOM_ID, expertInfo.channelId)
.withString(IntentConstants.INTENT_REMAIN_TIME, expertInfo.remainingTime.remainingTime)
.withString(IntentConstants.INTENT_CALL_ID, call_id)
.withString(IntentConstants.INTENT_RELATION_ID, "${relation_id}")
.withString(IntentConstants.INTENT_TOKEN, expertInfo.token)
.withString(IntentConstants.INTENT_SIGNAL_TOKEN, expertInfo.signalToken)
.withString(IntentConstants.INTENT_LISTENER_UID, expertInfo.listenerUid)
.withString(IntentConstants.INTENT_TOTAL_DURATION, expertInfo.totalDuration)
.withString(IntentConstants.INTENT_COMMENT_URL, expertInfo.commentUrl)
.withString(IntentConstants.INTENT_LISTEN_ID, confideId.toString())
.navigation(activity)
}
}
}
package com.ydl.confide.api
import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.Intent
import android.support.v4.app.DialogFragment
......@@ -15,4 +16,14 @@ interface IConfideService : IProvider {
//倾诉首页
fun openConfideHome(context: Context)
fun connectionJava(id: Int, type: Int, activity: Activity, tellData: String?, callType:String?)
fun ydlAvManagerLogin(uid: String?)
fun startCondifeHomePage(context: Context, isSplash: Boolean)
fun initYdlavManager(app: Application)
fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?)
}
\ No newline at end of file
package com.ydl.confide.listener
interface ConnectionJavaResListener {
fun onRequestResponse(res: String)
}
\ No newline at end of file
package com.yidianling.course.modular_service
import android.app.Activity
import android.app.Application
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
import com.ydl.course.api.ICourseService
import com.yidianling.course.courseNew.CourseTopicActivity
import com.yidianling.course.courseNew.mine.MyCourseActivity
import com.yidianling.course.coursePlay.CourseCommentActivity
import com.yidianling.course.coursePlay.CoursePlayActivity
import com.yidianling.course.coursePlay.CourseReplyListActivity
import com.yidianling.course.flutterPlugin.CourseSendPlugin
import com.yidianling.course.lifeCallback.CoursePlayLifecycle
import java.util.*
/**
* @author jiucheng
......@@ -53,6 +60,29 @@ class CourseServiceImp : ICourseService {
MyCourseActivity.start(context)
}
override fun startCoursePlayActivity(activity: Activity, courseId: Int, coursePlayUrl: String?, from: Int, mediaType: String?) {
val intent = Intent(activity, CoursePlayActivity::class.java)
intent.putExtra("course_id", courseId)
intent.putExtra("coursePlayUrl", coursePlayUrl)
intent.putExtra("from", from)
intent.putExtra("mediaType", mediaType)
activity.startActivity(intent)
}
override fun startCourseCommentActivity(activity: Activity, courseId: String) {
CourseCommentActivity.startActivity(activity, courseId)
}
override fun startCourseReplyActivity(activity: Activity, courseId: String) {
val intent = Intent(activity, CourseReplyListActivity::class.java)
intent.putExtra("course_id", courseId)
activity.startActivity(intent)
}
override fun initCoursePlayLifeCircle(application: Application) {
application.registerActivityLifecycleCallbacks(CoursePlayLifecycle())
}
override fun init(context: Context?) {
}
}
\ No newline at end of file
package com.ydl.course.api
import android.app.Activity
import android.app.Application
import android.content.Context
import com.alibaba.android.arouter.facade.template.IProvider
......@@ -30,4 +31,12 @@ interface ICourseService :IProvider {
fun sendLoginStatusToFlutter()
fun startMyCourseActivity(context: Context)
fun startCoursePlayActivity(activity: Activity, courseId: Int, coursePlayUrl: String?, from: Int, mediaType: String?)
fun startCourseCommentActivity(activity: Activity, courseId: String)
fun startCourseReplyActivity(activity: Activity, courseId: String)
fun initCoursePlayLifeCircle(application: Application)
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.avchatkit.common.util.NetworkUtil
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.im.api.bean.IMLoginInfo
......@@ -364,4 +365,8 @@ class IMServiceImpl : IImService {
override fun initIm(app: Application, activity: Class<out Activity>) {
NimApplication.getInstance().initIm(app, activity)
}
override fun isWifiOr3G(activity: Activity): Boolean {
return NetworkUtil.isWifiOr3G(activity)
}
}
\ No newline at end of file
......@@ -122,4 +122,6 @@ interface IImService : IProvider {
fun chatScheule(context: Activity, userUrl: String, docUrl: String, dsmId: Int, title: String, toUid: Int)
fun initIm(app: Application, activity: Class<out Activity>)
fun isWifiOr3G(activity: Activity): Boolean
}
\ No newline at end of file
package com.yidianling.user.mine;
package com.yidianling.user.bean;
import java.util.List;
......
package com.yidianling.user.mine;
package com.yidianling.user.bean;
import android.support.annotation.Keep;
......
......@@ -6,6 +6,7 @@ import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydlcommon.base.BaseActivity;
......@@ -19,6 +20,7 @@ import com.yidianling.common.tools.ToastUtil;
import com.yidianling.user.R;
import com.yidianling.user.UserConstants;
import com.yidianling.user.UserHelper;
import com.yidianling.user.bean.FundData;
import com.yidianling.user.api.utils.UserApiServiceUtils;
import com.yidianling.user.mine.data.AppDataManager;
import com.yidianling.user.mine.view.LoadMoreFooterView;
......@@ -39,6 +41,7 @@ import io.reactivex.schedulers.Schedulers;
* 资金明细
* Created by softrice on 15/12/1.
*/
@Route(path = "/mine/AccountHistoryActivity")
public class AccountHistoryActivity extends BaseActivity implements PtrHandler, LoadMoreHandler {
AccountHistoryListAdapter adapter;
......
......@@ -5,6 +5,7 @@ import android.view.View;
import android.view.ViewGroup;
import com.ydl.ydlcommon.adapter.CommonAdapter;
import com.yidianling.user.bean.FundData;
/**
......
......@@ -13,6 +13,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.user.R;
import com.yidianling.user.UserConstants;
import com.yidianling.user.UserHelper;
import com.yidianling.user.bean.FundData;
import com.yidianling.user.api.utils.UserApiServiceUtils;
/**
......
......@@ -36,7 +36,7 @@ import com.yidianling.user.http.UserHttpImpl;
import com.yidianling.user.http.request.BindQQ;
import com.yidianling.user.http.request.BindWX;
import com.yidianling.user.http.request.UnBindThirdLoginParam;
import com.yidianling.user.mine.event.RefreshRecentContactListEvent;
import com.yidianling.user.api.event.RefreshRecentContactListEvent;
import com.yidianling.user.route.UserIn;
import com.yidianling.user.ui.login.RegisterAndLoginActivity;
import com.yidianling.user.ui.login.VerificationCodeActivity;
......
......@@ -6,8 +6,8 @@ import com.ydl.ydlcommon.bean.MustUP
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.mine.FundData
import com.yidianling.user.mine.Recharge
import com.yidianling.user.bean.FundData
import com.yidianling.user.bean.Recharge
import com.yidianling.user.mine.bean.AccountBean
import com.yidianling.user.mine.bean.BalanceBean
import com.yidianling.user.mine.bean.CouponNumBean
......
......@@ -5,6 +5,8 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseCommand
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.im.message.param.MsgListParam
import com.yidianling.user.bean.FundData
import com.yidianling.user.bean.Recharge
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.mine.*
import com.yidianling.user.mine.bean.AccountBean
......
......@@ -6,6 +6,8 @@ import com.ydl.ydlcommon.data.http.*
import com.ydl.ydlcommon.utils.NetworkParamsUtils
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.im.message.param.MsgListParam
import com.yidianling.user.bean.FundData
import com.yidianling.user.bean.Recharge
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.mine.*
import com.yidianling.user.mine.bean.AccountBean
......
......@@ -63,6 +63,14 @@ class AppServiceImpl: IAppService {
ARouter.getInstance().build("/user/privacy").navigation()
}
override fun accountHistoryIntent(activity: Activity) {
ARouter.getInstance().build("/mine/AccountHistoryActivity").navigation()
}
override fun rechargeActivityIntent(activity: Activity) {
ARouter.getInstance().build("/main/recharge").navigation()
}
override fun init(context: Context?) {
}
......
package com.yidianling.user.modular_service
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v4.app.Fragment
import android.text.TextUtils
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.bean.VersionData
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.ApkUpdateDialog
import com.yidianling.common.tools.RxAppTool
import com.yidianling.user.UserHelper
import com.yidianling.user.*
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
import com.yidianling.user.api.listener.SecretDataListener
import com.yidianling.user.api.listener.UserInfoFromApiListener
import com.yidianling.user.api.listener.VersionUpdateStatusListener
import com.yidianling.user.api.service.IUserService
import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.mine.data.AppDataManager
import com.yidianling.user.mine.utils.UpdateUtil
import com.yidianling.user.route.UserIn
import com.yidianling.user.safePrivate.FingerPrintCheckActivity
import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.safePrivate.PrivacyActivity
import com.yidianling.user.ui.InputPhoneActivity
import com.yidianling.user.ui.LoginActivity
import com.yidianling.user.ui.login.RegisterAndLoginActivity
import com.yidianling.user.ui.login.SecretActivity
import com.yidianling.user.widget.utils.PrivacyDialogUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.lang.Exception
/**
* author : Zhangwenchao
......@@ -80,6 +102,29 @@ public class UserServiceImp : IUserService {
return UserHelper.getUserInfo()?.userInfo
}
@SuppressLint("CheckResult")
override fun getUserInfoFromApi(listener: UserInfoFromApiListener) {
AppDataManager.getHttp().getUserInfo()
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
try {
listener.apiResponse(it)
}catch (e: Exception) {
listener.onFailure(e.toString())
}
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
listener.onFailure(msg)
}
})
}
override fun setUserInfo(userInfo: UserResponseBean.UserInfo?) {
UserHelper.getUserInfo()?.userInfo = userInfo
}
override fun isBindPhone(): Boolean {
return !TextUtils.isEmpty(UserHelper.getUserInfo()?.userInfo?.phone)
}
......@@ -133,4 +178,135 @@ public class UserServiceImp : IUserService {
UserHelper.setUserinfo(null)
UserIn.clearImData()
}
override fun getMineFragment():Fragment {
return MineFragment()
}
override fun updateUI(fragment: Fragment) {
if (fragment is MineFragment) {
fragment.updateUI()
}
}
override fun checkUpVersion(activity: Activity, listener: VersionUpdateStatusListener) {
UpdateUtil.getInstance().setUpdateListener(activity,
object : UpdateUtil.VersionUpdateListener {
override fun setUpdateData(version1: VersionData) {
//根据获取的version判断是否需要更新
var isUpdate = UpdateUtil.getInstance().needUpdate(activity, version1.ver)
if (activity != null && isUpdate) {
listener.shouldUpdate()
AppDataManager.getLocal().putUpdate(true)
ApkUpdateDialog(activity).setData(version1).setCancle(false).show()
} else {
listener.notUpdate()
AppDataManager.getLocal().putUpdate(false)
}
}
override fun onFailed() {
}
})
}
override fun getRedPocketTime(): Long {
return AppDataManager.getLocal().getRedPocketTime()
}
override fun putRedPocketTime(time: Long) {
AppDataManager.getLocal().putRedPocketTime(time)
}
override fun hasUpdate(): Boolean {
return AppDataManager.getLocal().hasUpdate()
}
override fun hasPrivacyDialog(): Boolean {
return PrivacyDialogUtils.INSTANCE.privacyDialog != null
}
override fun initPrivacyDialog(activity: Activity, content: String, time: String) {
PrivacyDialogUtils.INSTANCE.initPrivacy(activity, content, time)
}
override fun privacyDialogIsShow(): Boolean {
return PrivacyDialogUtils.INSTANCE.privacyDialog?.isShowing?:true
}
override fun showPrivacyDialog() {
PrivacyDialogUtils.INSTANCE.privacyDialog?.show()
}
override fun loginUtilsLogout() {
LoginUtils.logout()
}
override fun setChannelId() {
LoginHelper.setChannelId()
}
override fun logoutlearLocal() {
LoginUtils.logoutClearLocal()
}
override fun shouldShowFingerPage(activity: Activity) {
if(!(activity is HandUnlockCheckActivity
|| activity is FingerPrintCheckActivity
|| activity is LoginActivity)
&& FingerPrintUtil.instance().isShowActivity()) {
//跳转解锁页面
val intent = Intent(
ActivityManager.getInstance().getTopTaskActivity(),
HandUnlockCheckActivity::class.java
)
intent.putExtra("isFromBackground", true)
ActivityManager.getInstance().getTopTaskActivity().startActivity(intent)
}
}
override fun shouldShowFingerPageFromKill(activity: Activity, isSplashActivity: Boolean) {
if (FingerPrintUtil.instance().appIsSetUnLockPass() && isSplashActivity) {
//跳转解锁页面
val intent = Intent(activity, HandUnlockCheckActivity::class.java)
intent.putExtra("isFromBackground", true)
activity.startActivity(intent)
}
}
override fun wxBindToInputhonePage(activity: Activity) {
InputPhoneActivity.start(activity, UserConstants.BIND_PHONE_ACTION, null, false)
}
override fun getSecretPageRequestOkCode(): Int {
return SecretActivity.SECRET_PAGE_REQUEST_OK_CODE
}
@SuppressLint("CheckResult")
override fun getSecretDataApi(activity: Activity, listener: SecretDataListener) {
UserHttpImpl.Companion.getInstance().getSecretData()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
if (it.code === 0) {
if (it.data.getIs_open() === 1) {
SecretActivity.startProtocol(activity, it.data.getContent())
} else {
listener.onOtherAction()
}
} else {
listener.onOtherAction()
}
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
listener.onOtherAction()
}
})
}
override fun startFromGuide(context: Context, isBindPhone: Boolean, isFromGudile: Boolean) {
RegisterAndLoginActivity.startFromGuide(context, isBindPhone, isFromGudile)
}
}
\ No newline at end of file
package com.yidianling.user.widget.utils
import android.app.Activity
import com.yidianling.user.widget.PrivacyDialog
class PrivacyDialogUtils private constructor() {
companion object {
val INSTANCE by lazy { PrivacyDialogUtils() }
}
var privacyDialog: PrivacyDialog? = null
fun initPrivacy(activity: Activity?, content: String?, time: String?) {
if (privacyDialog == null) {
privacyDialog = PrivacyDialog(activity, content, time)
}
}
}
\ No newline at end of file
package com.yidianling.user.api.listener
interface SecretDataListener {
fun onOtherAction()
}
\ No newline at end of file
package com.yidianling.user.api.listener
import com.yidianling.user.api.bean.UserResponseBean
interface UserInfoFromApiListener {
fun apiResponse(res: UserResponseBean)
fun onFailure(msg: String)
}
\ No newline at end of file
package com.yidianling.user.api.listener
interface VersionUpdateStatusListener {
fun shouldUpdate()
fun notUpdate()
}
\ No newline at end of file
......@@ -33,4 +33,8 @@ interface IAppService : IProvider {
fun privacyIntent(activity: Activity)
fun accountHistoryIntent(activity: Activity)
fun rechargeActivityIntent(activity: Activity)
}
\ No newline at end of file
......@@ -3,9 +3,13 @@ package com.yidianling.user.api.service
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v4.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
import com.yidianling.user.api.listener.SecretDataListener
import com.yidianling.user.api.listener.UserInfoFromApiListener
import com.yidianling.user.api.listener.VersionUpdateStatusListener
/**
* author : Zhangwenchao
......@@ -29,6 +33,10 @@ interface IUserService : IProvider {
fun getUserInfo(): UserResponseBean.UserInfo?
fun getUserInfoFromApi(listener: UserInfoFromApiListener)
fun setUserInfo(userInfo: UserResponseBean.UserInfo?)
fun getUserResponse() : UserResponseBean?
fun getUserSetting(): UserSettingBean?
......@@ -62,4 +70,41 @@ interface IUserService : IProvider {
fun clearUserInfo()
fun getMineFragment(): Fragment
fun updateUI(fragment: Fragment)
fun checkUpVersion(activity: Activity, listener: VersionUpdateStatusListener)
fun getRedPocketTime(): Long
fun putRedPocketTime(time: Long)
fun hasUpdate(): Boolean
fun hasPrivacyDialog(): Boolean //判断单例的隐私弹框是否为空
fun initPrivacyDialog(activity: Activity, content: String, time: String) //初始化隐私弹框
fun showPrivacyDialog()
fun privacyDialogIsShow(): Boolean
fun loginUtilsLogout()
fun setChannelId()
fun logoutlearLocal()
fun shouldShowFingerPage(activity: Activity) //app从后台进入前台, 判定是否跳转解锁页面
fun shouldShowFingerPageFromKill(activity: Activity, isSplashActivity: Boolean) //启动app,判定是否跳转解锁页面
fun wxBindToInputhonePage(activity: Activity)
fun getSecretPageRequestOkCode(): Int
fun getSecretDataApi(activity: Activity, listener: SecretDataListener)
fun startFromGuide(context: Context, isBindPhone: Boolean, isFromGudile: Boolean)
}
\ No newline at end of file
......@@ -39,7 +39,7 @@ import com.yidianling.user.mine.AccountSettingActivity;
import com.yidianling.user.mine.PersonalInfoActivity;
import com.yidianling.user.mine.UserChangeEvent;
import com.yidianling.user.mine.data.AppDataManager;
import com.yidianling.user.mine.event.RefreshRecentContactListEvent;
import com.yidianling.user.api.event.RefreshRecentContactListEvent;
import com.yidianling.user.mine.http.MineHttpImpl;
import com.yidianling.user.safePrivate.PrivacyActivity;
import com.yidianling.user.ui.login.RegisterAndLoginActivity;
......
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