Browse Source

[new]增加启屏埋点

zk 1 year ago
parent
commit
98236aeaed

+ 13 - 0
app/src/main/java/com/atmob/voiceai/data/consts/EventId.java

@@ -59,4 +59,17 @@ public interface EventId {
     String neigourestoreclick_001 = "neigourestoreclick_001"; // 内购页-恢复按钮点击 按钮点击
     String neigourestoreclick_001 = "neigourestoreclick_001"; // 内购页-恢复按钮点击 按钮点击
     String neigourestoreok_001 = "neigourestoreok_001"; // 内购页-恢复成功 按钮点击
     String neigourestoreok_001 = "neigourestoreok_001"; // 内购页-恢复成功 按钮点击
     String neigourestorefailed_001 = "neigourestorefailed_001"; // 内购页-恢复失败 按钮点击
     String neigourestorefailed_001 = "neigourestorefailed_001"; // 内购页-恢复失败 按钮点击
+
+    //106新增
+    String opensubscribe_001 = "opensubscribe_001"; //开屏订阅页-进入页面
+    String opensubcontinue_001 = "opensubcontinue_001"; //开屏订阅页-continue按钮
+    String opensubscribeclose_001 = "opensubscribeclose_001"; //开屏订阅页-左上角X按钮
+    String opensubrestore_001 = "opensubrestore_001"; //开屏订阅页-恢复订阅按钮点击
+
+    String opensubrestoreno_001 = "opensubrestoreno_001";//开屏订阅页-恢复订阅(没有有效订阅)
+    String opensubrestorefail_001 = "opensubrestorefail_001";//开屏订阅页-恢复订阅(有有效订阅但恢复失败)
+    String opensubrestoreok_001 = "opensubrestoreok_001";//开屏订阅页-恢复订阅(有有效订阅并恢复成功)
+
+    String opensublow_001 = "opensublow_001";//开屏订阅页-谷歌结算版本-低版本
+    String opensubhigh_001 = "opensubhigh_001";//开屏订阅页-谷歌结算版本-高版本
 }
 }

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

@@ -28,23 +28,16 @@ import com.atmob.voiceai.data.api.response.PayGoodsResponse;
 import com.atmob.voiceai.data.api.response.SplashPageResponse;
 import com.atmob.voiceai.data.api.response.SplashPageResponse;
 import com.atmob.voiceai.data.api.response.UserInfoResponse;
 import com.atmob.voiceai.data.api.response.UserInfoResponse;
 import com.atmob.voiceai.data.consts.ErrorCode;
 import com.atmob.voiceai.data.consts.ErrorCode;
-import com.atmob.voiceai.data.consts.EventId;
-import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.module.integral.IntegralPurchaseActivity;
 import com.atmob.voiceai.module.integral.IntegralPurchaseActivity;
 import com.atmob.voiceai.module.subscription.SubscriptionPageActivity;
 import com.atmob.voiceai.module.subscription.SubscriptionPageActivity;
 import com.atmob.voiceai.sdk.billing.GPBillingClient;
 import com.atmob.voiceai.sdk.billing.GPBillingClient;
 import com.atmob.voiceai.sdk.kochava.KochavaHelper;
 import com.atmob.voiceai.sdk.kochava.KochavaHelper;
 import com.atmob.voiceai.utils.BoxingUtil;
 import com.atmob.voiceai.utils.BoxingUtil;
-
 import java.util.ArrayList;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.List;
-import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
-
 import javax.inject.Inject;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.inject.Singleton;
-
 import atmob.reactivex.rxjava3.annotations.NonNull;
 import atmob.reactivex.rxjava3.annotations.NonNull;
 import atmob.reactivex.rxjava3.core.Observable;
 import atmob.reactivex.rxjava3.core.Observable;
 import atmob.reactivex.rxjava3.core.Single;
 import atmob.reactivex.rxjava3.core.Single;
