[Modify]1.4.0埋点

This commit is contained in:
wushaocheng
2022-12-05 20:47:11 +08:00
parent 9f6be41006
commit f6ae6b0de2
12 changed files with 281 additions and 34 deletions

View File

@@ -39,6 +39,8 @@ import com.tencent.bugly.crashreport.CrashReport;
import com.tongdaxing.erban.upgrade.AppUpgradeHelper;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.trello.rxlifecycle3.android.FragmentEvent;
import com.yizhuan.erban.application.IReportConstants;
import com.yizhuan.erban.application.ReportManager;
import com.yizhuan.erban.application.XChatApplication;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.base.BaseMvpActivity;
@@ -128,6 +130,7 @@ import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -175,8 +178,8 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
{
fragmentArray.put(MainTabType.TAB_TYPE_HOME, new HomeFragment());
fragmentArray.put(MainTabType.TAB_TYPE_MSG, new ContactsListFragment());
fragmentArray.put(MainTabType.TAB_TYPE_SQUARE, new SquareFragment());
fragmentArray.put(MainTabType.TAB_TYPE_MSG, new ContactsListFragment());
fragmentArray.put(MainTabType.TAB_TYPE_ME, new MeFragment());
}
@@ -574,9 +577,9 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
@Override
public void onSuccess(Boolean flag) {
if(!flag) {
if (!flag) {
LoginBoundAuthCodeActivity.start(MainActivity.this);
}else {
} else {
//首次注册需要完善昵称和头像
UIHelper.showAddInfoAct(MainActivity.this);
}
@@ -675,6 +678,34 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
if (mCurrentTabType == MainTabType.TAB_TYPE_ME) {
UserModel.get().updateCurrentUserInfo().subscribe();
}
switch (tabType) {
case MainTabType.TAB_TYPE_HOME:
reportTabClick(IReportConstants.ELEVEN);
break;
case MainTabType.TAB_TYPE_SQUARE:
reportTabClick(IReportConstants.TWELVE);
break;
case MainTabType.TAB_TYPE_MSG:
reportTabClick(IReportConstants.THIRTEEN);
break;
case MainTabType.TAB_TYPE_ME:
reportTabClick(IReportConstants.FOURTEEN);
break;
}
}
/**
* 导航栏tab板块点击
*
* @param type
*/
private void reportTabClick(int type) {
//登录页展示时
HashMap<String, Object> map = new HashMap<>(3);
map.put(IReportConstants.HOMEPAGE_TYPE, type);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE);
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, map);
}
@Override

View File

@@ -8,4 +8,48 @@ public interface IReportConstants {
String CHANNEL_NAME = "ChannelName";
String ADJUST_REGISTER = "yly8k0";
String MODULE = "module";
int ZERO = 0;
int ONE = 1;
int TWO = 2;
int THREE = 3;
int FOUR = 4;
int FIVE = 5;
int SIX = 6;
int SEVEN = 7;
int EIGHT = 8;
int NINE = 9;
int TEN = 10;
int ELEVEN = 11;
int TWELVE = 12;
int THIRTEEN = 13;
int FOURTEEN = 14;
int FIFTEEN = 15;
String ACTIVATE_FIRST = "activate_first";
String PEKO_ACTIVATE = "peko_activate";
String AGREEMENT_SHOW = "agreement_show";
String PEKO_LOGIN = "peko_login";
String AGREEMENT_CLICK = "agreement_click";
String CLICK_TYPE = "click_type";
String PAGE = "page";
String LOGIN_SHOW = "login_show";
String LOGIN_CLICK = "login_click";
String LOGIN_REQUEST = "login_request";
String LOGIN_TYPE = "login_type";
String LOGIN_RESULT = "login_result";
String RESULT = "result";
String FAIL_DETAIL = "fail_detail";
String MODULE_HOMEPAGE_CLICK = "module_homepage_click";
String HOMEPAGE_TYPE = "homepage_type";
String PEKO_HOMEPAGE = "peko_homepage";
String TAB_HOMEPAGE_CLICK = "tab_homepage_click";
String HOMEPAGE_TAB = "homepage_tab";
String PAYPAGE_SHOW = "paypage_show";
String PAYPAGE_TYPE = "paypage_type";
String ACCOUNT_BALANCE = "account_balance";
String PAY_CLICK = "pay_click";
String MONEY = "money";
String PEKO_PAY = "peko_pay";
}

