Browse Source

增加埋点

zk 2 years ago
parent
commit
7d50fd2930
21 changed files with 148 additions and 19 deletions
  1. 1 0
      app/src/main/java/com/atmob/voiceai/data/consts/ErrorCode.java
  2. 12 6
      app/src/main/java/com/atmob/voiceai/data/consts/EventId.java
  3. 24 0
      app/src/main/java/com/atmob/voiceai/data/repositories/CloneRepository.java
  4. 5 1
      app/src/main/java/com/atmob/voiceai/data/repositories/MemberRepository.java
  5. 1 6
      app/src/main/java/com/atmob/voiceai/module/clonevoice/CloneVoiceFragment.java
  6. 6 0
      app/src/main/java/com/atmob/voiceai/module/clonevoice/CloneVoiceViewModel.java
  7. 3 0
      app/src/main/java/com/atmob/voiceai/module/generating/VoiceGeneratingViewModel.java
  8. 3 0
      app/src/main/java/com/atmob/voiceai/module/history/HistoryViewModel.java
  9. 22 0
      app/src/main/java/com/atmob/voiceai/module/main/MainActivity.java
  10. 5 0
      app/src/main/java/com/atmob/voiceai/module/result/VoiceResultActivity.java
  11. 5 0
      app/src/main/java/com/atmob/voiceai/module/result/VoiceResultViewModel.java
  12. 6 0
      app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionAdapter.java
  13. 5 0
      app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionPageActivity.java
  14. 25 2
      app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionPageViewModel.java
  15. 3 0
      app/src/main/java/com/atmob/voiceai/module/voiceai/VoiceAIFragment.java
  16. 9 0
      app/src/main/java/com/atmob/voiceai/module/voiceai/VoiceAIViewModel.java
  17. 4 0
      app/src/main/java/com/atmob/voiceai/sdk/billing/BillingStrategy.java
  18. 4 0
      app/src/main/java/com/atmob/voiceai/sdk/billing/GPBillingClient.java
  19. 1 0
      app/src/main/res/layout/activity_subscription_page.xml
  20. 2 2
      app/src/main/res/layout/fragment_clone_voice.xml
  21. 2 2
      build.gradle

+ 1 - 0
app/src/main/java/com/atmob/voiceai/data/consts/ErrorCode.java

@@ -3,4 +3,5 @@ package com.atmob.voiceai.data.consts;
 public interface ErrorCode {
 
     int ERROR_NOT_SUBSCRIBED = 4002;
+    int ERROR_SUBSCRIPTION_NOT_FOUND = 2001;
 }

+ 12 - 6
app/src/main/java/com/atmob/voiceai/data/consts/EventId.java

@@ -1,8 +1,11 @@
 package com.atmob.voiceai.data.consts;
 
 
