mirror of
https://github.com/CherretGit/zaprett-app.git
synced 2026-03-22 00:28:15 +05:00
get bins and move downloaded files to files dir
This commit is contained in:
@@ -203,6 +203,7 @@ abstract class BaseRepoViewModel(application: Application) : AndroidViewModel(ap
|
||||
}
|
||||
|
||||
val targetFile = baseDir
|
||||
.resolve("files")
|
||||
.resolve(targetDirSuffix)
|
||||
.resolve(uri.lastPathSegment!!
|
||||
.replace(Regex("""-\d+(?=\.|$)"""), ""))
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user