mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-07-15 01:05:27 +08:00
Compare commits
1 Commits
compose/bu
...
ci/update-
Author | SHA1 | Date | |
---|---|---|---|
0de45e2d79 |
2
.github/workflows/build_pull_request.yml
vendored
2
.github/workflows/build_pull_request.yml
vendored
@ -13,8 +13,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: burrunan/gradle-cache-action@v1
|
uses: burrunan/gradle-cache-action@v1
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -18,8 +18,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
|
@ -12,7 +12,7 @@ interface PatchBundleDao {
|
|||||||
fun getPropsById(uid: Int): Flow<BundleProperties?>
|
fun getPropsById(uid: Int): Flow<BundleProperties?>
|
||||||
|
|
||||||
@Query("UPDATE patch_bundles SET version = :patches WHERE uid = :uid")
|
@Query("UPDATE patch_bundles SET version = :patches WHERE uid = :uid")
|
||||||
suspend fun updateVersionHash(uid: Int, patches: String?)
|
suspend fun updateVersion(uid: Int, patches: String?)
|
||||||
|
|
||||||
@Query("UPDATE patch_bundles SET auto_update = :value WHERE uid = :uid")
|
@Query("UPDATE patch_bundles SET auto_update = :value WHERE uid = :uid")
|
||||||
suspend fun setAutoUpdate(uid: Int, value: Boolean)
|
suspend fun setAutoUpdate(uid: Int, value: Boolean)
|
||||||
@ -26,7 +26,7 @@ interface PatchBundleDao {
|
|||||||
@Transaction
|
@Transaction
|
||||||
suspend fun reset() {
|
suspend fun reset() {
|
||||||
purgeCustomBundles()
|
purgeCustomBundles()
|
||||||
updateVersionHash(0, null) // Reset the main source
|
updateVersion(0, null) // Reset the main source
|
||||||
}
|
}
|
||||||
|
|
||||||
@Query("DELETE FROM patch_bundles WHERE uid = :uid")
|
@Query("DELETE FROM patch_bundles WHERE uid = :uid")
|
||||||
|
@ -33,12 +33,12 @@ sealed class Source {
|
|||||||
data class PatchBundleEntity(
|
data class PatchBundleEntity(
|
||||||
@PrimaryKey val uid: Int,
|
@PrimaryKey val uid: Int,
|
||||||
@ColumnInfo(name = "name") val name: String,
|
@ColumnInfo(name = "name") val name: String,
|
||||||
@ColumnInfo(name = "version") val versionHash: String? = null,
|
@ColumnInfo(name = "version") val version: String? = null,
|
||||||
@ColumnInfo(name = "source") val source: Source,
|
@ColumnInfo(name = "source") val source: Source,
|
||||||
@ColumnInfo(name = "auto_update") val autoUpdate: Boolean
|
@ColumnInfo(name = "auto_update") val autoUpdate: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
data class BundleProperties(
|
data class BundleProperties(
|
||||||
@ColumnInfo(name = "version") val versionHash: String? = null,
|
@ColumnInfo(name = "version") val version: String? = null,
|
||||||
@ColumnInfo(name = "auto_update") val autoUpdate: Boolean
|
@ColumnInfo(name = "auto_update") val autoUpdate: Boolean
|
||||||
)
|
)
|
@ -15,7 +15,7 @@ class LocalPatchBundle(name: String, id: Int, directory: File) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
reload()?.also {
|
reload()?.also {
|
||||||
saveVersionHash(it.readManifestAttribute("Version"))
|
saveVersion(it.readManifestAttribute("Version"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,6 @@ sealed class PatchBundleSource(initialName: String, val uid: Int, directory: Fil
|
|||||||
|
|
||||||
suspend fun getName() = nameFlow.first()
|
suspend fun getName() = nameFlow.first()
|
||||||
|
|
||||||
val versionFlow = state.map { it.patchBundleOrNull()?.readManifestAttribute("Version") }
|
|
||||||
val patchCountFlow = state.map { it.patchBundleOrNull()?.patches?.size ?: 0 }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the bundle has been downloaded to local storage.
|
* Returns true if the bundle has been downloaded to local storage.
|
||||||
*/
|
*/
|
||||||
@ -87,9 +84,9 @@ sealed class PatchBundleSource(initialName: String, val uid: Int, directory: Fil
|
|||||||
fun propsFlow() = configRepository.getProps(uid).flowOn(Dispatchers.Default)
|
fun propsFlow() = configRepository.getProps(uid).flowOn(Dispatchers.Default)
|
||||||
suspend fun getProps() = propsFlow().first()!!
|
suspend fun getProps() = propsFlow().first()!!
|
||||||
|
|
||||||
suspend fun currentVersionHash() = getProps().versionHash
|
suspend fun currentVersion() = getProps().version
|
||||||
protected suspend fun saveVersionHash(version: String?) =
|
protected suspend fun saveVersion(version: String?) =
|
||||||
configRepository.updateVersionHash(uid, version)
|
configRepository.updateVersion(uid, version)
|
||||||
|
|
||||||
suspend fun setName(name: String) {
|
suspend fun setName(name: String) {
|
||||||
configRepository.setName(uid, name)
|
configRepository.setName(uid, name)
|
||||||
|
@ -25,7 +25,7 @@ sealed class RemotePatchBundle(name: String, id: Int, directory: File, val endpo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveVersionHash(info.version)
|
saveVersion(info.version)
|
||||||
reload()
|
reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ sealed class RemotePatchBundle(name: String, id: Int, directory: File, val endpo
|
|||||||
|
|
||||||
suspend fun update(): Boolean = withContext(Dispatchers.IO) {
|
suspend fun update(): Boolean = withContext(Dispatchers.IO) {
|
||||||
val info = getLatestInfo()
|
val info = getLatestInfo()
|
||||||
if (hasInstalled() && info.version == currentVersionHash())
|
if (hasInstalled() && info.version == currentVersion())
|
||||||
return@withContext false
|
return@withContext false
|
||||||
|
|
||||||
download(info)
|
download(info)
|
||||||
|
@ -25,7 +25,7 @@ class PatchBundlePersistenceRepository(db: AppDatabase) {
|
|||||||
PatchBundleEntity(
|
PatchBundleEntity(
|
||||||
uid = generateUid(),
|
uid = generateUid(),
|
||||||
name = name,
|
name = name,
|
||||||
versionHash = null,
|
version = null,
|
||||||
source = source,
|
source = source,
|
||||||
autoUpdate = autoUpdate
|
autoUpdate = autoUpdate
|
||||||
).also {
|
).also {
|
||||||
@ -34,11 +34,8 @@ class PatchBundlePersistenceRepository(db: AppDatabase) {
|
|||||||
|
|
||||||
suspend fun delete(uid: Int) = dao.remove(uid)
|
suspend fun delete(uid: Int) = dao.remove(uid)
|
||||||
|
|
||||||
/**
|
suspend fun updateVersion(uid: Int, version: String?) =
|
||||||
* Sets the version hash used for updates.
|
dao.updateVersion(uid, version)
|
||||||
*/
|
|
||||||
suspend fun updateVersionHash(uid: Int, versionHash: String?) =
|
|
||||||
dao.updateVersionHash(uid, versionHash)
|
|
||||||
|
|
||||||
suspend fun setAutoUpdate(uid: Int, value: Boolean) = dao.setAutoUpdate(uid, value)
|
suspend fun setAutoUpdate(uid: Int, value: Boolean) = dao.setAutoUpdate(uid, value)
|
||||||
|
|
||||||
@ -50,7 +47,7 @@ class PatchBundlePersistenceRepository(db: AppDatabase) {
|
|||||||
val defaultSource = PatchBundleEntity(
|
val defaultSource = PatchBundleEntity(
|
||||||
uid = 0,
|
uid = 0,
|
||||||
name = "",
|
name = "",
|
||||||
versionHash = null,
|
version = null,
|
||||||
source = Source.API,
|
source = Source.API,
|
||||||
autoUpdate = false
|
autoUpdate = false
|
||||||
)
|
)
|
||||||
|
@ -42,8 +42,9 @@ fun BundleInformationDialog(
|
|||||||
val props by remember(bundle) {
|
val props by remember(bundle) {
|
||||||
bundle.propsFlow()
|
bundle.propsFlow()
|
||||||
}.collectAsStateWithLifecycle(null)
|
}.collectAsStateWithLifecycle(null)
|
||||||
val patchCount by bundle.patchCountFlow.collectAsStateWithLifecycle(0)
|
val patchCount = remember(state) {
|
||||||
val version by bundle.versionFlow.collectAsStateWithLifecycle(null)
|
state.patchBundleOrNull()?.patches?.size ?: 0
|
||||||
|
}
|
||||||
|
|
||||||
if (viewCurrentBundlePatches) {
|
if (viewCurrentBundlePatches) {
|
||||||
BundlePatchesDialog(
|
BundlePatchesDialog(
|
||||||
@ -97,8 +98,8 @@ fun BundleInformationDialog(
|
|||||||
name = bundleName,
|
name = bundleName,
|
||||||
remoteUrl = bundle.asRemoteOrNull?.endpoint,
|
remoteUrl = bundle.asRemoteOrNull?.endpoint,
|
||||||
patchCount = patchCount,
|
patchCount = patchCount,
|
||||||
version = version,
|
version = props?.version,
|
||||||
autoUpdate = props?.autoUpdate == true,
|
autoUpdate = props?.autoUpdate ?: false,
|
||||||
onAutoUpdateChange = {
|
onAutoUpdateChange = {
|
||||||
composableScope.launch {
|
composableScope.launch {
|
||||||
bundle.asRemoteOrNull?.setAutoUpdate(it)
|
bundle.asRemoteOrNull?.setAutoUpdate(it)
|
||||||
|
@ -47,8 +47,9 @@ fun BundleItem(
|
|||||||
var showDeleteConfirmationDialog by rememberSaveable { mutableStateOf(false) }
|
var showDeleteConfirmationDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
val state by bundle.state.collectAsStateWithLifecycle()
|
val state by bundle.state.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
val version by bundle.versionFlow.collectAsStateWithLifecycle(null)
|
val version by remember(bundle) {
|
||||||
val patchCount by bundle.patchCountFlow.collectAsStateWithLifecycle(0)
|
bundle.propsFlow().map { props -> props?.version }
|
||||||
|
}.collectAsStateWithLifecycle(null)
|
||||||
val name by bundle.nameState
|
val name by bundle.nameState
|
||||||
|
|
||||||
if (viewBundleDialogPage) {
|
if (viewBundleDialogPage) {
|
||||||
@ -92,7 +93,7 @@ fun BundleItem(
|
|||||||
|
|
||||||
headlineContent = { Text(name) },
|
headlineContent = { Text(name) },
|
||||||
supportingContent = {
|
supportingContent = {
|
||||||
if (state is PatchBundleSource.State.Loaded) {
|
state.patchBundleOrNull()?.patches?.size?.let { patchCount ->
|
||||||
Text(pluralStringResource(R.plurals.patch_count, patchCount, patchCount))
|
Text(pluralStringResource(R.plurals.patch_count, patchCount, patchCount))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -57,7 +57,9 @@ fun BundleSelector(bundles: List<PatchBundleSource>, onFinish: (PatchBundleSourc
|
|||||||
}
|
}
|
||||||
bundles.forEach {
|
bundles.forEach {
|
||||||
val name by it.nameState
|
val name by it.nameState
|
||||||
val version by it.versionFlow.collectAsStateWithLifecycle(null)
|
val version by remember(it) {
|
||||||
|
it.propsFlow().map { props -> props?.version }
|
||||||
|
}.collectAsStateWithLifecycle(null)
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
@ -79,7 +79,7 @@ data class BundleInfo(
|
|||||||
targetList.add(it)
|
targetList.add(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
BundleInfo(source.getName(), bundle.readManifestAttribute("Version"), source.uid, compatible, incompatible, universal)
|
BundleInfo(source.getName(), source.currentVersion(), source.uid, compatible, incompatible, universal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user