Merge branch 'feature/v1.0.3' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v1.0.3
This commit is contained in:
@@ -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
|
||||
@@ -43,6 +45,8 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.material
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.guideshowprovider
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.guideshow.provider.GuideShowProviderConstant;
|
||||
import com.mogo.module.guideshow.provider.IGuideShowProvider;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
@@ -30,12 +32,14 @@ public class AppServiceHandler {
|
||||
private static IMogoServiceApis mApis;
|
||||
private static IMogoCardManager mMogoCardManager;
|
||||
private static IMogoAnalytics mMogoAnalytics;
|
||||
private static IGuideShowProvider mMogoGuideShow;
|
||||
|
||||
|
||||
public static void init( final Context context ) {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
|
||||
mMogoCardManager = mApis.getCardManagerApi();
|
||||
mMogoAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoGuideShow = (IGuideShowProvider) ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation(context);
|
||||
|
||||
}
|
||||
public static IMogoCardManager getMogoCardManager() {
|
||||
@@ -44,4 +48,8 @@ public class AppServiceHandler {
|
||||
public static IMogoAnalytics getMogoAnalytics() {
|
||||
return mMogoAnalytics;
|
||||
}
|
||||
|
||||
public static IGuideShowProvider getMogoGuideShow() {
|
||||
return mMogoGuideShow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +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.GuideShowLauncher;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -18,16 +19,19 @@ import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppsPresenter extends Presenter< AppsView > {
|
||||
public class AppsPresenter extends Presenter<AppsView> {
|
||||
|
||||
private static final String TAG = "AppsPresenter";
|
||||
|
||||
@@ -37,81 +41,102 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
private IMogoCardManager mCardManager;
|
||||
private IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
public AppsPresenter( AppsView view ) {
|
||||
super( view );
|
||||
mCardManager = ( IMogoCardManager ) ARouter.getInstance().build( MogoServicePaths.PATH_CARD_MANAGER ).navigation( getContext() );
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher( this, mCardManager );
|
||||
cardAppLauncher.setNext( new AppLauncher() );
|
||||
public AppsPresenter(AppsView view) {
|
||||
super(view);
|
||||
mCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(getContext());
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher(this, mCardManager);
|
||||
cardAppLauncher.setNext(new GuideShowLauncher());
|
||||
cardAppLauncher.setNext(new AppLauncher());
|
||||
mLauncher = cardAppLauncher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
renderAppsList();
|
||||
AppsListChangedLiveData.getInstance().observeForever( bool -> {
|
||||
if ( mView != null ) {
|
||||
AppsListChangedLiveData.getInstance().observeForever(bool -> {
|
||||
if (mView != null) {
|
||||
renderAppsList();
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() );
|
||||
mMogoStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation();
|
||||
mMogoStatusManager.setAppListUIShow( TAG, true );
|
||||
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(getContext());
|
||||
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation();
|
||||
mMogoStatusManager.setAppListUIShow(TAG, true);
|
||||
}
|
||||
|
||||
private void renderAppsList() {
|
||||
ThreadPoolService.execute( () -> {
|
||||
AppsModel.getInstance( getContext() ).load( appInfoList -> {
|
||||
ThreadPoolService.execute(() -> {
|
||||
AppsModel.getInstance(getContext()).load(appInfoList -> {
|
||||
|
||||
Logger.d( TAG, "apps: %s", appInfoList );
|
||||
UiThreadHandler.post( () -> {
|
||||
if ( mView != null ) {
|
||||
mView.renderApps( appInfoList );
|
||||
Logger.d(TAG, "apps: %s", appInfoList);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (mView != null) {
|
||||
mView.renderApps(addGuideAppEntrance(appInfoList));
|
||||
}
|
||||
} );
|
||||
} );
|
||||
});
|
||||
});
|
||||
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
public void launch( AppInfo appInfo ) {
|
||||
if ( appInfo == null ) {
|
||||
private Map<Integer, List<AppInfo>> addGuideAppEntrance(Map<Integer, List<AppInfo>> appInfoMap) {
|
||||
Map<Integer, List<AppInfo>> result;
|
||||
if (appInfoMap == null) {
|
||||
result = new HashMap<>();
|
||||
} else {
|
||||
result = new HashMap<>();
|
||||
result.putAll(appInfoMap);
|
||||
}
|
||||
if (result.isEmpty()) {
|
||||
result.put(0, new ArrayList<>());
|
||||
} else if (result.get(result.size() - 1) == null) {
|
||||
result.put(result.size() - 1, new ArrayList<>());
|
||||
} else if (result.get(result.size() - 1).size() == AppsConst.TOTAL_SIZE_EACH_PAGE) {
|
||||
result.put(result.size(), new ArrayList<>());
|
||||
}
|
||||
// 添加逻辑
|
||||
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;
|
||||
}
|
||||
|
||||
public void launch(AppInfo appInfo) {
|
||||
if (appInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
trackAppClicked( appInfo );
|
||||
trackAppClicked(appInfo);
|
||||
try {
|
||||
mLauncher.launch( getContext(), appInfo );
|
||||
} catch ( Exception e ) {
|
||||
mLauncher.launch(getContext(), appInfo);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void trackAppClicked( AppInfo appInfo ) {
|
||||
if ( appInfo == null ) {
|
||||
private void trackAppClicked(AppInfo appInfo) {
|
||||
if (appInfo == null) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", appInfo.getName() );
|
||||
properties.put( "packagename", appInfo.getPackageName() );
|
||||
properties.put( "appversion", appInfo.getVersionName() );
|
||||
properties.put( "from", 1 );
|
||||
mAnalytics.track( "appenterfront", properties );
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("appname", appInfo.getName());
|
||||
properties.put("packagename", appInfo.getPackageName());
|
||||
properties.put("appversion", appInfo.getVersionName());
|
||||
properties.put("from", 1);
|
||||
mAnalytics.track("appenterfront", properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
mMogoStatusManager.setAppListUIShow( TAG, false );
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
mMogoStatusManager.setAppListUIShow(TAG, false);
|
||||
AppsListChangedLiveData.getInstance().release();
|
||||
mView = null;
|
||||
mLauncher.destroy();
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
if ( mView != null ) {
|
||||
if (mView != null) {
|
||||
mView.exit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
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 = "新手引导";
|
||||
|
||||
@Override
|
||||
public void launch(Context context, AppInfo appInfo) {
|
||||
if (appInfo != null && APP_INFO_NAME_GUIDE_SHOW.equals(appInfo.getName())) {
|
||||
AppServiceHandler.getMogoGuideShow().playGuideVideo((s) -> {
|
||||
Logger.d(TAG, s);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (getNext() != null) {
|
||||
getNext().destroy();
|
||||
setNext(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -1,6 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-apps</string>
|
||||
<string name="module_apps_str_no_app">APP 未安装</string>
|
||||
<string name="module_apps_str_no_guide_show">新手引导服务未加载</string>
|
||||
<string-array name="module_apps_array_filter_packages">
|
||||
<item>com.mogo.launcher</item>
|
||||
</string-array>
|
||||
|
||||
@@ -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(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,10 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
}
|
||||
}
|
||||
|
||||
fun resetShowStatus(){
|
||||
showAuthorizeView = false
|
||||
}
|
||||
|
||||
private inline fun pushFragmentToMainView(tag: String, push: (() -> Unit)) {
|
||||
val builderWrapper = FragmentDescriptor.Builder().fragment(AuthorizeFragment(tag)).build()
|
||||
Logger.d(TAG, "pushFragmentToMainView")
|
||||
|
||||
@@ -86,8 +86,9 @@ class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
Logger.d(TAG, "onDestroy invokeTag : $invokeTag")
|
||||
mogoAuthShow.resetShowStatus()
|
||||
invokeTag?.let {
|
||||
MogoAuthorizeRegisterHandler.getAuthorizeContentListener(it)?.requestContentFailed("user exit authorize by back press")
|
||||
MogoAuthorizeRegisterHandler.getAuthorizeContentListener(it)?.requestContentFailed("user exit authorize --- onDestroy")
|
||||
MogoAuthorizeRegisterHandler.getAuthorizeListener(it)?.authorizeFailed("user exit authorize by back press")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,27 +18,36 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoading"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_147"
|
||||
android:layout_marginTop="@dimen/dp_335"
|
||||
android:src="@mipmap/module_authorize_loading"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoading"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:text="@string/module_authorize_agreement_loading"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="@dimen/dp_44"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoading" />
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoading"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_147"
|
||||
android:src="@mipmap/module_authorize_loading"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:text="@string/module_authorize_agreement_loading"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="@dimen/dp_44"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoading" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideFinish
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
object GuideBizManager {
|
||||
@@ -48,11 +49,14 @@ object GuideBizManager {
|
||||
}
|
||||
|
||||
fun invokeAuthorize() {
|
||||
val authorizeInvoke = ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation()
|
||||
if (authorizeInvoke is IMogoAuthorizeModuleManager) {
|
||||
if (authorizeInvoke.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
authorizeInvoke.invokeAuthorizeForShow()
|
||||
UiThreadHandler.postDelayed({
|
||||
val authorizeInvoke = ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation()
|
||||
if (authorizeInvoke is IMogoAuthorizeModuleManager) {
|
||||
if (authorizeInvoke.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
authorizeInvoke.invokeAuthorizeForShow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 3000L)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 322 KiB After Width: | Height: | Size: 323 KiB |
@@ -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