fix bug
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -78,6 +78,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
@@ -94,6 +95,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
@@ -104,6 +106,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
@@ -114,6 +117,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
@@ -130,6 +134,7 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.CONSTRUCTOR;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
@Target({TYPE, METHOD, CONSTRUCTOR})
|
||||
@Retention(RUNTIME)
|
||||
public @interface VoiceIntentTrack {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.CONSTRUCTOR;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
@Target({TYPE, METHOD, CONSTRUCTOR})
|
||||
@Retention(RUNTIME)
|
||||
public @interface VoiceTrack {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.applaunch.AppLaunchFilter;
|
||||
import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
import com.mogo.module.apps.applaunch.CardAppLauncher;
|
||||
import com.mogo.module.apps.applaunch.GuideShowLauncher111;
|
||||
import com.mogo.module.apps.applaunch.GuideShowLauncher;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -45,7 +45,7 @@ public class AppsPresenter extends Presenter<AppsView> {
|
||||
super(view);
|
||||
mCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(getContext());
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher(this, mCardManager);
|
||||
cardAppLauncher.setNext(new GuideShowLauncher111());
|
||||
cardAppLauncher.setNext(new GuideShowLauncher());
|
||||
cardAppLauncher.setNext(new AppLauncher());
|
||||
mLauncher = cardAppLauncher;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class AppsPresenter extends Presenter<AppsView> {
|
||||
result.put(result.size(), new ArrayList<>());
|
||||
}
|
||||
// 添加逻辑
|
||||
result.get(result.size() - 1).add(new AppInfo(GuideShowLauncher111.Companion.getAPP_INFO_NAME_GUIDE_SHOW(), getContext().getPackageName(), null, 0, null, R.drawable.module_apps_ic_guide_show));
|
||||
result.get(result.size() - 1).add(new AppInfo(GuideShowLauncher.APP_INFO_NAME_GUIDE_SHOW, getContext().getPackageName(), null, 0, null, R.drawable.module_apps_ic_guide_show));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,24 @@ package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
public class GuideShowLauncher extends BaseAppLauncher {
|
||||
|
||||
public static final String TAG = "GuideShowLauncher";
|
||||
public static final String APP_INFO_NAME_GUIDE_SHOW = "APP_INFO_NAME_GUIDE_SHOW";
|
||||
public static final String APP_INFO_NAME_GUIDE_SHOW = "新手引导";
|
||||
|
||||
@Override
|
||||
public void launch(Context context, AppInfo appInfo) {
|
||||
if (appInfo != null && APP_INFO_NAME_GUIDE_SHOW.equals(appInfo.getName())) {
|
||||
// AppServiceHandler.getMogoGuideShow().playGuideVideo(s -> );
|
||||
AppServiceHandler.getMogoGuideShow().playGuideVideo((s) -> {
|
||||
Logger.d(TAG, s);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.apps.applaunch
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.module.apps.AppServiceHandler
|
||||
import com.mogo.module.apps.R
|
||||
import com.mogo.module.apps.model.AppInfo
|
||||
import com.mogo.utils.TipToast
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class GuideShowLauncher111 : BaseAppLauncher() {
|
||||
|
||||
companion object {
|
||||
const val TAG = "GuideShowLauncher111"
|
||||
val APP_INFO_NAME_GUIDE_SHOW = "APP_INFO_NAME_GUIDE_SHOW"
|
||||
}
|
||||
|
||||
override fun launch(context: Context, appInfo: AppInfo) {
|
||||
if (appInfo != null && APP_INFO_NAME_GUIDE_SHOW == appInfo.name) {
|
||||
try {
|
||||
AppServiceHandler.getMogoGuideShow().playGuideVideo {
|
||||
Logger.e(TAG, it)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.e(TAG, e, "error.")
|
||||
TipToast.shortTip(R.string.module_apps_str_no_guide_show)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun destroy() {
|
||||
if (next != null) {
|
||||
next.destroy()
|
||||
next = null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'android-aspectjx'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -50,6 +51,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.aspectj
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.mogo.module.authorize.aspectj
|
||||
|
||||
class VoiceForbiddenTrackPoint {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.module.authorize.aspectj
|
||||
|
||||
import org.aspectj.lang.annotation.Aspect
|
||||
import org.aspectj.lang.annotation.Pointcut
|
||||
|
||||
@Aspect
|
||||
class VoiceForbiddenWhenAuthorize {
|
||||
|
||||
companion object{
|
||||
const val TAG = "VoiceForbiddenWhenAuthorize"
|
||||
}
|
||||
|
||||
@Pointcut()
|
||||
fun authorizeTrackPoint(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'android-aspectjx'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -50,6 +51,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxviewpager2
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.aspectj
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.voice.VoiceIntentTrack;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -59,21 +60,22 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
|
||||
public MogoReceiver( Context context ) {
|
||||
mMogoIntentManager = ( IMogoIntentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_INTENT_MANAGER ).navigation( context );
|
||||
public MogoReceiver(Context context) {
|
||||
mMogoIntentManager = (IMogoIntentManager) ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation(context);
|
||||
}
|
||||
|
||||
@VoiceIntentTrack
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
Logger.i( TAG, "receive intent action: %s", action );
|
||||
if ( TextUtils.equals( VOICE_ACTION, action ) ) {
|
||||
String cmd = intent.getStringExtra( PARAM_COMMAND );
|
||||
if ( !TextUtils.isEmpty( cmd ) ) {
|
||||
mMogoIntentManager.invoke( cmd, intent );
|
||||
Logger.i(TAG, "receive intent action: %s", action);
|
||||
if (TextUtils.equals(VOICE_ACTION, action)) {
|
||||
String cmd = intent.getStringExtra(PARAM_COMMAND);
|
||||
if (!TextUtils.isEmpty(cmd)) {
|
||||
mMogoIntentManager.invoke(cmd, intent);
|
||||
}
|
||||
} else {
|
||||
mMogoIntentManager.invoke( action, intent );
|
||||
mMogoIntentManager.invoke(action, intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user