diff --git a/app/build.gradle b/app/build.gradle index 096c08f..449a3e3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "com.github.kr328.clash" minSdkVersion 24 targetSdkVersion 29 - versionCode 10013 - versionName "1.0.13-alpha" + versionCode 10014 + versionName "1.0.14-alpha" } buildTypes { release { diff --git a/app/src/main/java/com/github/kr328/clash/MainApplication.kt b/app/src/main/java/com/github/kr328/clash/MainApplication.kt index 7f2f7b6..c6c24bb 100644 --- a/app/src/main/java/com/github/kr328/clash/MainApplication.kt +++ b/app/src/main/java/com/github/kr328/clash/MainApplication.kt @@ -2,6 +2,7 @@ package com.github.kr328.clash import android.app.Application import android.content.Context +import com.crashlytics.android.Crashlytics import com.github.kr328.clash.core.Constants import com.github.kr328.clash.core.utils.Log import com.google.firebase.FirebaseApp @@ -37,21 +38,32 @@ class MainApplication : Application() { } override fun warn(message: String, throwable: Throwable?) { + throwable?.also { + Crashlytics.logException(it) + } + android.util.Log.w(Constants.TAG, message, throwable) } override fun error(message: String, throwable: Throwable?) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + throwable?.also { + Crashlytics.logException(it) + } + + android.util.Log.e(Constants.TAG, message, throwable) } override fun wtf(message: String, throwable: Throwable?) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + throwable?.also { + Crashlytics.logException(it) + } + + android.util.Log.wtf(Constants.TAG, message, throwable) } override fun debug(message: String, throwable: Throwable?) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + android.util.Log.d(Constants.TAG, message, throwable) } - } } } \ No newline at end of file diff --git a/core/src/main/java/com/github/kr328/clash/core/BaseClash.kt b/core/src/main/java/com/github/kr328/clash/core/BaseClash.kt index 6801770..104d3b4 100644 --- a/core/src/main/java/com/github/kr328/clash/core/BaseClash.kt +++ b/core/src/main/java/com/github/kr328/clash/core/BaseClash.kt @@ -46,18 +46,13 @@ abstract class BaseClash(private val controllerPath: File) { ): R? { return try { runControl(command, block) - } catch (e: Exception) { - Log.w("Run command $command failure", e) - null - } + } catch (ignored: Exception) { null } } protected fun runControlNoException(command: Int) { try { runControl(command) - } catch (e: Exception) { - Log.w("Run command $command failure", e) - } + } catch (ignored: Exception) {} } protected fun DataOutputStream.writeString(string: String) {