fix bug
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.authorize.aspectj
|
||||
|
||||
import com.mogo.module.guide.util.SharedPreferenceUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
import org.aspectj.lang.ProceedingJoinPoint
|
||||
import org.aspectj.lang.annotation.Aspect
|
||||
import org.aspectj.lang.annotation.Before
|
||||
import org.aspectj.lang.annotation.Pointcut
|
||||
|
||||
@Aspect
|
||||
class VoiceForbiddenWhenGuide {
|
||||
|
||||
companion object {
|
||||
const val TAG = "VoiceForbiddenWhenGuide"
|
||||
}
|
||||
|
||||
@Pointcut("within(@com.mogo.commons.voice.VoiceTrack *)")
|
||||
fun withinAuthorizeClass() {
|
||||
}
|
||||
|
||||
@Pointcut("execution(!synthetic * *(..))&& withinAuthorizeClass()")
|
||||
fun methodInsideAuthorize() {
|
||||
}
|
||||
|
||||
@Pointcut("execution(@com.mogo.commons.voice.VoiceTrack * *(..))|| methodInsideAuthorize()")
|
||||
fun authorizeTrackPoint() {
|
||||
}
|
||||
|
||||
@Before("authorizeTrackPoint()")
|
||||
fun trackVoiceWhenAuthorize(joinPoint: ProceedingJoinPoint) {
|
||||
Logger.d(TAG, "trackVoiceWhenAuthorize")
|
||||
val msg = joinPoint.args[0] as String
|
||||
if (SharedPreferenceUtil.hasGuide()) {
|
||||
Logger.d(TAG, "proceed,no interception")
|
||||
joinPoint.proceed()
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,4 +52,9 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
|
||||
private fun invokeAuthorize() {
|
||||
GuideBizManager.invokeAuthorize()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
invokeAuthorize()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user