add guide
This commit is contained in:
@@ -12,6 +12,7 @@ import com.mogo.map.navi.IMogoNaviListener
|
||||
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.module.authorize.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.auth.IMogoAuthManager
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
@@ -24,7 +25,7 @@ class MogoAuthorizeProvider : IMogoAuthManager {
|
||||
const val TAG = "MogoAuthorizeProvider"
|
||||
}
|
||||
|
||||
private var mContext:Context? = null
|
||||
private var mContext: Context? = null
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
@@ -62,10 +63,11 @@ class MogoAuthorizeProvider : IMogoAuthManager {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun showAuth(context: Context?) {
|
||||
override fun showAuth(context: Context) {
|
||||
mContext = context
|
||||
if (mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
mogoAuthShow.invokeAuthorizeForShow(mContext!!)
|
||||
mogoAuthShow.initContext(context)
|
||||
if (hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
mogoAuthShow.invokeAuthorizeForShow()
|
||||
} else {
|
||||
//首次进入Launcher同步一下授权状态,防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
|
||||
mogoAuthShow.updateAuthorizeStatus(AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
@@ -78,9 +80,7 @@ class MogoAuthorizeProvider : IMogoAuthManager {
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
//todo 引导判断暂时去掉 后续引导流程更改完再放开
|
||||
// todo if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
// todo F系列暂时没有授权功能 1.1需求中添加 全量上
|
||||
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String? {
|
||||
|
||||
@@ -39,8 +39,11 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
MogoAuthorizeMainController.disAgreeAuthorize(tag, agrId, onSuccess, onError)
|
||||
}
|
||||
|
||||
fun invokeAuthorizeForShow(context: Context) {
|
||||
mContext = context
|
||||
fun initContext(mContext: Context) {
|
||||
this.mContext = mContext
|
||||
}
|
||||
|
||||
fun invokeAuthorizeForShow() {
|
||||
pushLayoutToMainWindow(AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
}
|
||||
|
||||
@@ -74,7 +77,7 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
}
|
||||
|
||||
private fun pushLayoutToMainWindow(tag: String) {
|
||||
if(mContext == null){
|
||||
if (mContext == null) {
|
||||
Logger.d(TAG, "Because of mContext has no init, the application has in background now")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.mogo.module.authorize.authprovider.module
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
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.launcher.MogoMainAuthorize.Companion.mogoAuthShow
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
|
||||
class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMogoAuthorizeModuleProvider {
|
||||
|
||||
@@ -14,13 +17,21 @@ class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IM
|
||||
}
|
||||
|
||||
override fun invokeAuthorizeForShow() {
|
||||
mogoAuthShow.invokeAuthorizeForShow(AbsMogoApplication.getApp().applicationContext)
|
||||
mogoAuthShow.invokeAuthorizeForShow()
|
||||
}
|
||||
|
||||
override fun invokeAuthorization(tag: String) {
|
||||
if(!SharedPreferenceUtil.hasGuide()){
|
||||
val guideService = ARouter.getInstance().build("/guide/showFragment").navigation()
|
||||
if(guideService is IMogoModuleProvider){
|
||||
guideService.init(AbsMogoApplication.getApp().applicationContext)
|
||||
}
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
listener?.authorizeFailed("需要先执行用户引导")
|
||||
return
|
||||
}
|
||||
mogoAuthShow.showAuthorizeView(tag, {
|
||||
//todo SP存储状态
|
||||
|
||||
}, { errorMsg ->
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
listener?.authorizeFailed(errorMsg)
|
||||
|
||||
Reference in New Issue
Block a user