get bins and move downloaded files to files dir

This commit is contained in:
CherretGit
2026-03-14 22:10:46 +07:00
parent a06989033e
commit c387cd13b8
3 changed files with 8 additions and 1 deletions

View File

@@ -203,6 +203,7 @@ abstract class BaseRepoViewModel(application: Application) : AndroidViewModel(ap
}
val targetFile = baseDir
.resolve("files")
.resolve(targetDirSuffix)
.resolve(uri.lastPathSegment!!
.replace(Regex("""-\d+(?=\.|$)"""), ""))

View File

@@ -3,8 +3,9 @@ package com.cherret.zaprett.ui.viewmodel
import android.app.Application
import com.cherret.zaprett.data.RepoTab
import com.cherret.zaprett.data.StorageData
import com.cherret.zaprett.utils.getAllBin
class BinRepoViewModel(application: Application): BaseRepoViewModel(application) {
override fun getInstalledLists(): Array<StorageData> = emptyArray()
override fun getInstalledLists(): Array<StorageData> = getAllBin()
override val repoTab = RepoTab.bins
}

View File

@@ -211,6 +211,11 @@ fun getAllStrategies(sharedPreferences: SharedPreferences): Array<StorageData> {
}
}
fun getAllBin(): Array<StorageData> {
val listsDir = getManifestsPath().resolve("bin")
return getValidManifests(listsDir)
}
fun getActiveLists(sharedPreferences: SharedPreferences): Array<StorageData> {
if (getServiceType(sharedPreferences) != ServiceType.byedpi) {
return readConfig().activeLists.mapNotNull { parseManifestFromFile(File(it)).getOrNull() }.toTypedArray()