+import com.google.common.eventbus.Subscribe;
+
 public interface EventId {
 
+    String ID = "id";
     String guide_001 = "guide_001"; //   引导页1	进入页面
     String guide_002 = "guide_002"; //   引导页2	进入页面
     String start_001 = "start_001"; //   开始页	进入页面
@@ -28,12 +31,15 @@ public interface EventId {
     String historyclick_001 = "historyclick_001"; //   history页-点击列表数据项	按钮点击
     String purchase_001 = "purchase_001"; //   订阅页面	进入页面
     String purchaseclose_001 = "purchaseclose_001"; //   订阅页面左上角X按钮	按钮点击
-    String purchaseweek_001 = "purchaseweek_001"; //   订阅页面-订阅项1	点击选中
-    String purchasemonth_001 = "purchasemonth_001"; //   订阅页面-订阅项2	点击选中
-    String purchaseyear_001 = "purchaseyear_001"; //   订阅页面-订阅项3	点击选中
-    String purchaseweeksub_001 = "purchaseweeksub_001"; //   订阅页面-订阅项1-Subscribe	按钮点击
-    String purchasemonthsub_001 = "purchasemonthsub_001"; //   订阅页面-订阅项2-Subscribe	按钮点击
-    String purchaseyearsub_001 = "purchaseyearsub_001"; //   订阅页面-订阅项3-Subscribe 按钮点击
+    String purchasechoose_001 = "purchasechoose_001"; //订阅页面-订阅项	点击选中,带商品ID	 订阅页面-订阅项
+    String purchasesubclick_001 = "purchasesubclick_001";// Subscribe 按钮点击,带商品ID
+    String restoreclick_001 = "restoreclick_001";//订阅页面-恢复订阅按钮点击	按钮点击
+    String restorenosub_001 = "restorenosub_001";//订阅页面-恢复订阅(没有有效订阅)	按钮点击
+    String restorefail_001 = "restorefail_001";//订阅页面-恢复订阅(有效订阅但恢复失败)	按钮点击
+    String restoresuccess_001 = "restoresuccess_001";//订阅页面-恢复订阅(有有效订阅并恢复成功)	按钮点击
+    String playsetlow_001 = "playsetlow_001";//订阅页面-谷歌结算版本-低版本	进入页面
+    String playsethigh_001 = "playsethigh_001";//订阅页面-谷歌结算版本-高版本	进入页面
+
     String retainstay_001 = "retainstay_001"; //   挽留弹窗-stay按钮	按钮点击
     String retainmiss_001 = "retainmiss_001"; //   挽留弹窗-miss	按钮点击
 

+ 24 - 0
app/src/main/java/com/atmob/voiceai/data/repositories/CloneRepository.java

@@ -1,11 +1,14 @@
 package com.atmob.voiceai.data.repositories;
 
 
+import android.app.Application;
+
 import androidx.annotation.IntDef;
 import androidx.lifecycle.LiveData;
 import androidx.lifecycle.MutableLiveData;
 
 import com.atmob.app.lib.handler.RxHttpHandler;
+import com.atmob.common.runtime.ContextUtil;
 import com.atmob.voiceai.data.api.AtmobApi;
 import com.atmob.voiceai.data.api.bean.CloneVoiceListBean;
 import com.atmob.voiceai.data.api.request.BaseRequest;
@@ -13,6 +16,8 @@ import com.atmob.voiceai.data.api.request.CloneDeleteRequest;
 import com.atmob.voiceai.data.api.request.VoiceCloneRequest;
 import com.atmob.voiceai.data.api.response.VoiceCloneListResponse;
 import com.atmob.voiceai.data.api.response.VoiceCloneResponse;
+import com.atmob.voiceai.data.consts.EventId;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.helper.ErrorHelper;
 import com.atmob.voiceai.utils.ReflectionUtil;
 import com.atmob.voiceai.utils.ToastUtil;
@@ -34,6 +39,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 CloneRepository {
@@ -172,4 +181,19 @@ public class CloneRepository {
                     voiceAIRepository.setCloneExecuteSuccessEvent();
                 });
     }
+
+
+    public static CloneRepository getCloneRepository() {
+        Application application = ContextUtil.getApplication();
+        CloneRepositoryEntryPoint entryPoint = EntryPointAccessors.fromApplication(application, CloneRepositoryEntryPoint.class);
+        return entryPoint.cloneRepository();
+    }
+
+
+    @EntryPoint
+    @InstallIn(SingletonComponent.class)
+    interface CloneRepositoryEntryPoint {
+        CloneRepository cloneRepository();
+    }
+
 }

+ 5 - 1
app/src/main/java/com/atmob/voiceai/data/repositories/MemberRepository.java

@@ -20,6 +20,9 @@ import com.atmob.voiceai.data.api.response.OrderPayResponse;
 import com.atmob.voiceai.data.api.response.OrderStatusResponse;
 import com.atmob.voiceai.data.api.response.PayGoodsResponse;
 import com.atmob.voiceai.data.api.response.UserInfoResponse;
