fix bug and add voice wakeupCmd
This commit is contained in:
@@ -11,8 +11,8 @@ 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.module.authorize.util.SharedPreferenceUtil.hasAuth
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
@@ -63,7 +63,7 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
if (hasGuide() && !hasAuth(0)) {
|
||||
if (hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
mogoAuthShow.invokeAuthorizeForShow()
|
||||
} else {
|
||||
Logger.d(TAG, "wait for guide invoke")
|
||||
|
||||
@@ -16,15 +16,11 @@ object MogoAuthorizeMainController : IMogoAuthorizeController() {
|
||||
|
||||
@Synchronized
|
||||
fun agreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
val acquireAuthListener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
|
||||
updateAuthorize(agrId, AGREEMENT_EFFECT, {
|
||||
if (acquireAuthListener != null) {
|
||||
setAuthorizeStatus(tag.toAuthorizeType(), true)
|
||||
acquireAuthListener.authorizeSuccess()
|
||||
onSuccess.invoke()
|
||||
} else {
|
||||
Logger.d(TAG, "agreeAuthorize --- can not find listener by this tag :$tag ")
|
||||
}
|
||||
authorizeSuccess(tag)
|
||||
setAuthorizeStatus(tag.toAuthorizeType(), true)
|
||||
onSuccess.invoke()
|
||||
}, {
|
||||
val errorMsg = it ?: "agreeAuthorize failed,please check network"
|
||||
authorizeFailed(tag, errorMsg)
|
||||
@@ -67,4 +63,12 @@ object MogoAuthorizeMainController : IMogoAuthorizeController() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun authorizeSuccess(tag: String) {
|
||||
val acquireAuthListener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
if (acquireAuthListener != null) {
|
||||
acquireAuthListener.authorizeSuccess()
|
||||
} else {
|
||||
Logger.d(TAG, "agreeAuthorize --- can not find listener by this tag :$tag ")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,7 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Logger.d(TAG,"onDestroy")
|
||||
VoiceUtil.unregisterAll(context!!, this)
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ object VoiceUtil {
|
||||
}
|
||||
|
||||
//WakeUp Command (Intent)
|
||||
const val VOICE_INTENT_AGREE = "system.application.operation" //同意
|
||||
const val VOICE_INTENT_DISAGREE = "system.application.operation" //不同意
|
||||
const val VOICE_INTENT_AGREE = "com.zhidao.agree" //同意
|
||||
const val VOICE_INTENT_DISAGREE = "com.zhiao.disagree" //不同意
|
||||
|
||||
//unWakeUp Command
|
||||
const val VOICE_REGISTER_AUTHORIZE_AGREE = "CMD_AUTHORIZATION_AGREE"
|
||||
|
||||
Reference in New Issue
Block a user