wait continue

This commit is contained in:
unknown
2020-03-27 17:15:28 +08:00
parent c28ddf9200
commit 49ff2e7d44
5 changed files with 23 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
package com.mogo.module.authorize.authprovider.biz
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
import com.mogo.module.authorize.model.BaseResponse
import com.mogo.module.authorize.model.IMogoAuthorizeModel
@@ -53,6 +54,10 @@ open class IMogoAuthorizeController {
}
}
private fun realInvokeAuthorizeContent(){
}
private inline fun getAuthorizeContentListener(tag: String, blockSuccess: ((IMogoAuthorizeContentListener) -> Unit), blockNull: (() -> Unit)) {
val authorizeContentListener = MogoAuthorizeRegisterHandler.getAuthorizeContentListener(tag)
if (authorizeContentListener != null) {
@@ -62,4 +67,7 @@ open class IMogoAuthorizeController {
}
}
fun updateAgreementAndAuthorization(agreementType: Int) {
invokeAuthorizeContent(AUTHORIZE_TYPE_LAUNCHER_MAIN, agreementType)
}
}

View File

@@ -11,16 +11,16 @@ open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
private val baseController: IMogoAuthorizeController by lazy { IMogoAuthorizeController() }
override fun needAuthorize(): Boolean {
return needAuthorization()
override fun needAuthorize(tag: String): Boolean {
val type = AuthorizeProxy.getAuthorizeType(tag)
return needAuthorization(type)
}
override fun invokeAuthorizeContent(tag: String) {
//todo 后面动态代理统一处理校验问题
Logger.d("invokeAuthorizeContent","tag:$tag")
Logger.d("invokeAuthorizeContent", "tag:$tag")
val agreementType = AuthorizeProxy.getAuthorizeType(tag)
Logger.d("invokeAuthorizeContent","agreementType:$agreementType")
Logger.d("invokeAuthorizeContent", "agreementType:$agreementType")
baseController.invokeAuthorizeContent(tag, agreementType)
}

View File

@@ -8,7 +8,7 @@ interface IMogoAuthorizeInvoke : IMogoAuthorizeRegister {
/**
* 是否需要授权
*/
fun needAuthorize(): Boolean
fun needAuthorize(tag:String): Boolean
/**
* 获取授权内容

View File

@@ -6,6 +6,7 @@ import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeManagerImpl
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
import com.mogo.module.authorize.fragment.AuthorizeFragment
import com.mogo.module.authorize.model.proxy.AuthorizeProxy
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasAuth
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
@@ -60,7 +61,8 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
onError.invoke("invoke should be in main thread")
return
}
if (hasAuth()) {
val type = AuthorizeProxy.getAuthorizeType(tag)
if (hasAuth(type)) {
onError.invoke("already authorize,do not repeat operation")
return
}

View File

@@ -7,15 +7,15 @@ object SharedPreferenceUtil {
private const val HAS_AUTH = "HAS_AUTH"
fun needAuthorization(): Boolean {
return !hasAuth()
fun needAuthorization(type: Int): Boolean {
return !hasAuth(type)
}
fun hasAuth(): Boolean {
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(HAS_AUTH, false)
fun hasAuth(type: Int): Boolean {
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(HAS_AUTH + type, false)
}
fun setAuthorizeStatus() {
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(HAS_AUTH, true)
fun setAuthorizeStatus(type: Int) {
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(HAS_AUTH + type, true)
}
}