+import com.atmob.voiceai.data.consts.ErrorCode;
+import com.atmob.voiceai.data.consts.EventId;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.sdk.billing.GPBillingClient;
 import com.atmob.voiceai.utils.BoxingUtil;
 
@@ -64,7 +67,8 @@ public class MemberRepository {
         return gpBillingClient.queryPurchase(BillingClient.ProductType.SUBS)
                 .map(list -> {
                     if (list == null || list.isEmpty()) {
-                        throw new RxHttpHandler.ServerErrorException(-1, "Unsuccessful: Subscription not found");
+                        EventHandler.report(EventId.restorenosub_001);
+                        throw new RxHttpHandler.ServerErrorException(ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND, "Unsuccessful: Subscription not found");
                     }
                     return list;
                 })

+ 1 - 6
app/src/main/java/com/atmob/voiceai/module/clonevoice/CloneVoiceFragment.java

@@ -58,12 +58,7 @@ public class CloneVoiceFragment extends BaseFragment<FragmentCloneVoiceBinding>
         initScrollView();
         initSeekBar();
         initPlay();
-        binding.progressRecordBar.setOnProgressColorChangeListener(new AudioProgressBar.OnProgressColorChangeListener() {
-            @Override
-            public void onProgressColorChange(int color) {
-                binding.tvRecordStateDesc.setTextColor(color);
-            }
-        });
+        binding.progressRecordBar.setOnProgressColorChangeListener(color -> binding.tvRecordStateDesc.setTextColor(color));
     }
 
 

+ 6 - 0
app/src/main/java/com/atmob/voiceai/module/clonevoice/CloneVoiceViewModel.java

@@ -16,9 +16,11 @@ import com.atmob.common.runtime.ActivityUtil;
 import com.atmob.common.runtime.ContextUtil;
 import com.atmob.voiceai.R;
 import com.atmob.voiceai.data.api.bean.CloneVoiceListBean;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.data.repositories.CloneRepository;
 import com.atmob.voiceai.data.repositories.MemberRepository;
 import com.atmob.voiceai.data.repositories.VoiceAIRepository;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.helper.ErrorHelper;
 import com.atmob.voiceai.module.cloning.VoiceCloningActivity;
 import com.atmob.voiceai.module.main.MainActivity;
@@ -323,6 +325,7 @@ public class CloneVoiceViewModel extends BaseViewModel {
     }
 
     public void onLocalUploadClick() {
+        EventHandler.report(EventId.cloneupload_001);
         clickLocalUpload.call();
     }
 
