From de69605eff19bd9c8e5b4f4bedfe5765bee9d814 Mon Sep 17 00:00:00 2001 From: Tamim Hossain <132823494+CodeWithTamim@users.noreply.github.com> Date: Sun, 28 Jul 2024 07:27:58 +0600 Subject: [PATCH] Introduced version catalog for streamlined dependency management (#3377) This pull request integrates a version catalog (libs.versions.toml) to centralize dependency management within the project. By utilizing this approach, we enhance dependency consistency, reduce maintenance overhead, and facilitate version updates across multiple modules. This change provides a more organized and efficient way to manage project dependencies. --- V2rayNG/app/build.gradle.kts | 68 +++++++++---------- .../v2ray/ang/service/V2RayServiceManager.kt | 2 +- V2rayNG/build.gradle.kts | 4 +- V2rayNG/gradle/libs.versions.toml | 63 +++++++++++++++++ 4 files changed, 100 insertions(+), 37 deletions(-) create mode 100644 V2rayNG/gradle/libs.versions.toml diff --git a/V2rayNG/app/build.gradle.kts b/V2rayNG/app/build.gradle.kts index 8cff84c73..8cf6fa15a 100644 --- a/V2rayNG/app/build.gradle.kts +++ b/V2rayNG/app/build.gradle.kts @@ -96,44 +96,44 @@ android { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar","*.jar")))) - testImplementation("junit:junit:4.13.2") + testImplementation(libs.junit) - implementation("com.google.android.flexbox:flexbox:3.0.0") + implementation(libs.flexbox) // Androidx - implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.legacy:legacy-support-v4:1.0.0") - implementation("androidx.appcompat:appcompat:1.7.0") - implementation("com.google.android.material:material:1.12.0") - implementation("androidx.cardview:cardview:1.0.0") - implementation("androidx.preference:preference-ktx:1.2.1") - implementation("androidx.recyclerview:recyclerview:1.3.2") - implementation("androidx.fragment:fragment-ktx:1.8.1") - implementation("androidx.multidex:multidex:2.0.1") - implementation("androidx.viewpager2:viewpager2:1.1.0") + implementation(libs.constraintlayout) + implementation(libs.legacy.support.v4) + implementation(libs.appcompat) + implementation(libs.material) + implementation(libs.cardview) + implementation(libs.preference.ktx) + implementation(libs.recyclerview) + implementation(libs.fragment.ktx) + implementation(libs.multidex) + implementation(libs.viewpager2) // Androidx ktx - implementation("androidx.activity:activity-ktx:1.9.0") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.3") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.3") + implementation(libs.activity.ktx) + implementation(libs.lifecycle.viewmodel.ktx) + implementation(libs.lifecycle.livedata.ktx) + implementation(libs.lifecycle.runtime.ktx) //kotlin - implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.23") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1") - - implementation("com.tencent:mmkv-static:1.3.4") - implementation("com.google.code.gson:gson:2.11.0") - implementation("io.reactivex:rxjava:1.3.8") - implementation("io.reactivex:rxandroid:1.2.1") - implementation("com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar") - implementation("me.drakeet.support:toastcompat:1.1.0") - implementation("com.blacksquircle.ui:editorkit:2.9.0") - implementation("com.blacksquircle.ui:language-base:2.9.0") - implementation("com.blacksquircle.ui:language-json:2.9.0") - implementation("io.github.g00fy2.quickie:quickie-bundled:1.9.0") - implementation("com.google.zxing:core:3.5.3") - - implementation("androidx.work:work-runtime-ktx:2.8.1") - implementation("androidx.work:work-multiprocess:2.8.1") + implementation(libs.kotlin.reflect) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.android) + + implementation(libs.mmkv.static) + implementation(libs.gson) + implementation(libs.rxjava) + implementation(libs.rxandroid) + implementation(libs.rxpermissions) + implementation(libs.toastcompat) + implementation(libs.editorkit) + implementation(libs.language.base) + implementation(libs.language.json) + implementation(libs.quickie.bundled) + implementation(libs.core) + + implementation(libs.work.runtime.ktx) + implementation(libs.work.multiprocess) } \ No newline at end of file diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt index 0f605eadc..82cf11884 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayServiceManager.kt @@ -73,7 +73,7 @@ object V2RayServiceManager { } else { context.toast(R.string.toast_services_start) } - val intent = if (settingsStorage?.decodeString(AppConfig.PREF_MODE) ?: "VPN" == "VPN") { + val intent = if ((settingsStorage?.decodeString(AppConfig.PREF_MODE) ?: "VPN") == "VPN") { Intent(context.applicationContext, V2RayVpnService::class.java) } else { Intent(context.applicationContext, V2RayProxyOnlyService::class.java) diff --git a/V2rayNG/build.gradle.kts b/V2rayNG/build.gradle.kts index b45fb3494..a4a8ba477 100644 --- a/V2rayNG/build.gradle.kts +++ b/V2rayNG/build.gradle.kts @@ -1,6 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.application") version "8.2.2" apply false - id("com.android.library") version "8.2.2" apply false + id("com.android.application") version "8.5.0" apply false + id("com.android.library") version "8.5.0" apply false id("org.jetbrains.kotlin.android") version "1.9.23" apply false } diff --git a/V2rayNG/gradle/libs.versions.toml b/V2rayNG/gradle/libs.versions.toml new file mode 100644 index 000000000..ed0726693 --- /dev/null +++ b/V2rayNG/gradle/libs.versions.toml @@ -0,0 +1,63 @@ +[versions] +activityKtx = "1.9.1" +appcompat = "1.7.0" +cardview = "1.0.0" +constraintlayout = "2.1.4" +core = "3.5.3" +editorkit = "2.9.0" +flexbox = "3.0.0" +fragmentKtx = "1.8.2" +gson = "2.11.0" +junit = "4.13.2" +kotlinReflect = "1.9.23" +kotlinxCoroutinesCore = "1.8.1" +legacySupportV4 = "1.0.0" +lifecycleViewmodelKtx = "2.8.4" +material = "1.12.0" +mmkvStatic = "1.3.4" +multidex = "2.0.1" +preferenceKtx = "1.2.1" +quickieBundled = "1.9.0" +recyclerview = "1.3.2" +rxandroid = "1.2.1" +rxjava = "1.3.8" +rxpermissions = "0.9.4" +toastcompat = "1.1.0" +viewpager2 = "1.1.0" +workRuntimeKtx = "2.8.1" + +[libraries] +activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" } +appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } +cardview = { module = "androidx.cardview:cardview", version.ref = "cardview" } +constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" } +core = { module = "com.google.zxing:core", version.ref = "core" } +editorkit = { module = "com.blacksquircle.ui:editorkit", version.ref = "editorkit" } +flexbox = { module = "com.google.android.flexbox:flexbox", version.ref = "flexbox" } +fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" } +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +junit = { module = "junit:junit", version.ref = "junit" } +kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlinReflect" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesCore" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" } +language-base = { module = "com.blacksquircle.ui:language-base", version.ref = "editorkit" } +language-json = { module = "com.blacksquircle.ui:language-json", version.ref = "editorkit" } +legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacySupportV4" } +lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycleViewmodelKtx" } +lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleViewmodelKtx" } +lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" } +material = { module = "com.google.android.material:material", version.ref = "material" } +mmkv-static = { module = "com.tencent:mmkv-static", version.ref = "mmkvStatic" } +multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" } +quickie-bundled = { module = "io.github.g00fy2.quickie:quickie-bundled", version.ref = "quickieBundled" } +recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" } +preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" } +rxandroid = { module = "io.reactivex:rxandroid", version.ref = "rxandroid" } +rxjava = { module = "io.reactivex:rxjava", version.ref = "rxjava" } +rxpermissions = { module = "com.tbruyelle.rxpermissions:rxpermissions", version.ref = "rxpermissions" } +toastcompat = { module = "me.drakeet.support:toastcompat", version.ref = "toastcompat" } +viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2" } +work-multiprocess = { module = "androidx.work:work-multiprocess", version.ref = "workRuntimeKtx" } +work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntimeKtx" } + +[plugins] \ No newline at end of file