mirror of
https://github.com/openlibrecommunity/olcng.git
synced 2026-07-03 14:05:17 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fea86944f | |||
| ff2fea8c03 | |||
| 415f2230e6 | |||
| fb827c1fb1 |
@@ -138,7 +138,6 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
chmod 755 gradlew
|
||||
./gradlew licenseFdroidReleaseReport
|
||||
./gradlew assembleRelease --info 2>&1 | grep -i "signing\|keystore" || true
|
||||
|
||||
- name: Upload arm64-v8a APK
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
id("com.jaredsburrows.license")
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -18,8 +16,6 @@ android {
|
||||
|
||||
versionCode = envVersionCode?.toIntOrNull() ?: 717
|
||||
versionName = envVersionName ?: "2.0.17"
|
||||
|
||||
multiDexEnabled = true
|
||||
|
||||
val abiFilterList = (properties["ABI_FILTERS"] as? String)?.split(';')
|
||||
splits {
|
||||
@@ -90,7 +86,7 @@ android {
|
||||
|
||||
sourceSets {
|
||||
getByName("main") {
|
||||
jniLibs.srcDirs("libs")
|
||||
jniLibs.directories.add("libs")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,50 +102,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
applicationVariants.all {
|
||||
val variant = this
|
||||
val isFdroid = variant.productFlavors.any { it.name == "fdroid" }
|
||||
if (isFdroid) {
|
||||
val versionCodes =
|
||||
mapOf(
|
||||
"armeabi-v7a" to 2, "arm64-v8a" to 1, "x86" to 4, "x86_64" to 3, "universal" to 0
|
||||
)
|
||||
|
||||
variant.outputs
|
||||
.map { it as com.android.build.gradle.internal.api.ApkVariantOutputImpl }
|
||||
.forEach { output ->
|
||||
val abi = output.getFilter("ABI") ?: "universal"
|
||||
output.outputFileName = "v2rayNG_${variant.versionName}-fdroid_${abi}.apk"
|
||||
if (versionCodes.containsKey(abi)) {
|
||||
output.versionCodeOverride =
|
||||
(100 * variant.versionCode + versionCodes[abi]!!).plus(5000000)
|
||||
} else {
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val versionCodes =
|
||||
mapOf("armeabi-v7a" to 4, "arm64-v8a" to 4, "x86" to 4, "x86_64" to 4, "universal" to 4)
|
||||
|
||||
variant.outputs
|
||||
.map { it as com.android.build.gradle.internal.api.ApkVariantOutputImpl }
|
||||
.forEach { output ->
|
||||
val abi = if (output.getFilter("ABI") != null)
|
||||
output.getFilter("ABI")
|
||||
else
|
||||
"universal"
|
||||
|
||||
output.outputFileName = "v2rayNG_${variant.versionName}_${abi}.apk"
|
||||
if (versionCodes.containsKey(abi)) {
|
||||
output.versionCodeOverride =
|
||||
(1000000 * versionCodes[abi]!!).plus(variant.versionCode)
|
||||
} else {
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
buildConfig = true
|
||||
@@ -163,6 +115,28 @@ android {
|
||||
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants { variant ->
|
||||
val isFdroid = variant.productFlavors.any { it.second == "fdroid" }
|
||||
variant.outputs.forEach { output ->
|
||||
val abi = output.filters.find {
|
||||
it.filterType == com.android.build.api.variant.FilterConfiguration.FilterType.ABI
|
||||
}?.identifier ?: "universal"
|
||||
|
||||
if (isFdroid) {
|
||||
val versionCodes = mapOf(
|
||||
"armeabi-v7a" to 2, "arm64-v8a" to 1, "x86" to 4, "x86_64" to 3, "universal" to 0
|
||||
)
|
||||
versionCodes[abi]?.let { code ->
|
||||
output.versionCode.set((100 * (output.versionCode.get() ?: 0) + code) + 5000000)
|
||||
}
|
||||
} else {
|
||||
output.versionCode.set(1000000 * 4 + (output.versionCode.get() ?: 0))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Core Libraries
|
||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar", "*.jar"))))
|
||||
@@ -210,9 +184,6 @@ dependencies {
|
||||
implementation(libs.work.runtime.ktx)
|
||||
implementation(libs.work.multiprocess)
|
||||
|
||||
// Multidex Support
|
||||
implementation(libs.multidex)
|
||||
|
||||
// Testing Libraries
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package xyz.zarazaex.olc
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import androidx.multidex.MultiDexApplication
|
||||
import androidx.work.Configuration
|
||||
import androidx.work.WorkManager
|
||||
import com.google.android.material.color.DynamicColors
|
||||
@@ -9,7 +9,7 @@ import com.tencent.mmkv.MMKV
|
||||
import xyz.zarazaex.olc.AppConfig.ANG_PACKAGE
|
||||
import xyz.zarazaex.olc.handler.SettingsManager
|
||||
|
||||
class AngApplication : MultiDexApplication() {
|
||||
class AngApplication : Application() {
|
||||
companion object {
|
||||
lateinit var application: AngApplication
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.asCoroutineDispatcher
|
||||
import kotlinx.coroutines.joinAll
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withTimeout
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
@@ -75,13 +76,51 @@ class RealPingWorkerService(
|
||||
}
|
||||
}
|
||||
|
||||
private fun startRealPing(guid: String): Long {
|
||||
private suspend fun startRealPing(guid: String): Long {
|
||||
val retFailure = -1L
|
||||
val configResult = V2rayConfigManager.getV2rayConfig4Speedtest(context, guid)
|
||||
if (!configResult.status) {
|
||||
return retFailure
|
||||
}
|
||||
return V2RayNativeManager.measureOutboundDelay(configResult.content, SettingsManager.getDelayTestUrl())
|
||||
|
||||
var bestDelay = retFailure
|
||||
|
||||
for (attempt in 0 until 2) {
|
||||
try {
|
||||
val delay = withTimeout(10000L) {
|
||||
V2RayNativeManager.measureOutboundDelay(
|
||||
configResult.content,
|
||||
SettingsManager.getDelayTestUrl()
|
||||
)
|
||||
}
|
||||
|
||||
if (delay > 0 && (bestDelay == retFailure || delay < bestDelay)) {
|
||||
bestDelay = delay
|
||||
}
|
||||
|
||||
if (bestDelay > 0) {
|
||||
break
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
if (attempt == 0) {
|
||||
try {
|
||||
val delay = withTimeout(10000L) {
|
||||
V2RayNativeManager.measureOutboundDelay(
|
||||
configResult.content,
|
||||
SettingsManager.getDelayTestUrl(true)
|
||||
)
|
||||
}
|
||||
|
||||
if (delay > 0 && (bestDelay == retFailure || delay < bestDelay)) {
|
||||
bestDelay = delay
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bestDelay
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -417,4 +417,5 @@
|
||||
<item>WebDAV</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_updating">جارٍ التحديث…</string>
|
||||
</resources>
|
||||
|
||||
@@ -423,4 +423,5 @@
|
||||
<item>WebDAV</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_updating">আপডেট হচ্ছে…</string>
|
||||
</resources>
|
||||
@@ -433,4 +433,5 @@
|
||||
<item>WebDAV</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_updating">در حال بهروزرسانی…</string>
|
||||
</resources>
|
||||
|
||||
@@ -432,4 +432,5 @@
|
||||
<item>WebDAV</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_updating">در حال بهروزرسانی…</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="color_fab_active">@android:color/system_accent1_400</color>
|
||||
<color name="color_fab_active">#90CAF9</color>
|
||||
<color name="color_fab_inactive">#646464</color>
|
||||
<color name="divider_color_light">#424242</color>
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
<color name="md_theme_primaryContainer">#474747</color>
|
||||
<color name="md_theme_onPrimaryContainer">#E0E0E0</color>
|
||||
|
||||
<color name="md_theme_secondary">@android:color/system_accent1_400</color>
|
||||
<color name="md_theme_secondary">#90CAF9</color>
|
||||
<color name="md_theme_onSecondary">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryContainer">#6F3800</color>
|
||||
<color name="md_theme_onSecondaryContainer">#FFE8D6</color>
|
||||
|
||||
<color name="md_theme_tertiary">@android:color/system_accent1_300</color>
|
||||
<color name="md_theme_tertiary">#64B5F6</color>
|
||||
<color name="md_theme_onTertiary">#00382E</color>
|
||||
<color name="md_theme_tertiaryContainer">#005143</color>
|
||||
<color name="md_theme_onTertiaryContainer">@android:color/system_accent1_200</color>
|
||||
<color name="md_theme_onTertiaryContainer">#BBDEFB</color>
|
||||
|
||||
<!-- Error colors -->
|
||||
<color name="md_theme_error">#FFB4AB</color>
|
||||
|
||||
@@ -419,4 +419,5 @@
|
||||
<item>WebDAV</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_updating">Đang cập nhật…</string>
|
||||
</resources>
|
||||
|
||||
@@ -425,4 +425,5 @@
|
||||
<item>WebDAV</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_updating">更新中…</string>
|
||||
</resources>
|
||||
|
||||
@@ -425,4 +425,5 @@
|
||||
<item>WebDAV</item>
|
||||
</string-array>
|
||||
|
||||
<string name="title_updating">更新中…</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPing">@android:color/system_accent1_600</color>
|
||||
<color name="colorPing">#1565C0</color>
|
||||
<color name="colorPingRed">#FF0099</color>
|
||||
<color name="colorConfigType">@android:color/system_accent1_400</color>
|
||||
<color name="colorConfigType">#1976D2</color>
|
||||
<color name="colorWhite">#FFFFFF</color>
|
||||
<color name="color_fab_active">@android:color/system_accent1_400</color>
|
||||
<color name="color_fab_active">#1976D2</color>
|
||||
<color name="color_fab_inactive">#9C9C9C</color>
|
||||
<color name="divider_color_light">#E0E0E0</color>
|
||||
<color name="colorIndicator">@color/md_theme_primary</color>
|
||||
@@ -14,14 +14,14 @@
|
||||
<color name="md_theme_primaryContainer">#E0E0E0</color>
|
||||
<color name="md_theme_onPrimaryContainer">#000000</color>
|
||||
|
||||
<color name="md_theme_secondary">@android:color/system_accent1_400</color>
|
||||
<color name="md_theme_secondary">#1976D2</color>
|
||||
<color name="md_theme_onSecondary">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryContainer">#FFE8D6</color>
|
||||
<color name="md_theme_onSecondaryContainer">#2B1700</color>
|
||||
|
||||
<color name="md_theme_tertiary">@android:color/system_accent1_600</color>
|
||||
<color name="md_theme_tertiary">#1565C0</color>
|
||||
<color name="md_theme_onTertiary">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryContainer">@android:color/system_accent1_200</color>
|
||||
<color name="md_theme_tertiaryContainer">#BBDEFB</color>
|
||||
<color name="md_theme_onTertiaryContainer">#00201A</color>
|
||||
|
||||
<!-- Error colors -->
|
||||
|
||||
@@ -2,12 +2,4 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
alias(libs.plugins.android.library) apply false
|
||||
alias(libs.plugins.kotlin.android) apply false
|
||||
}
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath(libs.gradle.license.plugin)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,20 +15,7 @@ org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
kotlin.incremental=true
|
||||
android.defaults.buildfeatures.resvalues=true
|
||||
android.sdk.defaultTargetSdkToCompileSdkIfUnset=false
|
||||
android.enableAppCompileTimeRClass=false
|
||||
android.usesSdkInManifest.disallowed=false
|
||||
android.uniquePackageNames=false
|
||||
android.dependency.useConstraints=true
|
||||
android.r8.strictFullModeForKeepRules=false
|
||||
android.r8.optimizedResourceShrinking=false
|
||||
android.builtInKotlin=false
|
||||
android.newDsl=false
|
||||
android.generateSyncIssueWhenLibraryConstraintsAreEnabled=false
|
||||
Reference in New Issue
Block a user