From 2a0d73e5ec1e61d24870d4b4964f2c2a808a7889 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Wed, 8 Apr 2020 16:00:44 +0800 Subject: [PATCH 1/7] branch to frozee code --- gradle.properties | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/gradle.properties b/gradle.properties index e589dd1e94..7607d3aa37 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,30 +27,30 @@ PASSWORD=xintai2018 RELEASE=false # 模块版本 ## 工程内模块 -MOGO_MODULE_SHARE_VERSION=1.0.3.1-SNAPSHOT -MOGO_COMMONS_VERSION=1.0.3.1-SNAPSHOT -MOGO_UTILS_VERSION=1.0.3.1-SNAPSHOT -MAP_AMAP_VERSION=1.0.3.1-SNAPSHOT -MOGO_MAP_VERSION=1.0.3.1-SNAPSHOT -MOGO_MAP_API_VERSION=1.0.3.1.1-SNAPSHOT -MOGO_MODULE_COMMON_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_MAIN_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_MAP_VERSION=1.0.3.1-SNAPSHOT -MOGO_SERVICE_VERSION=1.0.3.1-SNAPSHOT -MOGO_SERVICE_API_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_APPS_VERSION=1.0.3.1-SNAPSHOT -MOGO_CONNECTION_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_NAVI_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_SERVICE_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_EXTENSIONS_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_SEARCH_VERSION=1.0.3.1-SNAPSHOT -MOGO_MODULE_BACK_VERSION=1.0.3.1-SNAPSHOT +MOGO_COMMONS_VERSION=1.0.3 +MOGO_UTILS_VERSION=1.0.3 +MAP_AMAP_VERSION=1.0.3 +MOGO_MAP_VERSION=1.0.3 +MOGO_MAP_API_VERSION=1.0.3 +MOGO_SERVICE_VERSION=1.0.3 +MOGO_SERVICE_API_VERSION=1.0.3 +MOGO_CONNECTION_VERSION=1.0.3 +MOGO_MODULE_APPS_VERSION=1.0.3 +MOGO_MODULE_NAVI_VERSION=1.0.3 +MOGO_MODULE_SHARE_VERSION=1.0.3 +MOGO_MODULE_COMMON_VERSION=1.0.3 +MOGO_MODULE_MAIN_VERSION=1.0.3 +MOGO_MODULE_MAP_VERSION=1.0.3 +MOGO_MODULE_SERVICE_VERSION=1.0.3 +MOGO_MODULE_EXTENSIONS_VERSION=1.0.3 +MOGO_MODULE_SEARCH_VERSION=1.0.3 +MOGO_MODULE_BACK_VERSION=1.0.3 MOGO_MODULE_AUTHORIZE_VERSION=1.0.0-SNAPSHOT MOGO_MODULE_GUIDE_VERSION=1.0.0-SNAPSHOT ## 工程外部模块 # 探路 -MOGO_MODULE_TANLU_VERSION=1.0.3-SNAPSHOT +MOGO_MODULE_TANLU_VERSION=1.0.3.2 # 车聊聊 CARCHATTING_VERSION=1.0.2.3-SNAPSHOT # 车聊聊接口 @@ -64,11 +64,11 @@ MOGO_MODULE_ONLINECAR_VERSION=1.0.3.1-SNAPSHOT # v2x MOGO_MODULE_V2X_VERSION=1.0.3-SNAPSHOT # 媒体卡片 -MOGO_MODULE_MEDIA_VERSION=1.0.2-SNAPSHOT +MOGO_MODULE_MEDIA_VERSION=1.0.3 # 推送 MOGO_MODULE_PUSH_VERSION=1.0.1 # 广告资源位 MOGO_MODULE_AD_CARD_VERSION=1.0.1 # 新鲜事 -MOGO_MODULE_FRESH_NEWS_VERSION=1.0.3-SNAPSHOT +MOGO_MODULE_FRESH_NEWS_VERSION=1.0.3 From bd162f2f7937ca48186c5398ad85a9254294f282 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Apr 2020 16:21:57 +0800 Subject: [PATCH 2/7] upgrade the version of gradle.property --- gradle.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7607d3aa37..9466468e80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -45,16 +45,16 @@ MOGO_MODULE_SERVICE_VERSION=1.0.3 MOGO_MODULE_EXTENSIONS_VERSION=1.0.3 MOGO_MODULE_SEARCH_VERSION=1.0.3 MOGO_MODULE_BACK_VERSION=1.0.3 -MOGO_MODULE_AUTHORIZE_VERSION=1.0.0-SNAPSHOT -MOGO_MODULE_GUIDE_VERSION=1.0.0-SNAPSHOT +MOGO_MODULE_AUTHORIZE_VERSION=1.0.0 +MOGO_MODULE_GUIDE_VERSION=1.0.0 ## 工程外部模块 # 探路 MOGO_MODULE_TANLU_VERSION=1.0.3.2 # 车聊聊 -CARCHATTING_VERSION=1.0.2.3-SNAPSHOT +CARCHATTING_VERSION=1.0.3 # 车聊聊接口 -CARCHATTINGPROVIDER_VERSION=1.0.2.3-SNAPSHOT +CARCHATTINGPROVIDER_VERSION=1.0.3 # 视频引导 MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT # 视频引导接口 From 64d020a329344af5567a8cc9e461b0bc045fd455 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Wed, 8 Apr 2020 16:32:57 +0800 Subject: [PATCH 3/7] update modules to release version --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9466468e80..dc8c382438 100644 --- a/gradle.properties +++ b/gradle.properties @@ -60,9 +60,9 @@ MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT # 视频引导接口 MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT # 在线车辆F -MOGO_MODULE_ONLINECAR_VERSION=1.0.3.1-SNAPSHOT +MOGO_MODULE_ONLINECAR_VERSION=1.0.3.1 # v2x -MOGO_MODULE_V2X_VERSION=1.0.3-SNAPSHOT +MOGO_MODULE_V2X_VERSION=1.0.3 # 媒体卡片 MOGO_MODULE_MEDIA_VERSION=1.0.3 # 推送 From 35f8872f30cd04dd51447858efb11799418525ca Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Thu, 9 Apr 2020 11:55:52 +0800 Subject: [PATCH 4/7] update v2x version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e589dd1e94..d1e01136dd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -62,7 +62,7 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT # 在线车辆F MOGO_MODULE_ONLINECAR_VERSION=1.0.3.1-SNAPSHOT # v2x -MOGO_MODULE_V2X_VERSION=1.0.3-SNAPSHOT +MOGO_MODULE_V2X_VERSION=1.0.3.2-SNAPSHOT # 媒体卡片 MOGO_MODULE_MEDIA_VERSION=1.0.2-SNAPSHOT # 推送 From b2520188c0593a0c7e9ffbd31abadc73e5165f33 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Thu, 9 Apr 2020 14:55:56 +0800 Subject: [PATCH 5/7] opt --- .../src/main/java/com/mogo/module/map/MapPresenter.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java index 3b23e3325b..7255778958 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java @@ -258,13 +258,11 @@ public class MapPresenter extends Presenter< MapView > implements case VoiceConstants.CMD_MAP_TRAFFIC_MODE: AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开", null ); mView.getUIController().setTrafficEnabled( true ); - mSearchManager.showSearch(); break; case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP: case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE: AIAssist.getInstance( getContext() ).speakTTSVoice( "已关闭", null ); mView.getUIController().setTrafficEnabled( false ); - mSearchManager.showMain(); break; case VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP: case VoiceConstants.CMD_MAP_ZOOM_IN: From f5a2a838420193e30ff921f8cee1c9a0c87e9e45 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Apr 2020 16:55:54 +0800 Subject: [PATCH 6/7] fix bug of when user clear cache --- .../biz/IMogoAuthorizeController.kt | 31 ++++++++++++++++--- .../biz/MogoAuthorizeManagerImpl.kt | 9 ++++-- .../authprovider/biz/MogoAuthorizeProvider.kt | 2 ++ .../invoke/IMogoAuthorizeInvoke.kt | 8 +++++ .../authorize/model/IMogoAuthorizeModel.kt | 14 ++++++--- .../module/authorize/model/bean/Agreement.kt | 16 +++++++++- .../mogo/module/authorize/net/AuthorizeApi.kt | 7 ++++- 7 files changed, 74 insertions(+), 13 deletions(-) diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/IMogoAuthorizeController.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/IMogoAuthorizeController.kt index 7914bcf599..a52028d2b1 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/IMogoAuthorizeController.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/IMogoAuthorizeController.kt @@ -1,10 +1,10 @@ package com.mogo.module.authorize.authprovider.biz +import com.google.gson.Gson import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener import com.mogo.module.authorize.model.BaseResponse import com.mogo.module.authorize.model.IMogoAuthorizeModel -import com.mogo.module.authorize.model.bean.Agreement -import com.mogo.module.authorize.model.bean.AgreementData +import com.mogo.module.authorize.model.bean.* import com.mogo.module.authorize.net.request import com.mogo.module.authorize.util.DateUtil.parseDateToTime import com.mogo.module.authorize.util.SharedPreferenceUtil.getAuthorizeVersion @@ -31,7 +31,7 @@ open class IMogoAuthorizeController { } }, { msg: String -> onError.invoke(msg) - }) + }, true) } fun invokeAuthorizeContent(tag: String, agreementType: Int) { @@ -62,12 +62,12 @@ open class IMogoAuthorizeController { }) } - private fun realInvokeAuthorizeContent(agreementType: Int, onStart: (() -> Unit), onSuccess: ((BaseResponse) -> Unit), onError: ((String) -> Unit)) { + private fun realInvokeAuthorizeContent(agreementType: Int, onStart: (() -> Unit), onSuccess: ((BaseResponse) -> Unit), onError: ((String) -> Unit), needContent: Boolean = false) { onStart.invoke() try { request> { loader { - authorizeModel.invokeAuthorizeContent(agreementType) + authorizeModel.invokeAuthorizeContent(agreementType, needContent) } onSuccess { onSuccess.invoke(it) @@ -116,4 +116,25 @@ open class IMogoAuthorizeController { val oldVersion = getAuthorizeVersion() return currentTime > oldVersion } + + fun checkIfNeedAuthorize(agreementType: Int) { + request> { + loader { + authorizeModel.invokeIfNeedAuthorize(agreementType) + } + onSuccess { + Logger.d(TAG,"result : ${it.result}") + val result = it.result + when (result.agreementStatus) { + AGREEMENT_EFFECT -> setAuthorizeStatus(agreementType, true) + AGREEMENT_NOT_EFFECT -> setAuthorizeStatus(agreementType, false) + else -> Logger.d(TAG, "agreementStatus is not match any case") + } + } + onError { + Logger.d(TAG, it.message ?: "checkIfNeedAuthorize onError, message is null") + setAuthorizeStatus(agreementType, true) + } + } + } } \ No newline at end of file diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeManagerImpl.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeManagerImpl.kt index 3246b53116..a5e97c2cda 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeManagerImpl.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeManagerImpl.kt @@ -6,6 +6,7 @@ import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListen import com.mogo.module.authorize.model.proxy.AuthorizeProxy import com.mogo.module.authorize.model.proxy.toAuthorizeType import com.mogo.module.authorize.util.SharedPreferenceUtil.needAuthorization +import com.mogo.module.authorize.util.SharedPreferenceUtil.setAuthorizeStatus import com.mogo.module.authorize.util.isDeviceOfD import com.mogo.utils.logger.Logger @@ -19,14 +20,18 @@ open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke { override fun needAuthorize(tag: String): Boolean { return if (isDeviceOfD()) { - Logger.d(TAG, "needAuthorize update agreement in background") - baseController.updateAgreementVersion(tag.toAuthorizeType()) + Logger.d(TAG, "===== needAuthorize update agreement in background") + baseController.checkIfNeedAuthorize(tag.toAuthorizeType()) needAuthorization(tag.toAuthorizeType()) } else { false } } + override fun updateAuthorizeStatus(tag: String) { + baseController.checkIfNeedAuthorize(tag.toAuthorizeType()) + } + override fun invokeAuthorizeContent(tag: String) { //todo 后面动态代理统一处理校验问题 Logger.d(TAG, "tag:$tag") diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeProvider.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeProvider.kt index 7a85dc2355..4627cf25e8 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeProvider.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/biz/MogoAuthorizeProvider.kt @@ -67,6 +67,8 @@ class MogoAuthorizeProvider : IMogoModuleProvider { if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) { mogoAuthShow.invokeAuthorizeForShow() } else { + //首次进入Launcher同步一下授权状态,防止由于用户清除数据造成首次加载还会出现授权状态不同步问题 + mogoAuthShow.updateAuthorizeStatus(AUTHORIZE_TYPE_LAUNCHER_MAIN) Logger.d(TAG, "not do match self startUp condition ,wait for someone invoke") } } diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/invoke/IMogoAuthorizeInvoke.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/invoke/IMogoAuthorizeInvoke.kt index 7cdfc6af18..c84550a0b7 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/invoke/IMogoAuthorizeInvoke.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/authprovider/invoke/IMogoAuthorizeInvoke.kt @@ -15,4 +15,12 @@ interface IMogoAuthorizeInvoke : IMogoAuthorizeRegister { * tag:模块ID */ fun invokeAuthorizeContent(tag: String) + + /** + * 更新授权状态 + * tag:模块ID + */ + fun updateAuthorizeStatus(tag:String){ + + } } \ No newline at end of file diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/IMogoAuthorizeModel.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/IMogoAuthorizeModel.kt index 5747d89775..0b79f7c692 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/IMogoAuthorizeModel.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/IMogoAuthorizeModel.kt @@ -2,9 +2,9 @@ package com.mogo.module.authorize.model import com.google.gson.Gson import com.mogo.commons.network.Utils.getSn -import com.mogo.module.authorize.model.bean.RequestUserAgreement -import com.mogo.module.authorize.model.bean.Agreement import com.mogo.module.authorize.model.bean.AgreementData +import com.mogo.module.authorize.model.bean.AgreementStatus +import com.mogo.module.authorize.model.bean.RequestUserAgreement open class IMogoAuthorizeModel : BaseRepository() { @@ -12,9 +12,15 @@ open class IMogoAuthorizeModel : BaseRepository() { const val TAG = "IMogoAuthorizeModel" } - suspend fun invokeAuthorizeContent(agreementType: Int): BaseResponse { - val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType)) + suspend fun invokeAuthorizeContent(agreementType: Int, needContent: Boolean = false): BaseResponse { + val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType, needContent)) val map = mapOf("sn" to getSn(), "data" to requestUserAgreement) return apiCall { getNetWorkApi().getAuthorizeContent(map) } } + + suspend fun invokeIfNeedAuthorize(agreementType: Int): BaseResponse { + val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType)) + val map = mapOf("sn" to getSn(), "data" to requestUserAgreement) + return apiCall { getNetWorkApi().checkIfNeedAuthorize(map) } + } } \ No newline at end of file diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/bean/Agreement.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/bean/Agreement.kt index d530e2741f..bec8a198d5 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/bean/Agreement.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/model/bean/Agreement.kt @@ -3,7 +3,21 @@ package com.mogo.module.authorize.model.bean const val AGREEMENT_EFFECT = 1 //用户协议生效 const val AGREEMENT_NOT_EFFECT = 2 //用户协议不生效 -class RequestUserAgreement(val agreementType: Int) +class RequestUserAgreement{ + var agreementType:Int + var want:Boolean = false + + constructor(agreementType:Int){ + this.agreementType = agreementType + } + + constructor(agreementType: Int, want: Boolean) { + this.agreementType = agreementType + this.want = want + } +} + +data class AgreementStatus(val agreementStatus:Int) data class AgreementData(val agreement: Agreement) diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/net/AuthorizeApi.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/net/AuthorizeApi.kt index ea6538d5f5..71163940dd 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/net/AuthorizeApi.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/net/AuthorizeApi.kt @@ -1,8 +1,8 @@ package com.mogo.module.authorize.net import com.mogo.module.authorize.model.BaseResponse -import com.mogo.module.authorize.model.bean.Agreement import com.mogo.module.authorize.model.bean.AgreementData +import com.mogo.module.authorize.model.bean.AgreementStatus import retrofit2.http.FieldMap import retrofit2.http.FormUrlEncoded import retrofit2.http.POST @@ -19,4 +19,9 @@ interface AuthorizeApi { @POST("yycp-channelManager/agreement/updateStatus") suspend fun updateAuthorize(@FieldMap updateStatus: Map): BaseResponse + //查询是否要授权 + @FormUrlEncoded + @POST("yycp-channelManager/agreement/queryUserAuthorizeStatusByType") + suspend fun checkIfNeedAuthorize(@FieldMap needAuthorize: Map): BaseResponse + } \ No newline at end of file From 8b9096a6be8624619377ecdde68e77e52ddd327a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Apr 2020 17:37:47 +0800 Subject: [PATCH 7/7] fix bug of ANR -> Async Html load text --- .../module/authorize/fragment/AuthorizeFragment.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizeFragment.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizeFragment.kt index 324dd747c3..8d865b3256 100644 --- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizeFragment.kt +++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/fragment/AuthorizeFragment.kt @@ -15,6 +15,10 @@ import com.mogo.module.authorize.voice.IVoiceCommandListener import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener import com.mogo.module.authorize.voice.VoiceUtil import com.mogo.utils.logger.Logger +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.async +import kotlinx.coroutines.withContext class AuthorizeFragment : MvpFragment(), AuthorizeContract.View, View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener { @@ -105,7 +109,12 @@ class AuthorizeFragment : MvpFragment