mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-28 22:13:01 +00:00
fix app download paths
This commit is contained in:
parent
275597629e
commit
918031bf70
7 changed files with 46 additions and 15 deletions
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import com.vanced.manager.core.downloader.api.MicrogAPI
|
||||
import com.vanced.manager.core.downloader.base.AppDownloader
|
||||
import com.vanced.manager.core.downloader.util.DownloadStatus
|
||||
import com.vanced.manager.core.downloader.util.getMicrogPath
|
||||
import java.io.File
|
||||
|
||||
class MicrogDownloader(
|
||||
|
@ -43,8 +44,7 @@ class MicrogDownloader(
|
|||
}
|
||||
|
||||
override fun getSavedFilePath(): String {
|
||||
val directory =
|
||||
File(context.getExternalFilesDir("microg")!!.path)
|
||||
val directory = File(getMicrogPath(context))
|
||||
|
||||
if (!directory.exists())
|
||||
directory.mkdirs()
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import com.vanced.manager.core.downloader.api.MusicAPI
|
||||
import com.vanced.manager.core.downloader.base.AppDownloader
|
||||
import com.vanced.manager.core.downloader.util.DownloadStatus
|
||||
import com.vanced.manager.core.downloader.util.getVancedMusicPath
|
||||
import com.vanced.manager.core.preferences.holder.managerVariantPref
|
||||
import com.vanced.manager.core.preferences.holder.musicVersionPref
|
||||
import com.vanced.manager.core.util.getLatestOrProvidedAppVersion
|
||||
|
@ -53,8 +54,7 @@ class MusicDownloader(
|
|||
}
|
||||
|
||||
override fun getSavedFilePath(): String {
|
||||
val directory =
|
||||
File(context.getExternalFilesDir("vancedmusic")!!.path + "$absoluteVersion/$managerVariantPref")
|
||||
val directory = File(getVancedMusicPath(absoluteVersion, managerVariantPref, context))
|
||||
|
||||
if (!directory.exists())
|
||||
directory.mkdirs()
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import com.vanced.manager.core.downloader.api.VancedAPI
|
||||
import com.vanced.manager.core.downloader.base.AppDownloader
|
||||
import com.vanced.manager.core.downloader.util.DownloadStatus
|
||||
import com.vanced.manager.core.downloader.util.getVancedMusicPath
|
||||
import com.vanced.manager.core.preferences.holder.managerVariantPref
|
||||
import com.vanced.manager.core.preferences.holder.vancedLanguagesPref
|
||||
import com.vanced.manager.core.preferences.holder.vancedThemePref
|
||||
|
@ -64,8 +65,7 @@ class VancedDownloader(
|
|||
}
|
||||
|
||||
override fun getSavedFilePath(): String {
|
||||
val directory =
|
||||
File(context.getExternalFilesDir("vanced")!!.path + "/$absoluteVersion/$managerVariantPref")
|
||||
val directory = File(getVancedMusicPath(absoluteVersion, managerVariantPref, context))
|
||||
|
||||
if (!directory.exists())
|
||||
directory.mkdirs()
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.vanced.manager.core.downloader.util
|
||||
|
||||
import android.content.Context
|
||||
|
||||
fun getVancedPath(
|
||||
version: String,
|
||||
variant: String,
|
||||
context: Context
|
||||
) = context.getExternalFilesDir("vanced_youtube")!!.path + "/$version/$variant"
|
||||
|
||||
fun getVancedMusicPath(
|
||||
version: String,
|
||||
variant: String,
|
||||
context: Context
|
||||
) = context.getExternalFilesDir("vanced_music")!!.path + "/$version/$variant"
|
||||
|
||||
fun getMicrogPath(
|
||||
context: Context
|
||||
) = context.getExternalFilesDir("microg")!!.path
|
|
@ -1,6 +1,7 @@
|
|||
package com.vanced.manager.core.installer.impl
|
||||
|
||||
import android.content.Context
|
||||
import com.vanced.manager.core.downloader.util.getMicrogPath
|
||||
import com.vanced.manager.core.installer.base.AppInstaller
|
||||
import com.vanced.manager.core.installer.util.installApp
|
||||
import java.io.File
|
||||
|
@ -9,8 +10,11 @@ class MicrogInstaller(
|
|||
private val context: Context
|
||||
) : AppInstaller() {
|
||||
|
||||
override fun install(appVersions: List<String>?) {
|
||||
val musicApk = File(context.getExternalFilesDir("microg/microg.apk")!!.path)
|
||||
override fun install(
|
||||
appVersions: List<String>?
|
||||
) {
|
||||
val musicApk = File(getMicrogPath(context) + "/microg.apk")
|
||||
|
||||
installApp(musicApk, context)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
package com.vanced.manager.core.installer.impl
|
||||
|
||||
import android.content.Context
|
||||
import com.vanced.manager.core.downloader.util.getVancedMusicPath
|
||||
import com.vanced.manager.core.installer.base.AppInstaller
|
||||
import com.vanced.manager.core.installer.util.installApp
|
||||
import com.vanced.manager.core.preferences.holder.managerVariantPref
|
||||
import com.vanced.manager.core.preferences.holder.musicVersionPref
|
||||
import com.vanced.manager.core.preferences.holder.vancedVersionPref
|
||||
import com.vanced.manager.core.util.getLatestOrProvidedAppVersion
|
||||
import java.io.File
|
||||
|
||||
class MusicInstaller(
|
||||
private val context: Context
|
||||
) : AppInstaller() {
|
||||
|
||||
override fun install(appVersions: List<String>?) {
|
||||
val musicApk = File(
|
||||
context.getExternalFilesDir("music/$musicVersionPref/$managerVariantPref/music.apk")!!.path
|
||||
)
|
||||
override fun install(
|
||||
appVersions: List<String>?
|
||||
) {
|
||||
val absoluteVersion = getLatestOrProvidedAppVersion(musicVersionPref, appVersions)
|
||||
|
||||
val musicApk = File(getVancedMusicPath(absoluteVersion, managerVariantPref, context) + "/music.apk")
|
||||
|
||||
installApp(musicApk, context)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
package com.vanced.manager.core.installer.impl
|
||||
|
||||
import android.content.Context
|
||||
import com.vanced.manager.core.downloader.util.getVancedPath
|
||||
import com.vanced.manager.core.installer.base.AppInstaller
|
||||
import com.vanced.manager.core.installer.util.installSplitApp
|
||||
import com.vanced.manager.core.preferences.holder.managerVariantPref
|
||||
import com.vanced.manager.core.preferences.holder.vancedVersionPref
|
||||
import com.vanced.manager.core.util.getLatestOrProvidedAppVersion
|
||||
import java.io.File
|
||||
|
||||
class VancedInstaller(
|
||||
private val context: Context
|
||||
) : AppInstaller() {
|
||||
|
||||
override fun install(appVersions: List<String>?) {
|
||||
override fun install(
|
||||
appVersions: List<String>?
|
||||
) {
|
||||
val absoluteVersion = getLatestOrProvidedAppVersion(vancedVersionPref, appVersions)
|
||||
|
||||
val apks = context
|
||||
.getExternalFilesDir("vanced/$absoluteVersion/$managerVariantPref")!!
|
||||
val apks = File(getVancedPath(absoluteVersion, managerVariantPref, context))
|
||||
.listFiles { file ->
|
||||
file.extension == "apk"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue