Merge branch 'dev' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into dev

This commit is contained in:
wangcongtao
2020-07-23 10:39:55 +08:00
16 changed files with 265 additions and 48 deletions

View File

@@ -177,30 +177,34 @@
-keep @kotlin.Metadata class *
-keepclasseswithmembers @kotlin.Metadata class * { *; }
-dontwarn android.telephony.TelephonyManager.**
-keep class android.telephony.TelephonyManager.**{*;}
#----------------------------------------第三方库----------------------------------------------
#-----高德地图-----
#内置语音 V5.6.0之后
-keep class com.alibaba.idst.nls.**{*;}
-keep class com.google.**{*;}
-keep class com.nlspeech.nlscodec.** {*;}
-keep public class com.alibaba.mit.alitts.*{*;}
-keep class com.alibaba.mit.alitts.** {*;}
-dontwarn com.alibaba.mit.alitts.ICallback
#3D 地图 V5.0.0之后:
-keep class com.amap.api.maps.**{*;}
-keep class com.autonavi.**{*;}
-keep class com.amap.api.trace.**{*;}
-keep class com.amap.api.maps.**{*;}
-keep class com.autonavi.**{*;}
-keep class com.amap.api.trace.**{*;}
#定位
-keep class com.loc.** {*;}
-keep class com.amap.api.location.**{*;}
-keep class com.amap.api.fence.**{*;}
-keep class com.loc.**{*;}
-keep class com.autonavi.aps.amapapi.model.**{*;}
#搜索
-keep class com.amap.api.services.**{*;}
#导航
-keep class com.amap.api.navi.**{*;}
#内置语音 V5.6.0之后
-keep class com.alibaba.idst.nls.**{*;}
-keep class com.google.**{*;}
-keep class com.nlspeech.nlscodec.** {*;}
-keep class com.alibaba.mit.alitts.** {*;}
-dontwarn android.telephony.**
-keep class android.telephony.TelephonyManager$CellInfoCallback
#-----Gson-----
-dontwarn sun.misc.**
@@ -340,6 +344,7 @@
-keep class com.zhidao.autopilot.support.**{*;}
-keep class com.zhidao.voice.library.**{*;}
-keep class com.zhidao.voicesdk.**{*;}
-dontwarn com.elegant.network.**

View File

