This commit is contained in:
unknown
2020-03-30 13:56:07 +08:00
parent cd71667f07
commit 029f6d817c
15 changed files with 129 additions and 55 deletions

View File

@@ -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
}
}
}

View File

@@ -52,4 +52,9 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
private fun invokeAuthorize() {
GuideBizManager.invokeAuthorize()
}
override fun onDestroy() {
super.onDestroy()
invokeAuthorize()
}
}