@@ -373,6 +376,7 @@ public class CloneVoiceViewModel extends BaseViewModel {
 
 
     public void useCloneVoiceClick() {
+        EventHandler.report(EventId.cloneuse_001);
         MainActivity.start(ActivityUtil.getTopActivity(), VoiceAIFragment.class);
         List<CloneVoiceListBean> list = cloneRepository.getCloneVoiceList().getValue();
         if (list == null || list.isEmpty()) {
@@ -382,6 +386,7 @@ public class CloneVoiceViewModel extends BaseViewModel {
     }
 
     public void onDeleteClick() {
+        EventHandler.report(EventId.clonedelete_001);
         List<CloneVoiceListBean> list = cloneRepository.getCloneVoiceList().getValue();
         if (list == null || list.isEmpty()) {
             ToastUtil.show(R.string.no_clone_data, ToastUtil.LENGTH_SHORT);
@@ -391,6 +396,7 @@ public class CloneVoiceViewModel extends BaseViewModel {
     }
 
     public void onRecordClick() {
+        EventHandler.report(EventId.clonerecord_001);
         if (!PermissionUtil.hasPermission(PERMISSION_AUDIO)) {
             requestAudioPermission.call();
             return;

+ 3 - 0
app/src/main/java/com/atmob/voiceai/module/generating/VoiceGeneratingViewModel.java

@@ -14,7 +14,9 @@ import com.atmob.common.runtime.ContextUtil;
 import com.atmob.voiceai.R;
 import com.atmob.voiceai.data.api.bean.UserVoiceBean;
 import com.atmob.voiceai.data.api.bean.VoiceListBean;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.data.repositories.VoiceAIRepository;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.utils.ThreePair;
 
 import java.util.concurrent.TimeUnit;
@@ -51,6 +53,7 @@ public class VoiceGeneratingViewModel extends BaseViewModel {
             }
         };
         voiceAIRepository.getTextToSpeechState().observeForever(stateObserver);
+        EventHandler.report(EventId.generating_001);
     }
 
     public LiveData<UserVoiceBean> getGenerateSuccess() {

+ 3 - 0
app/src/main/java/com/atmob/voiceai/module/history/HistoryViewModel.java

@@ -6,8 +6,10 @@ import androidx.lifecycle.LiveData;
 import com.atmob.app.lib.base.BaseViewModel;
 import com.atmob.common.runtime.ActivityUtil;
 import com.atmob.voiceai.data.api.bean.UserVoiceBean;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.data.repositories.HistoryRepository;
 import com.atmob.voiceai.data.repositories.MemberRepository;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.module.result.VoiceResultActivity;
 import com.atmob.voiceai.module.setting.SettingActivity;
 import com.atmob.voiceai.module.subscription.SubscriptionPageActivity;
@@ -55,6 +57,7 @@ public class HistoryViewModel extends BaseViewModel {
     }
 
     public void onHistoryItemClick(@NonNull UserVoiceBean cloneHistoryBean) {
+        EventHandler.report(EventId.historyclick_001);
         VoiceResultActivity.start(ActivityUtil.getTopActivity(), cloneHistoryBean);
     }
 

+ 22 - 0
app/src/main/java/com/atmob/voiceai/module/main/MainActivity.java

@@ -12,13 +12,22 @@ import androidx.fragment.app.Fragment;
 
 import com.atmob.app.lib.base.BaseActivity;
 import com.atmob.voiceai.R;
+import com.atmob.voiceai.data.api.bean.CloneVoiceListBean;
+import com.atmob.voiceai.data.consts.EventId;
+import com.atmob.voiceai.data.repositories.CloneRepository;
 import com.atmob.voiceai.databinding.ActivityMainBinding;
 import com.atmob.voiceai.databinding.ItemMainTabLayoutBinding;
+import com.atmob.voiceai.handlers.EventHandler;
+import com.atmob.voiceai.module.clonevoice.CloneVoiceFragment;
+import com.atmob.voiceai.module.history.HistoryFragment;
+import com.atmob.voiceai.module.voiceai.VoiceAIFragment;
 import com.atmob.voiceai.utils.ToastUtil;
 import com.google.android.material.tabs.TabLayout;
 import com.google.android.material.tabs.TabLayoutMediator;
 import com.gyf.immersionbar.ImmersionBar;
 
+import java.util.List;
+
 import dagger.hilt.android.AndroidEntryPoint;
 
 
@@ -96,6 +105,19 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> {
                     itemBinding.tabText.setSelected(true);
                     itemBinding.tabIcon.setSelected(true);
                 }
+                Class<? extends Fragment> pagerClass = mainPagerAdapter.getMainPagerItemByPosition(tab.getPosition()).getPagerClass();
+                if (VoiceAIFragment.class.equals(pagerClass)) {
+                    EventHandler.report(EventId.hometab_001);
+                } else if (CloneVoiceFragment.class.equals(pagerClass)) {
+                    List<CloneVoiceListBean> value = CloneRepository.getCloneRepository().getCloneVoiceList().getValue();
+                    if (value != null && !value.isEmpty()) {
+                        EventHandler.report(EventId.clonedone_001);
+                    } else {
+                        EventHandler.report(EventId.cloneundone_001);
+                    }
+                } else if (HistoryFragment.class.equals(pagerClass)) {
+                    EventHandler.report(EventId.history_001);
+                }
             }
 
             @Override

+ 5 - 0
app/src/main/java/com/atmob/voiceai/module/result/VoiceResultActivity.java

@@ -21,7 +21,9 @@ import com.atmob.common.logging.AtmobLog;
 import com.atmob.voiceai.R;
 import com.atmob.voiceai.data.api.bean.UserVoiceBean;
 import com.atmob.voiceai.data.api.bean.VoiceListBean;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.databinding.ActivityVoiceResultBinding;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.module.main.MainActivity;
 import com.atmob.voiceai.module.voiceai.VoiceAIFragment;
 import com.atmob.voiceai.module.voiceai.VoiceAIListAdapter;
@@ -85,6 +87,9 @@ public class VoiceResultActivity extends BaseActivity<ActivityVoiceResultBinding
             MainActivity.start(this, VoiceAIFragment.class);
             voiceListBean.setContent(value.getContent());
             voiceResultViewModel.setRecommendVoice(voiceListBean);
+            Bundle bundle = new Bundle();
+            bundle.putString(EventId.ID, String.valueOf(value.getId()));
+            EventHandler.report(EventId.generateoklist_001, bundle);
             finish();
         });
         binding.rvRecommend.setAdapter(voiceRecommendAdapter);

+ 5 - 0
app/src/main/java/com/atmob/voiceai/module/result/VoiceResultViewModel.java

@@ -14,7 +14,9 @@ import com.atmob.voiceai.R;
 import com.atmob.voiceai.data.api.bean.UserVoiceBean;
 import com.atmob.voiceai.data.api.bean.VoiceListBean;
 import com.atmob.voiceai.data.api.response.VoiceListResponse;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.data.repositories.VoiceAIRepository;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.utils.DateUtil;
 import com.atmob.voiceai.utils.MediaStoreHelper;
 import com.atmob.voiceai.utils.ShareUtils;
@@ -61,6 +63,7 @@ public class VoiceResultViewModel extends BaseViewModel {
         this.voiceAIRepository = voiceAIRepository;
         this.okHttpClient = okHttpClient;
         refreshVoiceRecommendList();
+        EventHandler.report(EventId.generateok_001);
     }
 
     public LiveData<List<VoiceListBean>> getVoiceList() {
@@ -154,6 +157,7 @@ public class VoiceResultViewModel extends BaseViewModel {
 
 
     public void onSaveClick() {
+        EventHandler.report(EventId.generateoksave_001);
         UserVoiceBean userVoiceBean = getResultBean().getValue();
         if (userVoiceBean == null) {
             return;
@@ -195,6 +199,7 @@ public class VoiceResultViewModel extends BaseViewModel {
     }
 
     public void onShareClick() {
+        EventHandler.report(EventId.generateokshare_001);
         UserVoiceBean userVoiceBean = getResultBean().getValue();
         if (userVoiceBean == null) {
             return;

+ 6 - 0
app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionAdapter.java

@@ -1,6 +1,7 @@
 package com.atmob.voiceai.module.subscription;
 
 import android.content.Context;
+import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.ViewGroup;
 
@@ -12,7 +13,9 @@ import androidx.recyclerview.widget.RecyclerView;
 
 import com.atmob.voiceai.data.api.bean.GoodsBean;
 
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.databinding.ItemSubGoodsListBinding;
+import com.atmob.voiceai.handlers.EventHandler;
 
 import java.util.List;
 import java.util.Objects;
@@ -95,6 +98,9 @@ public class SubscriptionAdapter extends RecyclerView.Adapter<SubscriptionAdapte
                 if (viewBean == checkedGoodsBean) {
                     return;
                 }
+                Bundle bundle = new Bundle();
+                bundle.putString(EventId.ID, String.valueOf(viewBean.getId()));
+                EventHandler.report(EventId.purchasechoose_001, bundle);
                 if (checkedGoodsBean != null) {
                     checkedGoodsBean.setSelect(false);
                 }

+ 5 - 0
app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionPageActivity.java

@@ -2,6 +2,7 @@ package com.atmob.voiceai.module.subscription;
 
 import android.app.Activity;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.graphics.Canvas;
 import android.graphics.Rect;
@@ -18,8 +19,10 @@ import androidx.recyclerview.widget.RecyclerView;
 import com.atmob.app.lib.base.BaseActivity;
 import com.atmob.common.ui.SizeUtil;
 import com.atmob.voiceai.data.api.bean.GoodsBean;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.databinding.ActivitySubscriptionPageBinding;
 import com.atmob.voiceai.dialog.SubRetentionDialog;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.utils.BoxingUtil;
 
 import dagger.hilt.android.AndroidEntryPoint;
@@ -78,9 +81,11 @@ public class SubscriptionPageActivity extends BaseActivity<ActivitySubscriptionP
                     finish();
                 }
             });
+            subRetentionDialog.setOnDismissListener(dialog -> EventHandler.report(EventId.retainmiss_001));
         }
         subscriptionPageViewModel.setRetentionTime();
         subRetentionDialog.show();
+        EventHandler.report(EventId.retainstay_001);
     }
 
     private void initGoodsList() {

+ 25 - 2
app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionPageViewModel.java

@@ -1,5 +1,6 @@
 package com.atmob.voiceai.module.subscription;
 
+import android.os.Bundle;
 import android.os.SystemClock;
 
 import androidx.lifecycle.LiveData;
@@ -20,7 +21,10 @@ import com.atmob.voiceai.data.api.AtmobApi;
 import com.atmob.voiceai.data.api.bean.GoodsBean;
 import com.atmob.voiceai.data.api.bean.PayOptionsBean;
 import com.atmob.voiceai.data.api.response.OrderPayResponse;
+import com.atmob.voiceai.data.consts.ErrorCode;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.data.repositories.MemberRepository;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.helper.ErrorHelper;
 import com.atmob.voiceai.sdk.billing.GPBillingClient;
 import com.atmob.voiceai.utils.BoxingUtil;
@@ -73,6 +77,7 @@ public class SubscriptionPageViewModel extends BaseViewModel {
         init();
         refreshSubscriptionDetail();
         gpBillingClient.startUrgentConnection();
+        EventHandler.report(EventId.purchase_001);
     }
 
     public void setCheckGoodsBean(GoodsBean checkGoodsBean) {
@@ -120,6 +125,7 @@ public class SubscriptionPageViewModel extends BaseViewModel {
     }
 
     public void onBackClick() {
+        EventHandler.report(EventId.purchaseclose_001);
         if (isShowRetentionDialog()) {
             showRetentionDialogEvent.call();
         } else {
@@ -128,6 +134,7 @@ public class SubscriptionPageViewModel extends BaseViewModel {
     }
 
     public void onRestoreClick() {
+        EventHandler.report(EventId.restoreclick_001);
         memberRepository.subscriptionResume()
                 .subscribe(new SingleObserver<Object>() {
                     @Override
@@ -137,12 +144,21 @@ public class SubscriptionPageViewModel extends BaseViewModel {
 
                     @Override
                     public void onSuccess(@NonNull Object object) {
+                        EventHandler.report(EventId.restoresuccess_001);
                         ToastUtil.show(R.string.member_restore_success, ToastUtil.LENGTH_SHORT);
                     }
 
                     @Override
                     public void onError(@NonNull Throwable e) {
-                        ErrorHelper.errorThrowableToast(e, R.string.member_restore_fail, ToastUtil.LENGTH_SHORT);
+                        if (e instanceof RxHttpHandler.ServerErrorException) {
+                            RxHttpHandler.ServerErrorException serverErrorException = (RxHttpHandler.ServerErrorException) e;
+                            if (serverErrorException.getCode() != ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND) {
+                                EventHandler.report(EventId.restorefail_001);
+                            }
+                            ToastUtil.show(serverErrorException.getMsg(), ToastUtil.LENGTH_SHORT);
+                        } else {
+                            ToastUtil.show(R.string.net_error_message, ToastUtil.LENGTH_SHORT);
+                        }
                     }
                 });
     }
@@ -175,6 +191,11 @@ public class SubscriptionPageViewModel extends BaseViewModel {
                     @Override
                     public void onSuccess(@NonNull List<GoodsBean> goodsBeanList) {
                         goodsList.setValue(goodsBeanList);
+                        if (gpBillingClient.isSupportProductDetails()) {
+                            EventHandler.report(EventId.playsethigh_001);
+                        } else {
+                            EventHandler.report(EventId.playsetlow_001);
+                        }
                     }
 
                     @Override
@@ -209,6 +230,9 @@ public class SubscriptionPageViewModel extends BaseViewModel {
         PayOptionsBean payOptionsBean = payList.get(0);
         int payPlatform = payOptionsBean.getPayPlatform();
         int payMethod = payOptionsBean.getPayMethod();
+        Bundle bundle = new Bundle();
+        bundle.putString(EventId.ID, String.valueOf(checkGoodsBean.getId()));
+        EventHandler.report(EventId.purchasesubclick_001, bundle);
         memberRepository.requestGoodsPayOrder(checkGoodsBean.getId(), payPlatform, payMethod)
                 .subscribe(new SingleObserver<OrderPayResponse>() {
                     @Override
@@ -282,7 +306,6 @@ public class SubscriptionPageViewModel extends BaseViewModel {
     }
 
 
-
     @Override
     protected void onCleared() {
         super.onCleared();

+ 3 - 0
app/src/main/java/com/atmob/voiceai/module/voiceai/VoiceAIFragment.java

@@ -18,8 +18,10 @@ import com.atmob.common.logging.AtmobLog;
 import com.atmob.voiceai.R;
 import com.atmob.voiceai.data.api.bean.TypeListBean;
 import com.atmob.voiceai.data.api.bean.VoiceListBean;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.databinding.FragmentVoiceAiBinding;
 import com.atmob.voiceai.databinding.ItemVoiceAiTabBinding;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.module.clonevoice.CloneVoiceFragment;
 import com.atmob.voiceai.module.main.MainActivity;
 import com.atmob.voiceai.utils.BoxingUtil;
@@ -117,6 +119,7 @@ public class VoiceAIFragment extends BaseFragment<FragmentVoiceAiBinding> {
         voiceAIListAdapter.setActionHandler(new VoiceAIListAdapter.ActionHandler() {
             @Override
             public void addClick() {
+                EventHandler.report(EventId.homeadd_001);
                 MainActivity.start(requireActivity(), CloneVoiceFragment.class);
             }
 

+ 9 - 0
app/src/main/java/com/atmob/voiceai/module/voiceai/VoiceAIViewModel.java

@@ -1,5 +1,6 @@
 package com.atmob.voiceai.module.voiceai;
 
+import android.os.Bundle;
 import android.text.TextUtils;
 import android.util.Pair;
 
@@ -19,8 +20,10 @@ import com.atmob.voiceai.data.api.bean.TypeListBean;
 import com.atmob.voiceai.data.api.bean.VoiceListBean;
 import com.atmob.voiceai.data.api.response.VoiceListResponse;
 import com.atmob.voiceai.data.api.response.VoiceTypeResponse;
+import com.atmob.voiceai.data.consts.EventId;
 import com.atmob.voiceai.data.repositories.MemberRepository;
 import com.atmob.voiceai.data.repositories.VoiceAIRepository;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.helper.ErrorHelper;
 import com.atmob.voiceai.module.generating.VoiceGeneratingActivity;
 import com.atmob.voiceai.module.setting.SettingActivity;
@@ -151,6 +154,7 @@ public class VoiceAIViewModel extends BaseViewModel {
 
 
     public void onGenerateClick() {
+        EventHandler.report(EventId.homegenerate_001);
         String content = voicePrintTxt.getValue();
         if (TextUtils.isEmpty(content)) {
             ToastUtil.show(R.string.voice_ai_print_hint, ToastUtil.LENGTH_SHORT);
@@ -351,6 +355,9 @@ public class VoiceAIViewModel extends BaseViewModel {
         this.choiceVoiceBean = voiceListBean;
         this.choiceVoiceBean.setCheck(true);
         if (playVoice) {
+            Bundle bundle = new Bundle();
+            bundle.putString(EventId.ID, String.valueOf(voiceListBean.getId()));
+            EventHandler.report(EventId.homelistclick_001, bundle);
             playExampleVoice.setValue(choiceVoiceBean);
         }
     }
@@ -379,10 +386,12 @@ public class VoiceAIViewModel extends BaseViewModel {
 
 
     public void onGoSubscriptionClick() {
+        EventHandler.report(EventId.homeprobutton_001);
         SubscriptionPageActivity.start(ActivityUtil.getTopActivity());
     }
 
     public void onGetMoreClick() {
+        EventHandler.report(EventId.homegetmore_001);
         SubscriptionPageActivity.start(ActivityUtil.getTopActivity());
     }
 

+ 4 - 0
app/src/main/java/com/atmob/voiceai/sdk/billing/BillingStrategy.java

@@ -31,6 +31,10 @@ public class BillingStrategy {
         this.billingClient = billingClient;
     }
 
+    public boolean isSupportProductDetails() {
+        return billingClient.isFeatureSupported(BillingClient.FeatureType.PRODUCT_DETAILS).getResponseCode() == BillingClient.BillingResponseCode.OK;
+    }
+
     public Single<GPProductInfo> queryGoodsDetails(String productType, @NonNull String productId, @Nullable String basePlanId, @Nullable String legacyProductId) {
         return QueryDetails.queryGoodsDetails(billingClient, productType, productId, basePlanId, legacyProductId);
     }

+ 4 - 0
app/src/main/java/com/atmob/voiceai/sdk/billing/GPBillingClient.java

@@ -178,6 +178,10 @@ public class GPBillingClient implements PurchasesUpdatedListener {
     }
 
 
+    public boolean isSupportProductDetails() {
+        return billingStrategy.isSupportProductDetails();
+    }
+
     /**
      * 应用启动时尝试连接 billing client
      */

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

@@ -458,6 +458,7 @@
             app:layout_constraintWidth_percent="0.1" />
 
         <TextView
+            expandTouchSize="@{5}"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"

+ 2 - 2
app/src/main/res/layout/fragment_clone_voice.xml

@@ -423,7 +423,7 @@
                     android:layout_height="wrap_content"
                     android:paddingBottom="@dimen/clone_voice_padding"
                     app:layout_constraintTop_toBottomOf="@+id/space4"
-                    tools:visibility="gone">
+                    tools:visibility="visible">
 
                     <View
                         android:id="@+id/v_clone_success_preview"
@@ -523,7 +523,7 @@
                     android:layout_height="wrap_content"
                     android:paddingBottom="@dimen/clone_voice_padding"
                     app:layout_constraintTop_toBottomOf="@+id/space4"
-                    tools:visibility="visible">
+                    tools:visibility="gone">
 
                     <View
                         android:id="@+id/v_record_audio_preview"

+ 2 - 2
build.gradle

@@ -6,8 +6,8 @@ buildscript {
         minSdkVersion = 21
         targetSdkVersion = 33
 
-        versionCode = 100
-        versionName = "1.0.0"
+        versionCode = 101
+        versionName = "1.0.1"
 
         hilt_version = '2.41'
         lifecycle_version = "2.6.1"