@@ -2,7 +2,6 @@ package com.mogo.launcher;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.util.Log;
import com.alibaba.android.arouter.launcher.ARouter;
@@ -54,7 +53,7 @@ public class MogoApplication extends AbsMogoApplication {
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
// MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
MogoModulePaths.addModule( new MogoModule( AuthorizeConstant.PATH_AGREEMENT_FRAGMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_AGREEMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
//运营位卡片,需要默认显示,放在第一个加载
if ( DebugConfig.isLauncher() ) {

View File

@@ -18,7 +18,7 @@ open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
override fun needAuthorize(tag: String): Boolean {
Logger.d(TAG, "===== needAuthorize update agreement in background")
baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
// baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
return needAuthorization(tag.toAuthorizeType())
}

View File

@@ -9,22 +9,24 @@ import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.location.IMogoLocationListener
import com.mogo.map.marker.IMogoMarkerClickListener
import com.mogo.map.navi.IMogoNaviListener
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.Companion.PATH_AGREEMENT_FRAGMENT
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.Companion.PATH_AGREEMENT_MODULE_NAME
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
import com.mogo.service.MogoServicePaths
import com.mogo.service.auth.IMogoAuthManager
import com.mogo.service.module.IMogoModuleLifecycle
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.service.module.ModuleType
import com.mogo.utils.logger.Logger
@Route(path = PATH_AGREEMENT_FRAGMENT)
class MogoAuthorizeProvider : IMogoModuleProvider {
@Route(path = MogoServicePaths.PATH_AGREEMENT)
class MogoAuthorizeProvider : IMogoAuthManager {
companion object {
const val TAG = "MogoAuthorizeProvider"
}
private var mContext:Context? = null
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
return null
}
@@ -46,7 +48,7 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
}
override fun getType(): Int {
return ModuleType.TYPE_SERVICE
return 0
}
override fun getNaviListener(): IMogoNaviListener? {
@@ -61,12 +63,10 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
return null
}
override fun init(context: Context) {
//todo 引导判断暂时去掉 后续引导流程更改完再放开
// todo if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
// todo F系列暂时没有授权功能 1.1需求中添加 全量上
override fun resetContext(context: Context?) {
mContext = context
if (mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
mogoAuthShow.invokeAuthorizeForShow(context)
mogoAuthShow.invokeAuthorizeForShow(mContext!!)
} else {
//首次进入Launcher同步一下授权状态防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
mogoAuthShow.updateAuthorizeStatus(AUTHORIZE_TYPE_LAUNCHER_MAIN)
@@ -74,6 +74,13 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
}
}
override fun init(context: Context) {
//todo 引导判断暂时去掉 后续引导流程更改完再放开
// todo if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
// todo F系列暂时没有授权功能 1.1需求中添加 全量上
}
override fun getAppPackage(): String? {
return null
}
@@ -81,4 +88,5 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
override fun getAppName(): String? {
return null
}
}

View File

@@ -6,11 +6,6 @@ class AuthorizeConstant {
const val PROVIDER_MODULE = "/authorize/biz"
const val PROVIDER_LAUNCHER = "/authorize/showbiz"
/**
* 展示用户协议模块地址
*/
const val PATH_AGREEMENT_FRAGMENT = "/agreement/showFragment"
/**
* provider模块实例名称(暂时仅有卡片用到)
*/

View File

@@ -2,15 +2,12 @@ package com.mogo.module.authorize.authprovider.launcher
import android.content.Context
import android.os.Looper
import com.mogo.commons.AbsMogoApplication
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeManagerImpl
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
import com.mogo.module.authorize.layout.AuthorizeLayout
import com.mogo.module.authorize.layout.AuthorizeDialog
import com.mogo.module.authorize.model.proxy.toAuthorizeType
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasAuth
import com.mogo.module.common.wm.WindowManagerView
import com.mogo.utils.logger.Logger
class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMogoAuthorizeMainProvider {
@@ -24,7 +21,9 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
}
}
private var windowManagerView: WindowManagerView? = null
private var mContext:Context? = null
private var authorizeDialog: AuthorizeDialog? = null
override fun hasRegister(tag: String): Boolean {
if (tag.isNullOrBlank()) return false
@@ -41,7 +40,8 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
}
fun invokeAuthorizeForShow(context: Context) {
pushLayoutToMainWindow(context, AUTHORIZE_TYPE_LAUNCHER_MAIN)
mContext = context
// pushLayoutToMainWindow(AUTHORIZE_TYPE_LAUNCHER_MAIN)
}
fun showAuthorizeView(tag: String, forbiddenVoice: (() -> Unit), onError: ((String) -> Unit)) {
@@ -64,25 +64,23 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
Logger.d(TAG, "ready to forbidden voice")
forbiddenVoice.invoke()
Logger.d(TAG, "ready to push fragment")
pushLayoutToMainWindow(AbsMogoApplication.getApp().applicationContext,tag)
// pushLayoutToMainWindow(tag)
}
fun hideAuthorizeView() {
windowManagerView?.dismiss()
authorizeDialog?.dismiss()
}
private fun pushLayoutToMainWindow(context: Context,tag: String) {
if (windowManagerView == null) {
val authorizeLayout = AuthorizeLayout(tag)
val view = authorizeLayout.getLayoutView()
windowManagerView = WindowManagerView.Builder(context).contentView(view).build()
private fun pushLayoutToMainWindow(tag: String) {
if (authorizeDialog == null) {
authorizeDialog = AuthorizeDialog(tag,mContext!!)
}
if (windowManagerView!!.isShowing) {
if (authorizeDialog!!.isShowing) {
Logger.d(TAG, "User is operation authorization, do not repeat invoke")
return
} else {
Logger.d(TAG, "pushLayoutToMainWindow")
windowManagerView!!.show()
authorizeDialog!!.show()
}
}

View File

@@ -0,0 +1,176 @@
package com.mogo.module.authorize.layout
import android.content.Context
import android.text.Html
import android.view.View
import android.widget.Button
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.commons.AbsMogoApplication
import com.mogo.module.authorize.R
import com.mogo.module.authorize.util.AnalyticsUtil
import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener
import com.mogo.module.authorize.voice.IVoiceCommandListener
import com.mogo.module.authorize.voice.VoiceUtil
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.utils.logger.Logger
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.withContext
class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
private var mContext: Context? = null
private var invokeTag: String? = null
private var agreementId: Long = 0L
private var clTopParent: ConstraintLayout? = null
private var clErrorContainer: ConstraintLayout? = null
private var clLoadAuthorizeContainer: ConstraintLayout? = null
private var clContainer: ConstraintLayout? = null
private var clAuthorizeLoading: ConstraintLayout? = null
private var btnAgree: Button? = null
private var btnDisAgree: Button? = null
private var btnLoadingError: Button? = null
private var tvTitle: TextView? = null
private var tvContent: TextView? = null
private var tvButtonContent: TextView? = null
private var tvLastContent: TextView? = null
private var authorizeController: AuthorizeController? = null
constructor(invokeTag: String, context: Context) : super(context) {
mContext = context
this.invokeTag = invokeTag
initView()
}
private fun initView() {
setContentView(R.layout.module_authorize_fragment)
initViews()
}
fun initViews() {
Logger.d(AuthorizeLayout.TAG, "initView ")
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_SHOW)
init()
Logger.d(AuthorizeLayout.TAG, "invokeTag :$invokeTag")
authorizeController = AuthorizeController(invokeTag!!)
invokeAuthorizationContent()
VoiceUtil.registerAll(this, this)
}
private fun init() {
clTopParent = findViewById(R.id.clAuthorizeTopParent)
clErrorContainer = findViewById(R.id.clLoadingErrorContainer)
clLoadAuthorizeContainer = findViewById(R.id.clLoadingAuthorizeContainer)
clContainer = findViewById(R.id.clAuthorizeContainer)
clAuthorizeLoading = findViewById(R.id.clAuthorizeLoading)
btnAgree = findViewById(R.id.btnAuthorizeAgree)
btnDisAgree = findViewById(R.id.btnAuthorizeDisAgree)
btnLoadingError = findViewById(R.id.btnAuthorizeLoadingError)
tvTitle = findViewById(R.id.tvAuthorizeTitle)
tvContent = findViewById(R.id.tvAuthorizeContent)
tvButtonContent = findViewById(R.id.tvAuthorizeButtonContent)
tvLastContent = findViewById(R.id.tvAuthorizeLastContent)
btnAgree?.setOnClickListener(this)
btnDisAgree?.setOnClickListener(this)
btnLoadingError?.setOnClickListener(this)
clTopParent?.setOnClickListener(this)
clContainer?.setOnClickListener(this)
clErrorContainer?.setOnClickListener(this)
clLoadAuthorizeContainer?.setOnClickListener(this)
clAuthorizeLoading?.setOnClickListener(this)
}
private fun readyToAuthorize() {
clErrorContainer?.visibility = View.GONE
clLoadAuthorizeContainer?.visibility = View.VISIBLE
}
private fun showAuthorizationAgreementContent(
agreementId: Long,
agreementContent: String,
agreementTitle: String,
agreementBottom: String,
agreementLast: String) {
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.resources.getString(R.string.module_authorize_agreement_tip), AbsMogoApplication.getApp().applicationContext, this)
this.agreementId = agreementId
clLoadAuthorizeContainer?.visibility = View.GONE
clContainer?.visibility = View.VISIBLE
tvTitle?.text = Html.fromHtml(agreementTitle)
GlobalScope.async(Dispatchers.IO) {
val spannable = Html.fromHtml(agreementContent)
withContext(Dispatchers.Main) {
tvContent?.text = spannable
}
}
tvButtonContent?.text = Html.fromHtml(agreementBottom)
tvLastContent?.text = Html.fromHtml(agreementLast)
}
private fun showAuthorizationError() {
clLoadAuthorizeContainer?.visibility = View.GONE
clErrorContainer?.visibility = View.VISIBLE
}
private fun voiceAuthorizeError() {
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.getString(R.string.module_authorize_failed), AbsMogoApplication.getApp().applicationContext, this)
Logger.d(AuthorizeLayout.TAG, "onDestroy")
VoiceUtil.unregisterAll(AbsMogoApplication.getApp().applicationContext, this)
}
override fun onClick(v: View) {
when (v.id) {
R.id.btnAuthorizeAgree -> {
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 1))
agreeAuthorize()
}
R.id.btnAuthorizeDisAgree -> {
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 2))
disAgreeAuthorize()
}
R.id.clLoadingErrorContainer, R.id.btnAuthorizeLoadingError -> {
invokeAuthorizationContent()
}
R.id.clAuthorizeTopParent -> {
Logger.i(AuthorizeLayout.TAG, "dismiss authorizeView")
authorizeController?.onDestroy()
}
}
}
override fun onVoiceCmdAgree() {
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 1))
agreeAuthorize()
}
override fun onVoiceCmdDisAgree() {
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 2))
disAgreeAuthorize()
}
private fun agreeAuthorize() {
authorizeController?.agreeAuthorize(invokeTag!!, agreementId) {
voiceAuthorizeError()
}
}
private fun disAgreeAuthorize() {
authorizeController?.disAgreeAuthorize(invokeTag!!, agreementId) {
voiceAuthorizeError()
}
}
private fun invokeAuthorizationContent() {
authorizeController?.invokeAuthorizationContent(invokeTag!!, {
readyToAuthorize()
}, { id: Long, content: String, title: String, bottomContent: String, lastContent: String ->
showAuthorizationAgreementContent(id, content, title, bottomContent, lastContent)
}, {
showAuthorizationError()
})
}
}