View File

@@ -58,7 +58,6 @@ import com.yizhuan.erban.utils.PushMessageHandler;
import com.yizhuan.xchat_android_constants.XChatConstants;
import com.yizhuan.xchat_android_core.Constants;
import com.yizhuan.xchat_android_core.DemoCache;
import com.yizhuan.xchat_android_library.common.application.Env;
import com.yizhuan.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
@@ -86,6 +85,7 @@ import com.yizhuan.xchat_android_core.user.event.NeedCompleteInfoEvent;
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
import com.yizhuan.xchat_android_core.utils.net.ServerException;
import com.yizhuan.xchat_android_library.common.application.BaseApp;
import com.yizhuan.xchat_android_library.common.application.Env;
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
import com.yizhuan.xchat_android_library.net.rxnet.converter.GsonConverterPlugins;
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil;
@@ -102,6 +102,7 @@ import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -530,6 +531,10 @@ public class XChatApplication extends BaseApp {
}
initContext(this);
BaseApp.init(this);
//首次启动事件
HashMap<String, Object> map = new HashMap<>(2);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_ACTIVATE);
ReportManager.get().reportEvent(IReportConstants.ACTIVATE_FIRST, map);
}
/**

View File

@@ -3,7 +3,6 @@ package com.yizhuan.erban.home.fragment
import android.annotation.SuppressLint
import android.view.Gravity
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
@@ -11,11 +10,12 @@ import androidx.fragment.app.activityViewModels
import com.coorchice.library.utils.LogUtils
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.yizhuan.erban.R
import com.yizhuan.erban.application.IReportConstants
import com.yizhuan.erban.application.ReportManager
import com.yizhuan.erban.avroom.adapter.RoomVPAdapter
import com.yizhuan.erban.base.BaseFragment
import com.yizhuan.erban.databinding.FragmentHomeBinding
import com.yizhuan.erban.home.HomeViewModel
import com.yizhuan.erban.home.adapter.MainMagicIndicatorAdapter
import com.yizhuan.erban.home.adapter.PartyMagicIndicatorAdapter
import com.yizhuan.erban.home.helper.OpenRoomHelper
import com.yizhuan.erban.ui.search.SearchActivity
@@ -46,7 +46,11 @@ class HomeFragment : BaseFragment(), View.OnClickListener,
override fun onClick(v: View) {
when (v.id) {
R.id.iv_search -> {
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_SEARCH, ResUtil.getString(R.string.home_fragment_homefragment_01))
//首页_搜索
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.ONE),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
))
SearchActivity.start(activity)
//为啥触发条件这么恶心
if (DemoCache.readAnchorCardView() == 0) {
@@ -54,11 +58,19 @@ class HomeFragment : BaseFragment(), View.OnClickListener,
}
}
R.id.iv_ranking -> {
StatisticManager.Instance()
.onEvent(StatisticsProtocol.EVENT_HOME_RANK_CLICK, ResUtil.getString(R.string.home_fragment_homefragment_02))
//首页_排行榜
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.THREE),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
))
CommonWebViewActivity.start(mContext, UriProvider.getRanking())
}
R.id.iv_my_room -> {
//首页_创建房间
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.TWO),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
))
StatisticManager.Instance()
.onEvent(StatisticsProtocol.EVENT_HOME_MY_ROOM_CLICK, ResUtil.getString(R.string.home_fragment_homefragment_03))
OpenRoomHelper.openRoom(baseActivity)

View File

@@ -8,6 +8,8 @@ import androidx.annotation.Nullable;
import com.trello.rxlifecycle3.android.FragmentEvent;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.IReportConstants;
import com.yizhuan.erban.application.ReportManager;
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
import com.yizhuan.erban.base.BaseFragment;
import com.yizhuan.erban.home.adapter.HomeTopAdapter;
@@ -29,6 +31,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
@@ -125,7 +128,11 @@ public class HomeTabHomeFragment extends BaseFragment {
.setScrollDuration(800)
.setRevealWidth(leftRevealWidth, rightRevealWidth)
.setOnPageClickListener((clickedView, position) -> {
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_TJ_ROOM_SUCCESS, ResUtil.getString(R.string.home_adapter_homeroomfragmentadapter_01));
//首页_热门房间
HashMap<String, Object> map = new HashMap<>(3);
map.put(IReportConstants.HOMEPAGE_TYPE, IReportConstants.FIVE);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE);
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, map);
AVRoomActivity.startForFromType(mContext, list.get(position).getRoomUid(), AVRoomActivity.FROM_TYPE_RECOMMEND);
})
.create(list);

View File

@@ -5,6 +5,8 @@ import android.view.View
import androidx.fragment.app.activityViewModels
import com.chad.library.adapter.base.BaseQuickAdapter
import com.yizhuan.erban.R
import com.yizhuan.erban.application.IReportConstants
import com.yizhuan.erban.application.ReportManager
import com.yizhuan.erban.avroom.activity.AVRoomActivity
import com.yizhuan.erban.avroom.dialog.CreateRoomDialog
import com.yizhuan.erban.base.BaseActivity
@@ -15,8 +17,6 @@ import com.yizhuan.erban.home.adapter.HomeChatAdapter
import com.yizhuan.erban.home.adapter.HomeHotAdapter
import com.yizhuan.erban.home.helper.BannerHelper
import com.yizhuan.erban.home.helper.OpenRoomHelper
import com.yizhuan.xchat_android_core.Constants
import com.yizhuan.xchat_android_core.auth.AuthModel
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent
import com.yizhuan.xchat_android_core.statistic.StatisticManager
@@ -58,15 +58,20 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
homeViewModel.bannerLiveData.observe(this) {
BannerHelper.setBanner(binding.rollView, it) { _, _ ->
StatisticManager.Instance()
.onEvent(
StatisticsProtocol.EVENT_HOME_BANNER_CLICK,
ResUtil.getString(R.string.home_fragment_recommendfragment_01)
)
//首页_banner
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SIX),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
))
}
}
binding.ivGameGuide.setOnClickListener {
//首页_扩列聊天-创建游戏房
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.NINE),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
))
CreateRoomDialog().apply { setGameVisible() }.show(context)
}
}
@@ -86,10 +91,11 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
val homePlayInfo: HomeRoomInfo? = charAdapter.getItem(position)
if (homePlayInfo != null) {
StatisticManager.Instance().onEvent(
StatisticsProtocol.EVENT_KH_ROOM_SUCCESS,
ResUtil.getString(R.string.home_fragment_homeplayfragment_02)
)
//首页_扩列聊天-用户房间
ReportManager.get().reportEvent(IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.SEVEN),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
))
AVRoomActivity.startForFromType(
mContext,
homePlayInfo.uid,
@@ -99,6 +105,13 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
}
binding.mRecyclerChat.adapter = charAdapter
binding.mLiCreateRoom.setOnClickListener {
//首页_扩列聊天-创建普通房
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.EIGHT),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
OpenRoomHelper.openRoom(context as BaseActivity?)
}
homeViewModel.homePlayInfoData.observe(this) {
@@ -121,12 +134,14 @@ class RecommendFragment : BaseViewBindingFragment<FragmentRecommendBinding>() {
BaseQuickAdapter.OnItemClickListener { _: BaseQuickAdapter<*, *>?, _: View?, position: Int ->
val homePlayInfo: HomeRoomInfo? = roomHotAdapter.getItem(position)
if (homePlayInfo != null) {
AVRoomActivity.start(mContext, homePlayInfo.uid)
StatisticManager.Instance()
.onEvent(
StatisticsProtocol.EVENT_RM_ROOM_SUCCESS,
ResUtil.getString(R.string.home_adapter_roomhotadapter_01)
//首页_房间派对
ReportManager.get().reportEvent(
IReportConstants.MODULE_HOMEPAGE_CLICK, mapOf(
Pair(IReportConstants.HOMEPAGE_TYPE, IReportConstants.TEN),
Pair(IReportConstants.MODULE, IReportConstants.PEKO_HOMEPAGE)
)
)
AVRoomActivity.start(mContext, homePlayInfo.uid)
}
}
binding.mRecyclerRoom.adapter = roomHotAdapter

View File

@@ -18,7 +18,10 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import com.yizhuan.erban.MainActivity;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.IReportConstants;
import com.yizhuan.erban.application.ReportManager;
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
import com.yizhuan.erban.ui.webview.SimpleWebViewActivity;
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
@@ -26,6 +29,8 @@ import com.yizhuan.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_library.utils.ResUtil;
import com.yizhuan.xchat_android_library.utils.ScreenUtils;
import java.util.HashMap;
public class PrivacyAgreementDialog extends Dialog implements View.OnClickListener {
private OnCallBack onCallBack;
@@ -90,10 +95,21 @@ public class PrivacyAgreementDialog extends Dialog implements View.OnClickListen
window.setAttributes(lp);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//协议弹框展示
HashMap<String, Object> map = new HashMap<>(2);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
ReportManager.get().reportEvent(IReportConstants.AGREEMENT_SHOW, map);
}
@Override
public void onClick(View v) {
//协议弹框展示
HashMap<String, Object> map = new HashMap<>(5);
map.put(IReportConstants.CLICK_TYPE, IReportConstants.THREE);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
map.put(IReportConstants.PAGE, IReportConstants.ONE);
ReportManager.get().reportEvent(IReportConstants.AGREEMENT_CLICK, map);
cancel();
if (onCallBack != null) {
onCallBack.onFinish(v.getId() == R.id.tv_confirm);

View File

@@ -21,6 +21,7 @@ import com.netease.nim.uikit.StatusBarUtil;
import com.tongdaxing.erban.upgrade.AppUpgradeHelper;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.IReportConstants;
import com.yizhuan.erban.application.ReportManager;
import com.yizhuan.erban.base.BaseActivity;
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
@@ -63,6 +64,10 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
onSetListener();
setProtocol();
AppUpgradeHelper.checkAppUpgrade(this);
//登录页展示时
HashMap<String, Object> map = new HashMap<>(2);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
ReportManager.get().reportEvent(IReportConstants.LOGIN_SHOW, map);
}
private void onFindViews() {
@@ -96,6 +101,13 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_1F1A4E)) {
@Override
public void onClick(@NonNull View widget) {
//隐私政策点击
HashMap<String, Object> map = new HashMap<>(5);
map.put(IReportConstants.CLICK_TYPE, IReportConstants.TWO);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
map.put(IReportConstants.PAGE, IReportConstants.TWO);
ReportManager.get().reportEvent(IReportConstants.AGREEMENT_CLICK, map);
if (widget instanceof TextView)
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
@@ -106,6 +118,12 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_1F1A4E)) {
@Override
public void onClick(@NonNull View widget) {
//用户协议点击
HashMap<String, Object> map = new HashMap<>(5);
map.put(IReportConstants.CLICK_TYPE, IReportConstants.ONE);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
map.put(IReportConstants.PAGE, IReportConstants.TWO);
ReportManager.get().reportEvent(IReportConstants.AGREEMENT_CLICK, map);
if (widget instanceof TextView)
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
@@ -123,6 +141,13 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
tvProtocol.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) {
//协议点击同意
HashMap<String, Object> map = new HashMap<>(5);
map.put(IReportConstants.CLICK_TYPE, IReportConstants.THREE);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
map.put(IReportConstants.PAGE, IReportConstants.TWO);
ReportManager.get().reportEvent(IReportConstants.AGREEMENT_CLICK, map);
tvProtocolHint.setVisibility(View.GONE);
DemoCache.saveBoolean(NEED_CHECKED_PROTOCOL, true);
}
@@ -138,6 +163,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
switch (v.getId()) {
case R.id.tv_facebook:
reportLoginType(IReportConstants.ONE);
getDialogManager().showProgressDialog(this);
AuthModel.get().facebookLogin()
.compose(bindUntilEvent(ActivityEvent.DESTROY))
@@ -148,7 +174,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
}
@Override
public void onSuccess(String s) {
public void onSuccess(String result) {
reportLoginResult(IReportConstants.ONE, IReportConstants.ONE, "");
HashMap<String, Object> map = new HashMap<>(2);
map.put(FirebaseAnalytics.Param.METHOD, getString(R.string.login_facebook));
ReportManager.get().reportEvent(FirebaseAnalytics.Event.LOGIN, map);
@@ -158,12 +185,14 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
@Override
public void onError(Throwable e) {
reportLoginResult(IReportConstants.ONE, IReportConstants.ZERO, e.getMessage());
getDialogManager().dismissDialog();
dealWithLoginError(e);
}
});
break;
case R.id.tv_line:
reportLoginType(IReportConstants.TWO);
getDialogManager().showProgressDialog(this);
AuthModel.get().lineLogin()
.compose(bindUntilEvent(ActivityEvent.DESTROY))
@@ -174,7 +203,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
}
@Override
public void onSuccess(String s) {
public void onSuccess(String result) {
reportLoginResult(IReportConstants.TWO, IReportConstants.ONE, "");
HashMap<String, Object> map = new HashMap<>(2);
map.put(FirebaseAnalytics.Param.METHOD, getString(R.string.login_line));
ReportManager.get().reportEvent(FirebaseAnalytics.Event.LOGIN, map);
@@ -184,6 +214,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
@Override
public void onError(Throwable e) {
reportLoginResult(IReportConstants.TWO, IReportConstants.ZERO, e.getMessage());
getDialogManager().dismissDialog();
dealWithLoginError(e);
}
@@ -191,6 +222,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
break;
case R.id.tv_google:
reportLoginType(IReportConstants.THREE);
getDialogManager().showProgressDialog(this);
AuthModel.get().googleLogin()
.compose(bindUntilEvent(ActivityEvent.DESTROY))
@@ -201,7 +233,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
}
@Override
public void onSuccess(String s) {
public void onSuccess(String result) {
reportLoginResult(IReportConstants.THREE, IReportConstants.ONE, "");
HashMap<String, Object> map = new HashMap<>(2);
map.put(FirebaseAnalytics.Param.METHOD, getString(R.string.login_google));
ReportManager.get().reportEvent(FirebaseAnalytics.Event.LOGIN, map);
@@ -211,6 +244,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
@Override
public void onError(Throwable e) {
reportLoginResult(IReportConstants.THREE, IReportConstants.ZERO, e.getMessage());
getDialogManager().dismissDialog();
dealWithLoginError(e);
e.printStackTrace();
@@ -219,15 +253,46 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
break;
case R.id.tv_phone:
reportLoginType(IReportConstants.FOUR);
LoginPhoneActivity.start(this);
break;
case R.id.tv_others:
reportLoginType(IReportConstants.FIVE);
LoginPasswordActivity.start(LoginActivity.this);
break;
}
}
/**
* 上报登录结果
* @param loginType
* @param result
* @param failDetail
*/
private void reportLoginResult(int loginType, int result, String failDetail) {
HashMap<String, Object> map = new HashMap<>(6);
map.put(IReportConstants.LOGIN_TYPE, loginType);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
map.put(IReportConstants.RESULT, result);
if(result == IReportConstants.ZERO){
map.put(IReportConstants.FAIL_DETAIL, failDetail);
}
ReportManager.get().reportEvent(IReportConstants.LOGIN_RESULT, map);
}
/**
* 上报登录方式
*
* @param loginType 登录方式
*/
private void reportLoginType(int loginType) {
HashMap<String, Object> map = new HashMap<>(3);
map.put(IReportConstants.CLICK_TYPE, loginType);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
ReportManager.get().reportEvent(IReportConstants.LOGIN_CLICK, map);
}
@Override
protected void setStatusBar() {
super.setStatusBar();

View File

@@ -15,6 +15,7 @@ import com.google.firebase.analytics.FirebaseAnalytics
import com.netease.nim.uikit.StatusBarUtil
import com.trello.rxlifecycle3.android.ActivityEvent
import com.yizhuan.erban.R
import com.yizhuan.erban.application.IReportConstants
import com.yizhuan.erban.application.ReportManager
import com.yizhuan.erban.base.BaseViewBindingActivity
import com.yizhuan.erban.databinding.ActivityLoginCodeBinding
@@ -171,6 +172,13 @@ class LoginCodeActivity : BaseViewBindingActivity<ActivityLoginCodeBinding>() {
}
private fun login() {
//发起登录
ReportManager.get().reportEvent(
IReportConstants.LOGIN_REQUEST, mapOf(
Pair(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN),
Pair(IReportConstants.LOGIN_TYPE, IReportConstants.FOUR)
)
)
val smsCode = binding.etCode.text.toString()
dialogManager.showProgressDialog(
this,
@@ -190,6 +198,7 @@ class LoginCodeActivity : BaseViewBindingActivity<ActivityLoginCodeBinding>() {
}
override fun onSuccess(t: String) {
reportLoginResult(IReportConstants.ONE, "")
DemoCache.saveBoundAuthCode(true)
dialogManager.dismissDialog()
val map = HashMap<String, Any>(2)
@@ -201,6 +210,10 @@ class LoginCodeActivity : BaseViewBindingActivity<ActivityLoginCodeBinding>() {
}
override fun onError(e: Throwable) {
reportLoginResult(
IReportConstants.ZERO,
e.message.toString()
)
dialogManager.dismissDialog()
dealWithLoginError(e)
}
@@ -213,6 +226,22 @@ class LoginCodeActivity : BaseViewBindingActivity<ActivityLoginCodeBinding>() {
)
}
/**
* 上报登录结果
* @param result
* @param failDetail
*/
private fun reportLoginResult(result: Int, failDetail: String) {
val map = HashMap<String, Any>(6)
map[IReportConstants.LOGIN_TYPE] = IReportConstants.FOUR
map[IReportConstants.MODULE] = IReportConstants.PEKO_LOGIN
map[IReportConstants.RESULT] = result
if (result == IReportConstants.ZERO) {
map[IReportConstants.FAIL_DETAIL] = failDetail
}
ReportManager.get().reportEvent(IReportConstants.LOGIN_RESULT, map)
}
fun dealWithLoginError(e: Throwable?) {
LogoutHelper.dealWithLoginError(this, e)
}

View File

@@ -12,6 +12,7 @@ import android.widget.EditText;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.netease.nim.uikit.StatusBarUtil;
import com.yizhuan.erban.R;
import com.yizhuan.erban.application.IReportConstants;
import com.yizhuan.erban.application.ReportManager;
import com.yizhuan.erban.base.BaseActivity;
import com.yizhuan.erban.ui.login.helper.LogoutHelper;
@@ -96,6 +97,12 @@ public class LoginPasswordActivity extends BaseActivity {
}
private void login() {
//发起登录
HashMap<String, Object> map = new HashMap<>(3);
map.put(IReportConstants.CLICK_TYPE, IReportConstants.FIVE);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
ReportManager.get().reportEvent(IReportConstants.LOGIN_REQUEST, map);
getDialogManager().showProgressDialog(this, getString(R.string.login_is_logining));
AuthModel.get().login(
"",
@@ -111,7 +118,8 @@ public class LoginPasswordActivity extends BaseActivity {
}
@Override
public void onSuccess(String s) {
public void onSuccess(String result) {
reportLoginResult(IReportConstants.ONE, result);
HashMap<String, Object> map = new HashMap<>(2);
map.put(FirebaseAnalytics.Param.METHOD, getString(R.string.login_account));
ReportManager.get().reportEvent(FirebaseAnalytics.Event.LOGIN, map);
@@ -122,12 +130,29 @@ public class LoginPasswordActivity extends BaseActivity {
@Override
public void onError(Throwable e) {
reportLoginResult(IReportConstants.ZERO, e.getMessage());
getDialogManager().dismissDialog();
dealWithLoginError(e);
}
});
}
/**
* 上报登录结果
* @param result
* @param failDetail
*/
private void reportLoginResult(int result, String failDetail) {
HashMap<String, Object> map = new HashMap<>(6);
map.put(IReportConstants.LOGIN_TYPE, IReportConstants.FIVE);
map.put(IReportConstants.MODULE, IReportConstants.PEKO_LOGIN);
map.put(IReportConstants.RESULT, result);
if(result == IReportConstants.ZERO){
map.put(IReportConstants.FAIL_DETAIL, failDetail);
}
ReportManager.get().reportEvent(IReportConstants.LOGIN_RESULT, map);
}
public void dealWithLoginError(Throwable e) {
LogoutHelper.dealWithLoginError(this, e);
}

View File

@@ -111,8 +111,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
/**
* 类型1、手机号/耳伴号登陆2、手机号/耳伴号登陆并绑定QQ
*/
private static final int TYPE_LOGIN_NORMAL = 1;
private static final int TYPE_LOGIN_BIND_QQ = 2;
public static final int TYPE_GOOGLE_LOGIN = 8;
public static final int TYPE_LINE_LOGIN = 9;
public static final int TYPE_FACEBOOK_LOGIN = 10;

View File

@@ -28,5 +28,5 @@ COMPILE_SDK_VERSION=32
MIN_SDK_VERSION=21
TARGET_SDK_VERSION=32
version_name=1.3.0
version_code=130
version_name=1.3.1
version_code=131