Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 36d8da7

Browse files
niftyneitimabbott
authored andcommitted
Unify references to emulator
1 parent 52f1d47 commit 36d8da7

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
}

app/src/main/java/com/zulip/android/ZLog.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.zulip.android;
22

3-
import android.os.Build;
4-
53
import com.crashlytics.android.Crashlytics;
64

75
public class ZLog {
86

97
public static void logException(Throwable e) {
10-
if (Build.HARDWARE.contains("goldfish")) {
8+
if (BuildHelper.shouldLogToCrashlytics()) {
119
e.printStackTrace();
1210
} else {
1311
Crashlytics.logException(e);

app/src/main/java/com/zulip/android/ZulipApp.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import android.content.SharedPreferences.Editor;
1111
import android.content.pm.PackageInfo;
1212
import android.content.pm.PackageManager.NameNotFoundException;
13-
import android.os.Build;
1413
import android.os.Handler;
1514
import android.util.Log;
1615

@@ -72,10 +71,7 @@ public void onCreate() {
7271
lastEventId = settings.getInt("lastEventId", -1);
7372
pointer = settings.getInt("pointer", -1);
7473

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()) {
7975
Crashlytics.start(this);
8076
}
8177

0 commit comments

Comments
 (0)