Ver código fonte

解决会员到期以及引导页问题

zk 1 ano atrás
pai
commit
8b0c5af7a8

+ 2 - 0
app/src/main/java/com/atmob/voiceai/data/repositories/MemberRepository.java

@@ -165,6 +165,8 @@ public class MemberRepository {
                         refreshMemberHandler.removeCallbacksAndMessages(null);
                         if (memberInfo.isIsMember()) {
                             refreshMemberHandler.postDelayed(this::refreshUserData, memberInfo.getExpireTime() - memberInfo.getTimestamp());
+                        } else {
+                            VoiceAIRepository.getVoiceAIRepository().refreshVoiceInfo();
                         }
                     }
                 });

+ 23 - 2
app/src/main/java/com/atmob/voiceai/data/repositories/VoiceAIRepository.java

@@ -1,9 +1,12 @@
 package com.atmob.voiceai.data.repositories;
 
 
+import android.app.Application;
+
 import androidx.annotation.IntDef;
 import androidx.lifecycle.LiveData;
 import androidx.lifecycle.MutableLiveData;
+import androidx.lifecycle.Observer;
 
 import com.atmob.app.lib.handler.RxHttpHandler;
 import com.atmob.app.lib.livedata.SingleLiveEvent;
@@ -21,6 +24,8 @@ import com.atmob.voiceai.data.api.response.VoiceInfoResponse;
 import com.atmob.voiceai.data.api.response.VoiceListResponse;
 import com.atmob.voiceai.data.api.response.VoiceTypeResponse;
 import com.atmob.voiceai.data.consts.ErrorCode;
+import com.atmob.voiceai.handlers.EventHandler;
+import com.atmob.voiceai.sdk.firebase.FirebaseHelper;
 import com.atmob.voiceai.utils.BoxingUtil;
 import com.atmob.voiceai.utils.ThreePair;
 
@@ -32,6 +37,10 @@ import atmob.reactivex.rxjava3.core.Single;
 import atmob.reactivex.rxjava3.core.SingleObserver;
 import atmob.reactivex.rxjava3.disposables.Disposable;
 import atmob.rxjava.utils.RxJavaUtil;
+import dagger.hilt.EntryPoint;
+import dagger.hilt.InstallIn;
+import dagger.hilt.android.EntryPointAccessors;
+import dagger.hilt.components.SingletonComponent;
 
 @Singleton
 public class VoiceAIRepository {
@@ -68,7 +77,6 @@ public class VoiceAIRepository {
         this.atmobApi = atmobApi;
         this.memberRepository = memberRepository;
         this.historyRepository = historyRepository;
-        refreshVoiceInfo();
     }
 
     public void setUseClonedVoiceEvent(int id) {
@@ -112,7 +120,7 @@ public class VoiceAIRepository {
     }
 
 
-    private void refreshVoiceInfo() {
+    public void refreshVoiceInfo() {
         if (isRequestFreeGenerate || BoxingUtil.boxing(memberRepository.getIsMember().getValue())) {
             return;
         }
@@ -210,4 +218,17 @@ public class VoiceAIRepository {
     }
 
 
+    public static VoiceAIRepository getVoiceAIRepository() {
+        Application application = ContextUtil.getApplication();
+        VoiceAIRepositoryEntryPoint entryPoint = EntryPointAccessors.fromApplication(application, VoiceAIRepositoryEntryPoint.class);
+        return entryPoint.voiceAIRepository();
+    }
+
+
+    @EntryPoint
+    @InstallIn(SingletonComponent.class)
+    interface VoiceAIRepositoryEntryPoint {
+        VoiceAIRepository voiceAIRepository();
+    }
+
 }

+ 4 - 2
app/src/main/java/com/atmob/voiceai/module/splash/SplashActivity.java

@@ -67,7 +67,10 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
             } else if (SplashViewModel.GUIDE_PAGE_3 == current) {
                 EventHandler.report(EventId.start_001);
                 startGuideLeave(binding.ivGuideHeader2, binding.tvGuideHeader2, binding.ivGuide2);
-                new Handler().postDelayed(() -> binding.tvNextStep.animate().alpha(0).setDuration(200).start(), 400);
+                new Handler().postDelayed(() -> {
+                    binding.tvNextStep.animate().alpha(0).setDuration(200).start();
+                    binding.vGuideMask.setAlpha(1);
+                }, 400);
                 showEndGuide();
             } else if (SplashViewModel.GUIDE_PAGE_END == current) {
                 EventHandler.report(EventId.startbutton_001);
@@ -85,7 +88,6 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
         binding.tvPractical.setVisibility(View.VISIBLE);
         binding.tvGuideDone.setVisibility(View.VISIBLE);
         binding.tvPrivacyPolicy.setVisibility(View.VISIBLE);
-        binding.vGuideMask.setAlpha(1);
         String allTxt = getString(R.string.splash_privacy_all_txt);
         String targetTxt1 = getString(R.string.splash_privacy_policy);
         String targetTxt2 = getString(R.string.splash_terms_of_service);

+ 1 - 0
app/src/main/res/layout/activity_splash.xml

@@ -177,6 +177,7 @@
                 app:layout_constraintVertical_bias="0.8732394366197183"
                 app:layout_constraintWidth_percent="0.6666666666666667" />
 
+
             <TextView
                 android:id="@+id/tv_privacy_policy"
                 android:layout_width="0dp"