@@ -113,7 +106,6 @@ public class MemberRepository {
         return gpBillingClient.queryPurchase(BillingClient.ProductType.SUBS)
         return gpBillingClient.queryPurchase(BillingClient.ProductType.SUBS)
                 .map(list -> {
                 .map(list -> {
                     if (list == null || list.isEmpty()) {
                     if (list == null || list.isEmpty()) {
-                        EventHandler.report(EventId.restorenosub_001);
                         throw new RxHttpHandler.ServerErrorException(ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND, "Unsuccessful: Subscription not found");
                         throw new RxHttpHandler.ServerErrorException(ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND, "Unsuccessful: Subscription not found");
                     }
                     }
                     return list;
                     return list;

+ 19 - 1
app/src/main/java/com/atmob/voiceai/module/newsplash/NewSplashViewModel.java

@@ -21,7 +21,10 @@ import com.atmob.voiceai.data.api.response.OrderPayResponse;
 import com.atmob.voiceai.data.api.response.SplashPageResponse;
 import com.atmob.voiceai.data.api.response.SplashPageResponse;
 import com.atmob.voiceai.data.api.response.UserInfoResponse;
 import com.atmob.voiceai.data.api.response.UserInfoResponse;
 import com.atmob.voiceai.data.consts.Constants;
 import com.atmob.voiceai.data.consts.Constants;
+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.data.repositories.MemberRepository;
+import com.atmob.voiceai.handlers.EventHandler;
 import com.atmob.voiceai.helper.ErrorHelper;
 import com.atmob.voiceai.helper.ErrorHelper;
 import com.atmob.voiceai.sdk.billing.GPBillingClient;
 import com.atmob.voiceai.sdk.billing.GPBillingClient;
 import com.atmob.voiceai.utils.BoxingUtil;
 import com.atmob.voiceai.utils.BoxingUtil;
@@ -66,6 +69,13 @@ public class NewSplashViewModel extends BaseViewModel {
         this.memberRepository = memberRepository;
         this.memberRepository = memberRepository;
         this.gpBillingClient = gpBillingClient;
         this.gpBillingClient = gpBillingClient;
         refreshUserInfo();
         refreshUserInfo();
+        gpBillingClient.startUrgentConnection();
+        EventHandler.report(EventId.opensubscribe_001);
+        if (gpBillingClient.isSupportProductDetails()) {
+            EventHandler.report(EventId.opensubhigh_001);
+        } else {
+            EventHandler.report(EventId.opensublow_001);
+        }
     }
     }
 
 
     public LiveData<Pair<Boolean, String>> getShowLoading() {
     public LiveData<Pair<Boolean, String>> getShowLoading() {
@@ -125,7 +135,6 @@ public class NewSplashViewModel extends BaseViewModel {
 
 
 
 
     private void refreshSplashGoods() {
     private void refreshSplashGoods() {
-        gpBillingClient.startUrgentConnection();
         memberRepository.requestSplashPage()
         memberRepository.requestSplashPage()
                 .map(SplashPageResponse::getItem)
                 .map(SplashPageResponse::getItem)
                 .flatMap(splashPageBean ->
                 .flatMap(splashPageBean ->
@@ -173,10 +182,12 @@ public class NewSplashViewModel extends BaseViewModel {
     }
     }
 
 
     public void onBackClick() {
     public void onBackClick() {
+        EventHandler.report(EventId.opensubscribeclose_001);
         showMainEvent.call();
         showMainEvent.call();
     }
     }
 
 
     public void onContinueClick() {
     public void onContinueClick() {
+        EventHandler.report(EventId.opensubcontinue_001);
         if (isRequestSubmitOrder) {
         if (isRequestSubmitOrder) {
             return;
             return;
         }
         }
@@ -263,6 +274,7 @@ public class NewSplashViewModel extends BaseViewModel {
     }
     }
 
 
     public void onRestoreClick() {
     public void onRestoreClick() {
+        EventHandler.report(EventId.opensubrestore_001);
         memberRepository.subscriptionResume()
         memberRepository.subscriptionResume()
                 .subscribe(new SingleObserver<Object>() {
                 .subscribe(new SingleObserver<Object>() {
                     @Override
                     @Override
@@ -275,6 +287,7 @@ public class NewSplashViewModel extends BaseViewModel {
                     public void onSuccess(@NonNull Object object) {
                     public void onSuccess(@NonNull Object object) {
                         showLoading.setValue(new Pair<>(false, null));
                         showLoading.setValue(new Pair<>(false, null));
                         showMainEvent.call();
                         showMainEvent.call();
+                        EventHandler.report(EventId.opensubrestoreok_001);
                         ToastUtil.show(R.string.member_restore_success, ToastUtil.LENGTH_SHORT);
                         ToastUtil.show(R.string.member_restore_success, ToastUtil.LENGTH_SHORT);
                     }
                     }
 
 
@@ -283,6 +296,11 @@ public class NewSplashViewModel extends BaseViewModel {
                         showLoading.setValue(new Pair<>(false, null));
                         showLoading.setValue(new Pair<>(false, null));
                         if (e instanceof RxHttpHandler.ServerErrorException) {
                         if (e instanceof RxHttpHandler.ServerErrorException) {
                             RxHttpHandler.ServerErrorException serverErrorException = (RxHttpHandler.ServerErrorException) e;
                             RxHttpHandler.ServerErrorException serverErrorException = (RxHttpHandler.ServerErrorException) e;
+                            if (serverErrorException.getCode() != ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND) {
+                                EventHandler.report(EventId.opensubrestoreno_001);
+                            } else {
+                                EventHandler.report(EventId.opensubrestorefail_001);
+                            }
                             ToastUtil.show(serverErrorException.getMsg(), ToastUtil.LENGTH_SHORT);
                             ToastUtil.show(serverErrorException.getMsg(), ToastUtil.LENGTH_SHORT);
                         } else {
                         } else {
                             ToastUtil.show(R.string.net_error_message, ToastUtil.LENGTH_SHORT);
                             ToastUtil.show(R.string.net_error_message, ToastUtil.LENGTH_SHORT);

+ 7 - 5
app/src/main/java/com/atmob/voiceai/module/subscription/SubscriptionPageViewModel.java

@@ -74,6 +74,11 @@ public class SubscriptionPageViewModel extends BaseViewModel {
         init();
         init();
         refreshSubscriptionDetail();
         refreshSubscriptionDetail();
         gpBillingClient.startUrgentConnection();
         gpBillingClient.startUrgentConnection();
+        if (gpBillingClient.isSupportProductDetails()) {
+            EventHandler.report(EventId.playsethigh_001);
+        } else {
+            EventHandler.report(EventId.playsetlow_001);
+        }
         EventHandler.report(EventId.purchase_001);
         EventHandler.report(EventId.purchase_001);
     }
     }
 
 
@@ -142,6 +147,8 @@ public class SubscriptionPageViewModel extends BaseViewModel {
                         if (e instanceof RxHttpHandler.ServerErrorException) {
                         if (e instanceof RxHttpHandler.ServerErrorException) {
                             RxHttpHandler.ServerErrorException serverErrorException = (RxHttpHandler.ServerErrorException) e;
                             RxHttpHandler.ServerErrorException serverErrorException = (RxHttpHandler.ServerErrorException) e;
                             if (serverErrorException.getCode() != ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND) {
                             if (serverErrorException.getCode() != ErrorCode.ERROR_SUBSCRIPTION_NOT_FOUND) {
+                                EventHandler.report(EventId.restorenosub_001);
+                            } else {
                                 EventHandler.report(EventId.restorefail_001);
                                 EventHandler.report(EventId.restorefail_001);
                             }
                             }
                             ToastUtil.show(serverErrorException.getMsg(), ToastUtil.LENGTH_SHORT);
                             ToastUtil.show(serverErrorException.getMsg(), ToastUtil.LENGTH_SHORT);
@@ -184,11 +191,6 @@ public class SubscriptionPageViewModel extends BaseViewModel {
                     public void onSuccess(@NonNull List<GoodsBean> goodsBeanList) {
                     public void onSuccess(@NonNull List<GoodsBean> goodsBeanList) {
                         goodsList.setValue(goodsBeanList);
                         goodsList.setValue(goodsBeanList);
                         showQuerySubLoading.setValue(false);
                         showQuerySubLoading.setValue(false);
-                        if (gpBillingClient.isSupportProductDetails()) {
-                            EventHandler.report(EventId.playsethigh_001);
-                        } else {
-                            EventHandler.report(EventId.playsetlow_001);
-                        }
                     }
                     }
 
 
                     @Override
                     @Override