Replace firebase crashlytics with acra

This commit is contained in:
世界 2020-12-24 22:22:07 +08:00
parent 6580fcbd1f
commit 19034c0b8e
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
3 changed files with 21 additions and 9 deletions

View File

@ -39,8 +39,8 @@ configurations {
def okHttpVersion = '4.9.0'
def fcmVersion = '21.0.1'
def crashlyticsVersion = '17.3.0'
def playCoreVersion = '1.9.0'
def acraVersion = '5.7.0'
repositories {
@ -93,16 +93,17 @@ dependencies {
compileOnly files('libs/libv2ray.aar')
compileOnly "com.google.firebase:firebase-messaging:$fcmVersion"
compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
compileOnly "com.google.android.play:core:$playCoreVersion"
debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
debugImplementation "com.google.android.play:core:$playCoreVersion"
releaseImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
releaseImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
releaseImplementation "com.google.android.play:core:$playCoreVersion"
implementation "ch.acra:acra-mail:$acraVersion"
implementation "ch.acra:acra-notification:$acraVersion"
implementation "ch.acra:acra-limiter:$acraVersion"
testImplementation 'junit:junit:4.13.1'
testImplementation 'androidx.test:core:1.3.0'
testImplementation "org.robolectric:robolectric:4.4"

View File

@ -32,6 +32,10 @@ import android.util.Log;
import androidx.core.app.NotificationManagerCompat;
import androidx.multidex.MultiDex;
import org.acra.ACRA;
import org.acra.annotation.AcraCore;
import org.acra.annotation.AcraMailSender;
import org.acra.annotation.AcraNotification;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.Components.ForegroundDetector;
@ -51,6 +55,14 @@ import tw.nekomimi.nekogram.utils.UIUtil;
import static android.os.Build.VERSION.SDK_INT;
@AcraCore(buildConfigClass = BuildConfig.class)
@AcraMailSender(mailTo = "nekohashizuku@gmail.com")
@AcraNotification(
resIcon = R.drawable.notification,
resTitle = R.string.NekoX,
resText = R.string.AcraText,
resChannelName = R.string.AcraChannel
)
public class ApplicationLoader extends Application {
@SuppressLint("StaticFieldLeak")
@ -74,11 +86,6 @@ public class ApplicationLoader extends Application {
public static boolean hasPlayServices;
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
return new WarppedPref(super.getSharedPreferences(name, mode));
}
@Override
protected void attachBaseContext(Context base) {
if (SDK_INT >= Build.VERSION_CODES.P) {
@ -88,6 +95,7 @@ public class ApplicationLoader extends Application {
if (SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
MultiDex.install(this);
}
ACRA.init(this);
}
/**

View File

@ -268,4 +268,7 @@
<string name="CCSP">Simplified Chinese (China)</string>
<string name="CCJP">New Japanese Kanji (Shinjitai)</string>
<string name="AcraText">Sorrt, this applacation crashed. Please send a report to the developers</string>
<string name="AcraChannel"></string>
</resources>