Chore: update dependencies & remove appcenter tracker

This commit is contained in:
Kr328
2022-07-01 12:07:23 +08:00
parent c18d78db85
commit c3bab32b83
11 changed files with 18 additions and 92 deletions

3
.github/FUNDING.yml vendored
View File

@@ -1,3 +0,0 @@
# These are supported funding model platforms
github: [Kr328]

View File

@@ -20,11 +20,6 @@ dependencies {
implementation(libs.androidx.coordinator) implementation(libs.androidx.coordinator)
implementation(libs.androidx.recyclerview) implementation(libs.androidx.recyclerview)
implementation(libs.google.material) implementation(libs.google.material)
val premiumImplementation by configurations
premiumImplementation(libs.appcenter.analytics)
premiumImplementation(libs.appcenter.crashes)
} }
tasks.getByName("clean", type = Delete::class) { tasks.getByName("clean", type = Delete::class) {

View File

@@ -1,14 +0,0 @@
package com.github.kr328.clash
import android.app.Application
@Suppress("UNUSED_PARAMETER")
object Tracker {
fun initialize(application: Application) {
// do nothing
}
fun uploadLogcat(logcat: String) {
// do nothing
}
}

View File

@@ -116,7 +116,7 @@ class FilesActivity : BaseActivity<FilesDesign>() {
} }
is FilesDesign.Request.ExportFile -> { is FilesDesign.Request.ExportFile -> {
val uri: Uri? = startActivityForResult( val uri: Uri? = startActivityForResult(
ActivityResultContracts.CreateDocument(), ActivityResultContracts.CreateDocument("text/plain"),
it.file.name it.file.name
) )

View File

@@ -67,7 +67,7 @@ class LogcatActivity : BaseActivity<LogcatDesign>() {
} }
LogcatDesign.Request.Export -> { LogcatDesign.Request.Export -> {
val output = startActivityForResult( val output = startActivityForResult(
ActivityResultContracts.CreateDocument(), ActivityResultContracts.CreateDocument("text/plain"),
file.fileName file.fileName
) )

View File

@@ -19,9 +19,6 @@ class MainApplication : Application() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
// Initialize AppCenter
Tracker.initialize(this)
val processName = currentProcessName val processName = currentProcessName
Log.d("Process $processName started") Log.d("Process $processName started")

View File

@@ -5,10 +5,8 @@ import android.content.ComponentName
import android.content.Context import android.content.Context
import android.content.ServiceConnection import android.content.ServiceConnection
import android.os.IBinder import android.os.IBinder
import com.github.kr328.clash.Tracker
import com.github.kr328.clash.common.log.Log import com.github.kr328.clash.common.log.Log
import com.github.kr328.clash.common.util.intent import com.github.kr328.clash.common.util.intent
import com.github.kr328.clash.log.SystemLogcat
import com.github.kr328.clash.service.RemoteService import com.github.kr328.clash.service.RemoteService
import com.github.kr328.clash.service.remote.IRemoteService import com.github.kr328.clash.service.remote.IRemoteService
import com.github.kr328.clash.service.remote.unwrap import com.github.kr328.clash.service.remote.unwrap
@@ -28,8 +26,6 @@ class Service(private val context: Application, val crashed: () -> Unit) {
override fun onServiceDisconnected(name: ComponentName?) { override fun onServiceDisconnected(name: ComponentName?) {
remote.set(null) remote.set(null)
Tracker.uploadLogcat(SystemLogcat.dumpCrash())
if (System.currentTimeMillis() - lastCrashed < TOGGLE_CRASHED_INTERVAL) { if (System.currentTimeMillis() - lastCrashed < TOGGLE_CRASHED_INTERVAL) {
unbind() unbind()

View File

@@ -1,31 +0,0 @@
package com.github.kr328.clash
import android.app.Application
import com.microsoft.appcenter.AppCenter
import com.microsoft.appcenter.analytics.Analytics
import com.microsoft.appcenter.crashes.Crashes
import com.microsoft.appcenter.crashes.ingestion.models.ErrorAttachmentLog
object Tracker {
fun initialize(application: Application) {
if (!BuildConfig.DEBUG) {
AppCenter.start(
application,
BuildConfig.APP_CENTER_KEY,
Analytics::class.java, Crashes::class.java
)
}
}
fun uploadLogcat(logcat: String) {
if (!BuildConfig.DEBUG) {
if (logcat.isNotBlank()) {
Crashes.trackError(
RuntimeException(),
mapOf("type" to "app_crashed"),
listOf(ErrorAttachmentLog.attachmentWithText(logcat, "logcat.txt"))
)
}
}
}
}

View File

@@ -65,7 +65,9 @@ subprojects {
if (isApp) { if (isApp) {
packagingOptions { packagingOptions {
excludes.add("DebugProbesKt.bin") resources {
excludes.add("DebugProbesKt.bin")
}
} }
} }
@@ -88,19 +90,6 @@ subprojects {
versionNameSuffix = ".premium" versionNameSuffix = ".premium"
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"true\")") buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"true\")")
val tracker = rootProject.file("tracker.properties")
if (tracker.exists()) {
val prop = Properties().apply {
tracker.inputStream().use(this::load)
}
buildConfigField(
"String",
"APP_CENTER_KEY",
"\"${prop.getProperty("appcenter.key")!!}\""
)
}
} }
} }

View File

@@ -1,6 +1,5 @@
plugins { plugins {
kotlin("android") kotlin("android")
kotlin("kapt")
id("kotlinx-serialization") id("kotlinx-serialization")
id("com.android.library") id("com.android.library")
id("com.google.devtools.ksp") id("com.google.devtools.ksp")
@@ -11,7 +10,7 @@ dependencies {
implementation(project(":common")) implementation(project(":common"))
ksp(libs.kaidl.compiler) ksp(libs.kaidl.compiler)
kapt(libs.androidx.room.compiler) ksp(libs.androidx.room.compiler)
implementation(libs.kotlin.coroutine) implementation(libs.kotlin.coroutine)
implementation(libs.kotlin.serialization.json) implementation(libs.kotlin.serialization.json)
@@ -25,7 +24,8 @@ dependencies {
afterEvaluate { afterEvaluate {
android { android {
libraryVariants.forEach { libraryVariants.forEach {
sourceSets[it.name].java.srcDir(buildDir.resolve("generated/ksp/${it.name}/kotlin")) sourceSets[it.name].kotlin.srcDir(buildDir.resolve("generated/ksp/${it.name}/kotlin"))
sourceSets[it.name].java.srcDir(buildDir.resolve("generated/ksp/${it.name}/java"))
} }
} }
} }

View File

@@ -18,21 +18,20 @@ pluginManagement {
dependencyResolutionManagement { dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
create("libs") { create("libs") {
val agp = "7.2.0" val agp = "7.2.1"
val kotlin = "1.6.21" val kotlin = "1.7.0"
val ksp = "$kotlin-1.0.5" val ksp = "$kotlin-1.0.6"
val golang = "1.0.4" val golang = "1.0.4"
val coroutine = "1.6.1" val coroutine = "1.6.3"
val coreKtx = "1.7.0" val coreKtx = "1.8.0"
val activity = "1.4.0" val activity = "1.5.0"
val fragment = "1.4.1" val fragment = "1.5.0"
val appcompat = "1.4.1" val appcompat = "1.4.2"
val coordinator = "1.2.0" val coordinator = "1.2.0"
val recyclerview = "1.2.1" val recyclerview = "1.2.1"
val viewpager = "1.0.0" val viewpager = "1.0.0"
val material = "1.6.0" val material = "1.6.1"
val appcenter = "4.4.3" val serialization = "1.3.3"
val serialization = "1.3.2"
val kaidl = "1.15" val kaidl = "1.15"
val room = "2.4.2" val room = "2.4.2"
val multiprocess = "1.0.0" val multiprocess = "1.0.0"
@@ -55,8 +54,6 @@ dependencyResolutionManagement {
library("androidx-room-runtime", "androidx.room:room-runtime:$room") library("androidx-room-runtime", "androidx.room:room-runtime:$room")
library("androidx-room-ktx", "androidx.room:room-ktx:$room") library("androidx-room-ktx", "androidx.room:room-ktx:$room")
library("google-material", "com.google.android.material:material:$material") library("google-material", "com.google.android.material:material:$material")
library("appcenter-analytics", "com.microsoft.appcenter:appcenter-analytics:$appcenter")
library("appcenter-crashes", "com.microsoft.appcenter:appcenter-crashes:$appcenter")
library("kaidl-compiler", "com.github.kr328.kaidl:kaidl:$kaidl") library("kaidl-compiler", "com.github.kr328.kaidl:kaidl:$kaidl")
library("kaidl-runtime", "com.github.kr328.kaidl:kaidl-runtime:$kaidl") library("kaidl-runtime", "com.github.kr328.kaidl:kaidl-runtime:$kaidl")
library("rikkax-multiprocess", "dev.rikka.rikkax.preference:multiprocess:$multiprocess") library("rikkax-multiprocess", "dev.rikka.rikkax.preference:multiprocess:$multiprocess")