diff --git a/.idea/misc.xml b/.idea/misc.xml
index 707ee6e613..2dc54c489f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java
index f3f83666ce..72d382f0c8 100644
--- a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java
@@ -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 ) ) {
diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceIntentTrack.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceIntentTrack.java
new file mode 100644
index 0000000000..8c1a6c9b75
--- /dev/null
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceIntentTrack.java
@@ -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 {
+
+}
\ No newline at end of file
diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceTrack.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceTrack.java
new file mode 100644
index 0000000000..d1ef2c606f
--- /dev/null
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/VoiceTrack.java
@@ -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 {
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-apps/build.gradle b/modules/mogo-module-apps/build.gradle
index 6cc0e4af87..e9dc018ba2 100644
--- a/modules/mogo-module-apps/build.gradle
+++ b/modules/mogo-module-apps/build.gradle
@@ -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
diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java
index 3abd4baaf0..53e4c9d5ce 100644
--- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java
+++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java
@@ -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 {
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 {
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;
}
diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher.java
index 34d02c0831..57b57acfd4 100644
--- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher.java
+++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher.java
@@ -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;
+ });
}
}
diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher111.kt b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher111.kt
deleted file mode 100644
index 2abfc24ba8..0000000000
--- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/applaunch/GuideShowLauncher111.kt
+++ /dev/null
@@ -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
- }
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-authorize/build.gradle b/modules/mogo-module-authorize/build.gradle
index 9ef6135d63..48d0307be6 100644
--- a/modules/mogo-module-authorize/build.gradle
+++ b/modules/mogo-module-authorize/build.gradle
@@ -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
diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenTrackPoint.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenTrackPoint.kt
deleted file mode 100644
index 4517f18e9c..0000000000
--- a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenTrackPoint.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.mogo.module.authorize.aspectj
-
-class VoiceForbiddenTrackPoint {
-}
\ No newline at end of file
diff --git a/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenWhenAuthorize.kt b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenWhenAuthorize.kt
new file mode 100644
index 0000000000..c64cf27a3d
--- /dev/null
+++ b/modules/mogo-module-authorize/src/main/java/com/mogo/module/authorize/aspectj/VoiceForbiddenWhenAuthorize.kt
@@ -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(){
+
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-guide/build.gradle b/modules/mogo-module-guide/build.gradle
index 00d3b373cd..a4b654ad75 100644
--- a/modules/mogo-module-guide/build.gradle
+++ b/modules/mogo-module-guide/build.gradle
@@ -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
diff --git a/modules/mogo-module-guide/src/main/java/com/mogo/module/guide/aspectj/VoiceForbiddenWhenGuide.kt b/modules/mogo-module-guide/src/main/java/com/mogo/module/guide/aspectj/VoiceForbiddenWhenGuide.kt
new file mode 100644
index 0000000000..f1ed41e2b9
--- /dev/null
+++ b/modules/mogo-module-guide/src/main/java/com/mogo/module/guide/aspectj/VoiceForbiddenWhenGuide.kt
@@ -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
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-guide/src/main/java/com/mogo/module/guide/fragment/GuideFragment.kt b/modules/mogo-module-guide/src/main/java/com/mogo/module/guide/fragment/GuideFragment.kt
index 49e38411b6..86b7a0b8cd 100644
--- a/modules/mogo-module-guide/src/main/java/com/mogo/module/guide/fragment/GuideFragment.kt
+++ b/modules/mogo-module-guide/src/main/java/com/mogo/module/guide/fragment/GuideFragment.kt
@@ -52,4 +52,9 @@ class GuideFragment : MvpFragment(), GuideC
private fun invokeAuthorize() {
GuideBizManager.invokeAuthorize()
}
+
+ override fun onDestroy() {
+ super.onDestroy()
+ invokeAuthorize()
+ }
}
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java
index 1faa275105..50160dc874 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java
@@ -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);
}
}
}