Merge branch 'main' of https://github.com/HapeLee/legado-with-MD3
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
name: Build APK for User
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: '要构建的分支'
|
||||
required: true
|
||||
default: 'trae/solo-agent-vhkVM3'
|
||||
release_tag:
|
||||
description: 'Release 标签 (留空则不上传到 Release)'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Clear 18PlusList.txt
|
||||
run: |
|
||||
echo "清空18PlusList.txt"
|
||||
echo "" > $GITHUB_WORKSPACE/app/src/main/assets/18PlusList.txt
|
||||
|
||||
- name: Build Debug APK
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew assembleAppDebug --no-daemon
|
||||
env:
|
||||
COMMIT_NUMBER: ${{ github.run_number }}
|
||||
APP_VERSION_NAME: debug-${{ github.run_number }}
|
||||
|
||||
- name: Check Build Output
|
||||
run: |
|
||||
APK_PATH="$GITHUB_WORKSPACE/app/build/outputs/apk/app/debug"
|
||||
echo "检查 APK 输出目录: $APK_PATH"
|
||||
ls -la "$APK_PATH" || true
|
||||
if [ -z "$(find "$APK_PATH" -name "*.apk" -print -quit)" ]; then
|
||||
echo "未找到 APK 文件!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Rename APK Files
|
||||
run: |
|
||||
APK_PATH="$GITHUB_WORKSPACE/app/build/outputs/apk/app/debug"
|
||||
cd "$APK_PATH"
|
||||
for f in *.apk; do
|
||||
mv "$f" "legado-debug-${GITHUB_RUN_NUMBER}-${f}"
|
||||
done
|
||||
ls -la
|
||||
|
||||
- name: Create ZIP Archive
|
||||
run: |
|
||||
APK_PATH="$GITHUB_WORKSPACE/app/build/outputs/apk/app/debug"
|
||||
ZIP_NAME="legado-debug-apks-${GITHUB_RUN_NUMBER}.zip"
|
||||
cd "$APK_PATH"
|
||||
zip "$GITHUB_WORKSPACE/$ZIP_NAME" *.apk
|
||||
echo "ZIP 文件已创建: $ZIP_NAME"
|
||||
ls -la "$GITHUB_WORKSPACE/$ZIP_NAME"
|
||||
|
||||
- name: Upload APK Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: legado-apks-${{ github.run_number }}
|
||||
path: app/build/outputs/apk/app/debug/*.apk
|
||||
|
||||
- name: Upload ZIP Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: legado-apks-zip-${{ github.run_number }}
|
||||
path: legado-debug-apks-*.zip
|
||||
|
||||
- name: Create Release and Upload
|
||||
if: ${{ github.event.inputs.release_tag != '' }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.release_tag }}
|
||||
name: Legado Debug Build ${{ github.event.inputs.release_tag }}
|
||||
body: |
|
||||
自动构建的 Debug 版本
|
||||
- 分支: ${{ github.event.inputs.branch }}
|
||||
- 构建号: ${{ github.run_number }}
|
||||
prerelease: true
|
||||
files: |
|
||||
app/build/outputs/apk/app/debug/*.apk
|
||||
legado-debug-apks-*.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -17,6 +17,7 @@ import io.legado.app.utils.putPrefFloat
|
||||
import io.legado.app.utils.putPrefInt
|
||||
import io.legado.app.utils.putPrefLong
|
||||
import io.legado.app.utils.putPrefString
|
||||
import io.legado.app.utils.putPrefStringSync
|
||||
import splitties.init.appCtx
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
@@ -34,6 +35,7 @@ fun <T> prefDelegate(
|
||||
key: String,
|
||||
defaultValue: T,
|
||||
lifecycleOwner: LifecycleOwner? = null,
|
||||
sync: Boolean = false,
|
||||
onValueChange: ((T) -> Unit)? = null
|
||||
): PrefDelegate<T> {
|
||||
return object : PrefDelegate<T>, SharedPreferences.OnSharedPreferenceChangeListener, DefaultLifecycleObserver {
|
||||
@@ -84,7 +86,7 @@ fun <T> prefDelegate(
|
||||
override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
|
||||
if (_value.value != value) {
|
||||
when (value) {
|
||||
is String? -> appCtx.putPrefString(key, value)
|
||||
is String? -> if (sync) appCtx.putPrefStringSync(key, value) else appCtx.putPrefString(key, value)
|
||||
is Int -> appCtx.putPrefInt(key, value)
|
||||
is Boolean -> appCtx.putPrefBoolean(key, value)
|
||||
is Long -> appCtx.putPrefLong(key, value)
|
||||
@@ -111,8 +113,9 @@ fun <T> prefStateDelegate(
|
||||
key: String,
|
||||
defaultValue: T,
|
||||
lifecycleOwner: LifecycleOwner? = null,
|
||||
sync: Boolean = false,
|
||||
onValueChange: ((T) -> Unit)? = null
|
||||
): PrefStateDelegate<T> {
|
||||
val delegate = prefDelegate(key, defaultValue, lifecycleOwner, onValueChange)
|
||||
val delegate = prefDelegate(key, defaultValue, lifecycleOwner, sync, onValueChange)
|
||||
return PrefStateDelegate(delegate)
|
||||
}
|
||||
@@ -624,10 +624,8 @@ fun BackupConfigScreen(
|
||||
|
||||
AppAlertDialog(
|
||||
show = showLoadingDialog,
|
||||
onDismiss = {},
|
||||
onConfirm = {},
|
||||
title = loadingText,
|
||||
onDismissRequest = { showLoadingDialog = false }
|
||||
onDismissRequest = { showLoadingDialog = false },
|
||||
title = loadingText
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ object OtherConfig {
|
||||
|
||||
var language by prefDelegate(
|
||||
PreferKey.language,
|
||||
"auto"
|
||||
"auto",
|
||||
sync = true
|
||||
)
|
||||
|
||||
var updateToVariant by prefDelegate(
|
||||
|
||||
@@ -223,6 +223,9 @@ fun Context.getPrefString(key: String, defValue: String? = null) =
|
||||
fun Context.putPrefString(key: String, value: String?) =
|
||||
defaultSharedPreferences.edit { putString(key, value) }
|
||||
|
||||
fun Context.putPrefStringSync(key: String, value: String?) =
|
||||
defaultSharedPreferences.edit(commit = true) { putString(key, value) }
|
||||
|
||||
fun Context.getPrefStringSet(
|
||||
key: String,
|
||||
defValue: MutableSet<String>? = null,
|
||||
|
||||
+3
-1
@@ -46,4 +46,6 @@ android.dependency.useConstraints=true
|
||||
android.generateSyncIssueWhenLibraryConstraintsAreEnabled=false
|
||||
android.r8.strictFullModeForKeepRules=false
|
||||
org.gradle.configuration-cache=true
|
||||
android.newDsl=false
|
||||
android.newDsl=false
|
||||
org.gradle.java.installations.auto-detect=true
|
||||
org.gradle.java.installations.auto-download=false
|
||||
@@ -1,13 +1,2 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/56a19bc915b9ba2eb62ba7554c61b919/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/398ffe3949748bfb1d5636f023d228fd/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/56a19bc915b9ba2eb62ba7554c61b919/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/398ffe3949748bfb1d5636f023d228fd/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e99bae143b75f9a10ead10248f02055e/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/04e088f8677de3b384108493cc9481d0/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/56a19bc915b9ba2eb62ba7554c61b919/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/398ffe3949748bfb1d5636f023d228fd/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e55dccbfe27cb97945148c61a39c89c5/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/dbd05c4936d573642f94cd149e1356c8/redirect
|
||||
toolchainVendor=JETBRAINS
|
||||
toolchainVersion=21
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip
|
||||
networkTimeout=10000
|
||||
networkTimeout=300000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
+4
-18
@@ -7,25 +7,15 @@ pluginManagement {
|
||||
includeGroupByRegex("androidx.*")
|
||||
}
|
||||
}
|
||||
//原仓库
|
||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
//镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改
|
||||
//maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" }
|
||||
//maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
//maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
//maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
//maven { url 'https://repo.huaweicloud.com/repository/maven/' }
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
//原仓库
|
||||
google {
|
||||
content {
|
||||
includeGroupByRegex("com\\.android.*")
|
||||
@@ -33,6 +23,8 @@ dependencyResolutionManagement {
|
||||
includeGroupByRegex("androidx.*")
|
||||
}
|
||||
}
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
content {
|
||||
@@ -40,12 +32,6 @@ dependencyResolutionManagement {
|
||||
}
|
||||
}
|
||||
mavenCentral()
|
||||
|
||||
//镜像仓库,无法连接源仓库自行启用镜像仓库,不要提交修改
|
||||
//maven { url "https://maven-central-asia.storage-download.googleapis.com/maven2/" }
|
||||
//maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
//maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
//maven { url 'https://repo.huaweicloud.com/repository/maven/' }
|
||||
}
|
||||
}
|
||||
rootProject.name = 'legado'
|
||||
|
||||
Reference in New Issue
Block a user