Skip to content

Commit 3295012

Browse files
author
ghui
committed
update
1 parent ce24c4c commit 3295012

21 files changed

+79
-71
lines changed

app/build.gradle

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'com.android.application'
2+
//apply plugin: "com.flurry.android.symbols"
23

34
android {
45
compileSdkVersion 30
@@ -107,9 +108,11 @@ dependencies {
107108
implementation 'org.greenrobot:eventbus:3.1.1'
108109
implementation 'com.android.billingclient:billing:3.0.3'
109110
implementation 'com.oasisfeng.condom:library:2.2.0'
111+
implementation 'com.flurry.android:analytics:13.1.0'
110112
implementation 'org.slf4j:slf4j-nop:1.7.25'
111-
def appCenterSdkVersion = '4.1.0'
112-
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
113-
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
114113
implementation "com.github.parse-community.Parse-SDK-Android:parse:1.26.0"
115114
}
115+
116+
//flurryCrash {
117+
// configPath "flurry.config"
118+
//}

app/flurry.config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
token=eyJhbGciOiJIUzI1NiIsImtpZCI6ImZsdXJyeS56dXVsLnByb2Qua2V5c3RvcmUua2V5LjIifQ.eyJpc3MiOiJodHRwczovL3p1dWwuZmx1cnJ5LmNvbTo0NDMvdG9rZW4iLCJpYXQiOjE1ODk3MDk1ODksImV4cCI6MzMxNDY2MTgzODksInN1YiI6IjQ2Mzg1NSIsImF1ZCI6IjQiLCJ0eXBlIjo0LCJqdGkiOiIxMTMxMCJ9.u6HK6VJJEsXovnUHbjr5GFNg7NwvySRvTpOg1C771WQ
2+
api-key=4PZMS4HSZP3YNMBP8W4R

app/src/main/java/me/ghui/v2er/general/App.java

+12-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
import android.preference.PreferenceManager;
55
import androidx.annotation.Nullable;
66

7-
import com.microsoft.appcenter.AppCenter;
8-
import com.microsoft.appcenter.analytics.Analytics;
9-
import com.microsoft.appcenter.crashes.Crashes;
7+
import com.flurry.android.FlurryAgent;
108
import com.oasisfeng.condom.CondomContext;
119
import com.orhanobut.logger.AndroidLogAdapter;
1210
import com.orhanobut.logger.FormatStrategy;
@@ -26,8 +24,9 @@
2624
import me.ghui.v2er.module.pay.ParseOrder;
2725
import me.ghui.v2er.module.pay.PayUtil;
2826
import me.ghui.v2er.network.APIService;
29-
import me.ghui.v2er.util.V2er;
27+
import me.ghui.v2er.util.Flurry;
3028
import me.ghui.v2er.util.L;
29+
import me.ghui.v2er.util.UserUtils;
3130

3231
/**
3332
* Created by ghui on 05/03/2017.
@@ -52,7 +51,6 @@ private void init() {
5251
sInstance = this;
5352
mAppComponent = DaggerAppComponent.builder().appModule(new AppModule(sInstance))
5453
.build();
55-
initAppCenter();
5654
rxjava();
5755
initLogger();
5856
PayUtil.checkIsGooglePro(false);
@@ -65,7 +63,8 @@ private void init() {
6563
private void rxjava() {
6664
RxJavaPlugins.setErrorHandler(e -> {
6765
L.e("globalHandler: " + e.getMessage());
68-
V2er.capture("globalHandler: " + e.getMessage());
66+
// V2er.capture("globalHandler: " + e.getMessage());
67+
Flurry.capture("globalHandler: " + e.getMessage());
6968
});
7069
}
7170

@@ -85,7 +84,7 @@ public boolean isLoggable(int priority, @Nullable String tag) {
8584
}
8685

8786
private void initThirdPartySDK() {
88-
// if (BuildConfig.DEBUG) return;
87+
initFlurry();
8988
initParseSDK();
9089
initWechat();
9190
}
@@ -99,9 +98,12 @@ private void initParseSDK() {
9998
.build());
10099
}
101100

102-
private void initAppCenter() {
103-
AppCenter.start(this, "86417784-dfd2-4d2e-9ed9-fccb88bb2b1f",
104-
Analytics.class, Crashes.class);
101+
private void initFlurry() {
102+
new FlurryAgent.Builder()
103+
.withLogEnabled(BuildConfig.DEBUG)
104+
.withCaptureUncaughtExceptions(true)
105+
.build(this, "4PZMS4HSZP3YNMBP8W4R");
106+
FlurryAgent.setUserId(UserUtils.getUserName());
105107
}
106108

107109
private void initWechat() {

app/src/main/java/me/ghui/v2er/module/base/BaseActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import butterknife.ButterKnife;
4040
import io.reactivex.ObservableTransformer;
4141
import me.ghui.v2er.util.Check;
42+
import me.ghui.v2er.util.Flurry;
4243
import me.ghui.v2er.util.Theme;
4344
import me.ghui.v2er.R;
4445
import me.ghui.v2er.bus.Bus;

app/src/main/java/me/ghui/v2er/module/home/NewsFragment.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import me.ghui.v2er.module.topic.TopicActivity;
1919
import me.ghui.v2er.network.bean.NewsInfo;
2020
import me.ghui.v2er.network.bean.TopicBasicInfo;
21-
import me.ghui.v2er.util.V2er;
21+
import me.ghui.v2er.util.Flurry;
2222
import me.ghui.v2er.util.L;
2323
import me.ghui.v2er.util.UserUtils;
2424
import me.ghui.v2er.widget.LoadMoreRecyclerView;
@@ -163,7 +163,7 @@ public TabInfo getCurrentTab() {
163163
@Override
164164
public void onItemClick(View view, ViewHolder holder, int position) {
165165
if (position < 0) {
166-
V2er.capture("NewsFragment.onItemClick.postion < 0");
166+
Flurry.capture("NewsFragment.onItemClick.postion < 0");
167167
return;
168168
}
169169
View shareView = holder.getView(R.id.avatar_img);

app/src/main/java/me/ghui/v2er/module/home/SearchFragment.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import android.widget.EditText;
1212
import android.widget.ImageView;
1313

14+
import com.flurry.android.FlurryAgent;
1415

1516
import javax.inject.Inject;
1617

@@ -19,7 +20,7 @@
1920
import me.ghui.v2er.module.topic.TopicActivity;
2021
import me.ghui.v2er.network.bean.SoV2EXSearchResultInfo;
2122
import me.ghui.v2er.util.Check;
22-
import me.ghui.v2er.util.V2er;
23+
import me.ghui.v2er.util.Flurry;
2324
import me.ghui.v2er.util.Theme;
2425
import me.ghui.v2er.R;
2526
import me.ghui.v2er.adapter.base.MultiItemTypeAdapter;
@@ -165,7 +166,7 @@ public void onAnimationStart(Animator animation) {
165166
if (mSearchRootView.isAttachedToWindow()) {
166167
mSearchRootView.animate().alpha(1f).start();
167168
} else {
168-
V2er.capture("mSearchRootView is Detached");
169+
Flurry.capture("mSearchRootView is Detached");
169170
}
170171
} else {
171172
animator = ViewAnimationUtils.createCircularReveal(mCardView,
@@ -187,7 +188,7 @@ public void onAnimationEnd(Animator animation) {
187188
getActivity().getSupportFragmentManager().popBackStack();
188189
} catch (Exception e) {
189190
e.printStackTrace();
190-
V2er.logEvent("mCardView is null");
191+
FlurryAgent.logEvent("mCardView is null");
191192
}
192193
}
193194
});

app/src/main/java/me/ghui/v2er/module/login/LoginPresenter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.ghui.v2er.module.login;
22

33

4+
import com.flurry.android.FlurryAgent;
45

56
import me.ghui.v2er.util.Check;
67
import me.ghui.v2er.R;
@@ -13,7 +14,6 @@
1314
import me.ghui.v2er.network.bean.TwoStepLoginInfo;
1415
import me.ghui.v2er.network.bean.UserInfo;
1516
import me.ghui.v2er.util.UserUtils;
16-
import me.ghui.v2er.util.V2er;
1717

1818
/**
1919
* Created by ghui on 27/03/2017.
@@ -72,7 +72,7 @@ public void onConsume(BaseInfo info) {
7272
DailyInfo resultInfo = (DailyInfo) info;
7373
UserUtils.saveLogin(UserInfo.build(resultInfo.getUserName(), resultInfo.getAvatar()));
7474
mView.onLoginSuccess();
75-
V2er.setUserId(resultInfo.getUserName());
75+
FlurryAgent.setUserId(resultInfo.getUserName());
7676
} else if (info instanceof LoginParam) {
7777
//login failure
7878
LoginParam loginParam = (LoginParam) info;

app/src/main/java/me/ghui/v2er/module/login/SignInWithGoogleActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.Intent;
55
import android.webkit.WebSettings;
66

7+
import com.flurry.android.FlurryAgent;
78

89
import java.util.HashMap;
910
import java.util.Map;
@@ -18,7 +19,6 @@
1819
import me.ghui.v2er.network.bean.UserInfo;
1920
import me.ghui.v2er.util.L;
2021
import me.ghui.v2er.util.UserUtils;
21-
import me.ghui.v2er.util.V2er;
2222

2323
/**
2424
* Created by ghui on 13/08/2017.
@@ -81,7 +81,7 @@ public void onConsume(DailyInfo checkInInfo) {
8181
Navigator.from(SignInWithGoogleActivity.this)
8282
.setFlag(Intent.FLAG_ACTIVITY_CLEAR_TOP)
8383
.to(MainActivity.class).start();
84-
V2er.setUserId(checkInInfo.getUserName());
84+
FlurryAgent.setUserId(checkInInfo.getUserName());
8585
finish();
8686
}
8787
});

app/src/main/java/me/ghui/v2er/module/login/TwoStepLoginActivity.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import android.text.TextWatcher;
99
import android.widget.Button;
1010

11+
import com.flurry.android.FlurryAgent;
12+
1113
import org.jsoup.helper.StringUtil;
1214

1315
import java.util.HashMap;
@@ -30,7 +32,6 @@
3032
import me.ghui.v2er.util.DarkModelUtils;
3133
import me.ghui.v2er.util.UserUtils;
3234
import me.ghui.v2er.util.Utils;
33-
import me.ghui.v2er.util.V2er;
3435
import me.ghui.v2er.widget.BaseToolBar;
3536

3637
/**
@@ -181,7 +182,7 @@ public void onConsume(NewsInfo resultInfo) {
181182
public void onConsume(LoginResultInfo resultInfo) {
182183
toast("登录成功");
183184
UserUtils.saveLogin(UserInfo.build(resultInfo.getUserName(), resultInfo.getAvatar()));
184-
V2er.setUserId(resultInfo.getUserName());
185+
FlurryAgent.setUserId(resultInfo.getUserName());
185186
finish();
186187
Navigator.from(TwoStepLoginActivity.this)
187188
.setFlag(Intent.FLAG_ACTIVITY_CLEAR_TOP)

app/src/main/java/me/ghui/v2er/module/node/NodeTopicActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import butterknife.BindView;
2828
import butterknife.OnClick;
2929
import jp.wasabeef.glide.transformations.BlurTransformation;
30-
import me.ghui.v2er.util.V2er;
30+
import me.ghui.v2er.util.Flurry;
3131
import me.ghui.v2er.util.Theme;
3232
import me.ghui.v2er.R;
3333
import me.ghui.v2er.adapter.base.MultiItemTypeAdapter;
@@ -435,7 +435,7 @@ private void toggleStar(boolean isStared) {
435435
public void onItemClick(View view, ViewHolder holder, int position) {
436436
NodeTopicInfo.Item item = mAdapter.getItem(position);
437437
if (item == null) {
438-
V2er.capture("NodeTopicInfo.Item is null: postion: " + position
438+
Flurry.capture("NodeTopicInfo.Item is null: postion: " + position
439439
+ ", mAdapter.size: " + mAdapter.getItemCount()
440440
+ ", nodeName: " + mTagName);
441441
return;

app/src/main/java/me/ghui/v2er/module/topic/TopicActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import butterknife.BindView;
3636
import butterknife.OnClick;
3737
import me.ghui.v2er.util.Check;
38-
import me.ghui.v2er.util.V2er;
38+
import me.ghui.v2er.util.Flurry;
3939
import me.ghui.v2er.util.Theme;
4040
import me.ghui.v2er.R;
4141
import me.ghui.v2er.general.ActivityReloader;
@@ -817,7 +817,7 @@ private void updateReportMenuItem(boolean hasReportPermission, boolean hasReport
817817
@Override
818818
public void afterStarTopic(TopicInfo topicInfo) {
819819
if (mTopicInfo == null) {
820-
V2er.capture("afterStarTopic.mTopicID: " + mTopicId);
820+
Flurry.capture("afterStarTopic.mTopicID: " + mTopicId);
821821
toast("收藏遇到问题");
822822
return;
823823
}

app/src/main/java/me/ghui/v2er/module/topic/TopicPresenter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import me.ghui.v2er.network.bean.NewsInfo;
1111
import me.ghui.v2er.network.bean.ThxResponseInfo;
1212
import me.ghui.v2er.network.bean.TopicInfo;
13-
import me.ghui.v2er.util.V2er;
13+
import me.ghui.v2er.util.Flurry;
1414
import me.ghui.v2er.util.RefererUtils;
1515
import me.ghui.v2er.util.UserUtils;
1616

@@ -90,7 +90,7 @@ public void starTopic(String topicId, String once) {
9090
@Override
9191
public void onConsume(TopicInfo topicInfo) {
9292
if (topicInfo == null) {
93-
V2er.capture("afterStarTopic.mTopicID: " + topicId + ", once: " + once);
93+
Flurry.capture("afterStarTopic.mTopicID: " + topicId + ", once: " + once);
9494
}
9595
mView.afterStarTopic(topicInfo);
9696
}

app/src/main/java/me/ghui/v2er/module/user/UserHomeActivity.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
import me.ghui.v2er.module.base.BaseActivity;
4343
import me.ghui.v2er.module.topic.TopicActivity;
4444
import me.ghui.v2er.network.bean.UserPageInfo;
45+
import me.ghui.v2er.util.Flurry;
4546
import me.ghui.v2er.util.L;
4647
import me.ghui.v2er.util.UserUtils;
4748
import me.ghui.v2er.util.Utils;
48-
import me.ghui.v2er.util.V2er;
4949
import me.ghui.v2er.util.ViewUtils;
5050
import me.ghui.v2er.util.Voast;
5151
import me.ghui.v2er.widget.BaseToolBar;
@@ -147,9 +147,10 @@ protected BaseToolBar attachToolbar() {
147147
@Override
148148
protected void parseExtras(Intent intent) {
149149
mUserName = intent.getStringExtra(USER_NAME_KEY);
150+
mUserName = null;
150151
if (Check.isEmpty(mUserName)) {
151152
Voast.show("要加载的页面用户名为空");
152-
V2er.capture(new Throwable());
153+
Flurry.capture(new Throwable("TEST"));
153154
finish();
154155
return;
155156
}

app/src/main/java/me/ghui/v2er/network/GeneralConsumer.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import me.ghui.v2er.network.bean.LoginParam;
1010
import me.ghui.v2er.network.bean.NewsInfo;
1111
import me.ghui.v2er.network.bean.TwoStepLoginInfo;
12-
import me.ghui.v2er.util.V2er;
12+
import me.ghui.v2er.util.Flurry;
1313
import me.ghui.v2er.util.L;
1414
import me.ghui.v2er.util.RxUtils;
1515
import me.ghui.v2er.util.UserUtils;
@@ -41,7 +41,7 @@ public void onNext(T t) {
4141
if (t == null) {
4242
L.e("API RESPONSE: NULL");
4343
onError(new Throwable("Unknown Error"));
44-
V2er.capture("GeneralConsumer: t is null");
44+
Flurry.capture("GeneralConsumer: t is null");
4545
return;
4646
}
4747
L.v("API RESPONSE: \n" + t.toString() + "\n");
@@ -125,7 +125,7 @@ public void onError(Throwable e) {
125125
String msg = "Unknown Error";
126126
if (!Utils.isNetworkAvailable()) msg = "Network Connection Error";
127127
generalError = new GeneralError(ResultCode.NETWORK_ERROR, msg);
128-
V2er.capture("generalConsumer.onError: " + e);
128+
Flurry.capture("generalConsumer.onError: " + e);
129129
if (BuildConfig.DEBUG) {
130130
throw new RuntimeException(e);
131131
}

app/src/main/java/me/ghui/v2er/network/UrlInterceptor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import me.ghui.v2er.module.node.NodeTopicActivity;
1616
import me.ghui.v2er.module.topic.TopicActivity;
1717
import me.ghui.v2er.module.user.UserHomeActivity;
18-
import me.ghui.v2er.util.V2er;
18+
import me.ghui.v2er.util.Flurry;
1919
import me.ghui.v2er.util.L;
2020
import me.ghui.v2er.util.UriUtils;
2121
import me.ghui.v2er.util.UserUtils;
@@ -84,7 +84,7 @@ public static boolean intercept(String url, Context context, boolean onlyCheck,
8484
try {
8585
customTabsIntent.launchUrl(context, Uri.parse(url));
8686
} catch (ActivityNotFoundException e) {
87-
V2er.capture(e);
87+
Flurry.capture(e);
8888
WapActivity.open(url, context, true);
8989
}
9090
return true;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package me.ghui.v2er.util;
2+
3+
import com.flurry.android.FlurryAgent;
4+
5+
/**
6+
* Flurry to wrapper FlurryClient
7+
*/
8+
public class Flurry {
9+
public static void capture(String message, Throwable e) {
10+
FlurryAgent.onError("0", message, e);
11+
}
12+
13+
public static void capture(String message) {
14+
capture(message, new Throwable(message));
15+
}
16+
17+
public static void capture(Throwable e) {
18+
capture("", e);
19+
}
20+
}

0 commit comments

Comments
 (0)