View File

@@ -50,11 +50,11 @@ class AuthorizeLayout(private val invokeTag: String) : View.OnClickListener, IVo
return layoutInflater
}
private fun getLayoutId(): Int {
fun getLayoutId(): Int {
return R.layout.module_authorize_fragment
}
private fun initViews(mRootView: View) {
fun initViews(mRootView: View) {
Logger.d(TAG, "initView ")
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_SHOW)
init(mRootView)

View File

@@ -151,7 +151,7 @@
android:layout_height="0px"
android:layout_marginBottom="@dimen/dp_139"
android:scrollbarSize="@dimen/dp_442"
android:layout_marginTop="@dimen/dp_139"
android:layout_marginTop="@dimen/dp_35"
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -16,6 +16,7 @@ class DialogImpl implements IWindowManagerView {
public void init(WindowManagerView.WMViewParams params) {
Logger.d("DialogImpl", "init====");
dialog = new BaseFloatDialog(params.mContext);
Logger.d("DialogImpl","params view : " + params.mContentView);
dialog.setContentView(params.mContentView);
}

View File

@@ -1016,7 +1016,9 @@
<dimen name="dp_997">997px</dimen>
<dimen name="dp_998">998px</dimen>
<dimen name="dp_999">999px</dimen>
<dimen name="dp_1000">1000px</dimen>
<dimen name="dp_1300">1300px</dimen>
<dimen name="dp_1920">1920px</dimen>

View File

@@ -115,6 +115,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
}
mServiceApis.getShareManager().resetContext(this);
// mServiceApis.getAuthManagerApi().resetContext(this);
mMogoStatusManager = mServiceApis.getStatusManagerApi();
mMogoStatusManager.setMainPageLaunchedStatus( TAG, true );
AutopilotServiceManage.getInstance().init( getContext() );

View File

@@ -5,6 +5,7 @@ import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.auth.IMogoAuthManager;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.datamanager.IMogoDataManager;
@@ -236,4 +237,10 @@ public interface IMogoServiceApis extends IProvider {
* @return
*/
IMogoPassportManager getPassportManagerApi();
/**
* 获取授权服务
* @return
*/
IMogoAuthManager getAuthManagerApi();
}

View File

@@ -220,4 +220,10 @@ public class MogoServicePaths {
*/
@Deprecated
public static final String PATH_PASSPORT = "/passport/api";
/**
* 授权服务
*/
@Deprecated
public static final String PATH_AGREEMENT = "/agreement/showFragment";
}

View File

@@ -0,0 +1,13 @@
package com.mogo.service.auth;
import android.content.Context;
import com.mogo.service.module.IMogoModuleProvider;
public interface IMogoAuthManager extends IMogoModuleProvider {
/**
* 重置授权页面弹起时展示View Context
*/
void resetContext(Context context);
}

View File

@@ -9,6 +9,7 @@ import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.auth.IMogoAuthManager;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.datamanager.IMogoDataManager;
@@ -200,6 +201,11 @@ public class MogoServiceApis implements IMogoServiceApis {
return getApiInstance( IMogoPassportManager.class, MogoServicePaths.PATH_PASSPORT );
}
@Override
public IMogoAuthManager getAuthManagerApi() {
return getApiInstance( IMogoAuthManager.class, MogoServicePaths.PATH_AGREEMENT );
}
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
T inst = SingletonsHolder.get( clazz );
if ( inst == null ) {