This repository was archived by the owner on Jul 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed
app/src/main/java/com/zulip/android Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change
1
+ package com .zulip .android ;
2
+
3
+ import android .os .Build ;
4
+
5
+ public class BuildHelper {
6
+
7
+ public static boolean shouldLogToCrashlytics () {
8
+ return !isEmulator () && !BuildConfig .DEBUG ;
9
+ }
10
+
11
+ public static boolean isEmulator () {
12
+ return Build .HARDWARE .contains ("goldfish" );
13
+ }
14
+ }
Original file line number Diff line number Diff line change 1
1
package com .zulip .android ;
2
2
3
- import android .os .Build ;
4
-
5
3
import com .crashlytics .android .Crashlytics ;
6
4
7
5
public class ZLog {
8
6
9
7
public static void logException (Throwable e ) {
10
- if (Build . HARDWARE . contains ( "goldfish" )) {
8
+ if (BuildHelper . shouldLogToCrashlytics ( )) {
11
9
e .printStackTrace ();
12
10
} else {
13
11
Crashlytics .logException (e );
Original file line number Diff line number Diff line change 10
10
import android .content .SharedPreferences .Editor ;
11
11
import android .content .pm .PackageInfo ;
12
12
import android .content .pm .PackageManager .NameNotFoundException ;
13
- import android .os .Build ;
14
13
import android .os .Handler ;
15
14
import android .util .Log ;
16
15
@@ -72,10 +71,7 @@ public void onCreate() {
72
71
lastEventId = settings .getInt ("lastEventId" , -1 );
73
72
pointer = settings .getInt ("pointer" , -1 );
74
73
75
-
76
- if (Build .HARDWARE .contains ("goldfish" ) || BuildConfig .DEBUG ) { // dont load crashlytics for debug builds
77
- Log .i ("hardware" , "running in emulator" );
78
- } else {
74
+ if (BuildHelper .shouldLogToCrashlytics ()) {
79
75
Crashlytics .start (this );
80
76
}
81
77
You can’t perform that action at this time.
0 commit comments