Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #386 from YTVanced/dev
Browse files Browse the repository at this point in the history
v2.3.0
  • Loading branch information
KevinX8 authored Jan 27, 2021
2 parents 9076732 + 50b81e8 commit 0c72ca8
Show file tree
Hide file tree
Showing 104 changed files with 477 additions and 821 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Pull requests should be made to the Dev branch as that is the working branch, ma
======
For anyone who wants to provide translations please submit them to https://crowdin.com/project/vanced-manager as we also use it for YouTube Vanced. Any issues with translations should be posted there too.
======
Vanced FAQ (from the faq branch) now available on the playstore! https://play.google.com/store/apps/details?id=com.vanced.faq
## The FAQ app has just been suspended due to "Impersonating Vanced", an appeal has been filed, reporting other apps which impersonate Vanced on the play store is appreciated.

[![Github All Releases](https://img.shields.io/github/downloads/YTVanced/VancedManager/total.svg)](https://github.com/YTVanced/VancedManager/releases/latest) [![Github All Releases](https://img.shields.io/github/release/YTVanced/VancedManager.svg)](https://github.com/YTVanced/VancedManager/releases/latest)
# Vanced Manager
Hi, when we released Vanced 15.05.54, people were upset because it used the .apks format, which was way harder to install than a traditional .apk file. Even though we wrote clear instructions on how to install the new Vanced build, people still couldn't figure it out.
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId = "com.vanced.manager"
minSdkVersion(21)
targetSdkVersion(30)
versionCode = 221
versionName = "2.2.1 (RootedFirebase)"
versionCode = 230
versionName = "2.3.0 (MicroShitMoment)"

vectorDrawables.useSupportLibrary = true

Expand Down
5 changes: 1 addition & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<package android:name="com.vanced.android.apps.youtube.music" />
<package android:name="com.google.android.apps.youtube.music" />
<package android:name="com.mgoogle.android.gms" />
<package android:name="com.android.vending" />
</queries>

<application
Expand Down Expand Up @@ -72,10 +73,6 @@

</activity>

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/vanced/manager/adapter/AppListAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import com.vanced.manager.model.DataModel
import com.vanced.manager.model.RootDataModel
import com.vanced.manager.ui.dialogs.AppInfoDialog
import com.vanced.manager.ui.viewmodels.HomeViewModel
import com.vanced.manager.utils.enableMusic
import com.vanced.manager.utils.enableVanced
import com.vanced.manager.utils.managerVariant

class AppListAdapter(
private val context: FragmentActivity,
Expand All @@ -28,15 +31,14 @@ class AppListAdapter(
private val prefs = getDefaultSharedPreferences(context)
private var itemCount = 0

private val isRoot = prefs.getString("vanced_variant", "nonroot") == "root"
private val isRoot = prefs.managerVariant == "root"

inner class ListViewHolder(private val binding: ViewAppBinding) : RecyclerView.ViewHolder(binding.root) {
val appCard = binding.appCard
fun bind(position: Int) {
val dataModel = if (isRoot) rootDataModels[position] else dataModels[position]
with(binding) {
appName.text = dataModel?.appName
appInstallButton.text = dataModel?.buttonTxt?.value
dataModel?.buttonTxt?.observe(lifecycleOwner) {
appInstallButton.text = it
}
Expand All @@ -57,11 +59,9 @@ class AppListAdapter(
appUninstall.isVisible = it
appLaunch.isVisible = it
}
appRemoteVersion.text = dataModel?.versionName?.value
dataModel?.versionName?.observe(lifecycleOwner) {
appRemoteVersion.text = it
}
appInstalledVersion.text = dataModel?.installedVersionName?.value
dataModel?.installedVersionName?.observe(lifecycleOwner) {
appInstalledVersion.text = it
}
Expand Down Expand Up @@ -91,7 +91,7 @@ class AppListAdapter(

init {

if (prefs.getBoolean("enable_vanced", true)) {
if (prefs.enableVanced) {
if (isRoot) {
rootDataModels.add(viewModel.vancedRootModel.value)
} else {
Expand All @@ -101,7 +101,7 @@ class AppListAdapter(
itemCount++
}

if (prefs.getBoolean("enable_music", true)) {
if (prefs.enableMusic) {
if (isRoot) {
rootDataModels.add(viewModel.musicRootModel.value)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import androidx.recyclerview.widget.RecyclerView
import com.vanced.manager.R
import com.vanced.manager.databinding.ViewAppCheckboxBinding
import com.vanced.manager.model.SelectAppModel
import com.vanced.manager.utils.enableMusic
import com.vanced.manager.utils.enableVanced

class SelectAppsAdapter(private val context: Context) :
RecyclerView.Adapter<SelectAppsAdapter.SelectAppsViewHolder>() {
Expand All @@ -18,14 +20,14 @@ class SelectAppsAdapter(private val context: Context) :
context.getString(R.string.vanced),
context.getString(R.string.select_apps_vanced),
"vanced",
prefs.getBoolean("enable_vanced", true)
prefs.enableVanced
)

private val music = SelectAppModel(
context.getString(R.string.music),
context.getString(R.string.select_apps_music),
"music",
prefs.getBoolean("enable_music", true)
prefs.enableMusic
)

val apps = arrayOf(vanced, music)
Expand Down
20 changes: 0 additions & 20 deletions app/src/main/java/com/vanced/manager/adapter/SponsorAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,6 @@ class SponsorAdapter(

override fun getItemCount(): Int = 2

// fun getCountryFromIP(ipAddress: String?): String? {
// val db = context.assets.open("GeoLite2-Country.mmdb")
// val reader = DatabaseReader.Builder(db).build()
// val inetIp = InetAddress.getByName(ipAddress)
// return reader.country(inetIp).country.isoCode
// }
//
// init {
// json.addOnPropertyChangedCallback(object : Observable.OnPropertyChangedCallback() {
// override fun onPropertyChanged(sender: Observable?, propertyId: Int) {
// val wm = context.applicationContext.getSystemService(WIFI_SERVICE) as WifiManager?
// val ip: String = formatIpAddress(wm!!.connectionInfo.ipAddress)
// val promotedTiers = json.get()?.array<String>("tier2")?.value!! + json.get()?.array<String>("tier3")?.value!!
// if (promotedTiers.any { getCountryFromIP(ip)?.contains(it)!! })
// sponsors.removeAt(1)
// }
//
// })
// }

companion object {
const val BRAVE = "https://vancedapp.com/brave"
const val ADGUARD = "https://adguard.com/?aid=31141&source=manager"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import com.vanced.manager.R
import com.vanced.manager.utils.DownloadHelper.download
import com.vanced.manager.utils.DownloadHelper.downloadProgress
import com.vanced.manager.utils.PackageHelper.install
import com.vanced.manager.utils.getDefaultPrefs
import com.vanced.manager.utils.getInstallUrl
import com.vanced.manager.utils.baseInstallUrl
import com.vanced.manager.utils.microg

object MicrogDownloader {
Expand All @@ -16,13 +15,11 @@ object MicrogDownloader {

fun downloadMicrog(context: Context) {
val url = microg.value?.string("url") ?: ""
context.getDefaultPrefs().getInstallUrl()?.let {
download(url, "$it/", folderName, fileName, context, onDownloadComplete = {
startMicrogInstall(context)
}, onError = {
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, fileName))
})
}
download(url, "$baseInstallUrl/", folderName, fileName, context, onDownloadComplete = {
startMicrogInstall(context)
}, onError = {
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, fileName))
})

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.vanced.manager.core.downloader

import android.content.Context
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
import com.vanced.manager.R
import com.vanced.manager.utils.*
import com.vanced.manager.utils.AppUtils.musicRootPkg
Expand All @@ -23,11 +22,11 @@ object MusicDownloader {
private var hashUrl: String? = null

fun downloadMusic(context: Context) {
val prefs = getDefaultSharedPreferences(context)
version = prefs.getString("music_version", "latest")?.getLatestAppVersion(musicVersions.value?.value ?: listOf(""))
val prefs = context.defPrefs
version = prefs.musicVersion?.getLatestAppVersion(musicVersions.value?.value ?: listOf(""))
versionCode = music.value?.int("versionCode")
variant = prefs.getString("vanced_variant", "nonroot")
baseurl = "${prefs.getInstallUrl()}/music/v$version"
variant = prefs.managerVariant
baseurl = "$baseInstallUrl/music/v$version"
folderName = "music/$variant"
downloadPath = context.getExternalFilesDir(folderName)?.path
hashUrl = "$baseurl/hash.json"
Expand All @@ -37,7 +36,7 @@ object MusicDownloader {

private fun downloadApk(context: Context, apk: String = "music") {
val url = if (apk == "stock") "$baseurl/stock/${getArch()}.apk" else "$baseurl/$variant.apk"
download(url, baseurl + "/", folderName!!, getFileNameFromUrl(url), context, onDownloadComplete = {
download(url, "$baseurl/", folderName!!, getFileNameFromUrl(url), context, onDownloadComplete = {
if (variant == "root" && apk != "stock") {
downloadApk(context, "stock")
return@download
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.vanced.manager.core.downloader
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.logEvent
import com.vanced.manager.R
Expand All @@ -16,14 +15,12 @@ import com.vanced.manager.utils.PackageHelper.downloadStockCheck
import com.vanced.manager.utils.PackageHelper.installVanced
import com.vanced.manager.utils.PackageHelper.installVancedRoot
import java.io.File
import java.lang.Exception

object VancedDownloader {

private lateinit var prefs: SharedPreferences
private lateinit var defPrefs: SharedPreferences
private lateinit var arch: String
private var installUrl: String? = null
private var variant: String? = null
private var theme: String? = null
private var lang = mutableListOf<String>()
Expand All @@ -40,22 +37,20 @@ object VancedDownloader {
private var downloadPath: String? = null
private var folderName: String? = null

fun downloadVanced(context: Context) {
defPrefs = getDefaultSharedPreferences(context)
prefs = context.getSharedPreferences("installPrefs", Context.MODE_PRIVATE)
variant = defPrefs.getString("vanced_variant", "nonroot")
fun downloadVanced(context: Context, version: String?) {
defPrefs = context.defPrefs
prefs = context.installPrefs
variant = defPrefs.managerVariant
folderName = "vanced/$variant"
downloadPath = context.getExternalFilesDir(folderName)?.path
File(downloadPath.toString()).deleteRecursively()
installUrl = defPrefs.getInstallUrl()
prefs.getString("lang", getDefaultVancedLanguages())?.let {
prefs.lang?.let {
lang = it.split(", ").toMutableList()
}
theme = prefs.getString("theme", "dark")
vancedVersion = defPrefs.getString("vanced_version", "latest")?.getLatestAppVersion(vancedVersions.value?.value ?: listOf(""))
themePath = "$installUrl/apks/v$vancedVersion/$variant/Theme"
theme = prefs.theme
vancedVersion = version ?: defPrefs.vancedVersion?.getLatestAppVersion(vancedVersions.value?.value ?: listOf(""))
themePath = "$baseInstallUrl/apks/v$vancedVersion/$variant/Theme"
hashUrl = "apks/v$vancedVersion/$variant/Theme/hash.json"
//newInstaller = defPrefs.getBoolean("new_installer", false)
arch = getArch()
count = 0

Expand All @@ -72,57 +67,55 @@ object VancedDownloader {
private fun downloadSplits(context: Context, type: String = "theme") {
val url = when (type) {
"theme" -> "$themePath/$theme.apk"
"arch" -> "$installUrl/apks/v$vancedVersion/$variant/Arch/split_config.$arch.apk"
"arch" -> "$baseInstallUrl/apks/v$vancedVersion/$variant/Arch/split_config.$arch.apk"
"stock" -> "$themePath/stock.apk"
"dpi" -> "$themePath/dpi.apk"
"lang" -> "$installUrl/apks/v$vancedVersion/$variant/Language/split_config.${lang[count]}.apk"
"lang" -> "$baseInstallUrl/apks/v$vancedVersion/$variant/Language/split_config.${lang[count]}.apk"
else -> throw NotImplementedError("This type of APK is NOT valid. What the hell did you even do?")
}

installUrl?.let {
download(url, "$it/", folderName!!, getFileNameFromUrl(url), context, onDownloadComplete = {
when (type) {
"theme" ->
if (variant == "root") {
if (validateTheme(downloadPath!!, theme!!, hashUrl, context)) {
if (downloadStockCheck(vancedRootPkg, vancedVersionCode, context))
downloadSplits(context, "arch")
else
startVancedInstall(context)
} else
downloadSplits(context, "theme")
download(url, "$baseInstallUrl/", folderName!!, getFileNameFromUrl(url), context, onDownloadComplete = {
when (type) {
"theme" ->
if (variant == "root") {
if (validateTheme(downloadPath!!, theme!!, hashUrl, context)) {
if (downloadStockCheck(vancedRootPkg, vancedVersionCode, context))
downloadSplits(context, "arch")
else
startVancedInstall(context)
} else
downloadSplits(context, "arch")
"arch" -> if (variant == "root") downloadSplits(context, "stock") else downloadSplits(context, "lang")
"stock" -> downloadSplits(context, "dpi")
"dpi" -> downloadSplits(context, "lang")
"lang" -> {
count++
succesfulLangCount++
if (count < lang.size)
downloadSplits(context, "lang")
else
startVancedInstall(context)
}

}
}, onError = {
if (type == "lang") {
downloadSplits(context, "theme")
} else
downloadSplits(context, "arch")
"arch" -> if (variant == "root") downloadSplits(context, "stock") else downloadSplits(context, "lang")
"stock" -> downloadSplits(context, "dpi")
"dpi" -> downloadSplits(context, "lang")
"lang" -> {
count++
when {
count < lang.size -> downloadSplits(context, "lang")
succesfulLangCount == 0 -> {
lang.add("en")
downloadSplits(context, "lang")
}
else -> startVancedInstall(context)
}
succesfulLangCount++
if (count < lang.size)
downloadSplits(context, "lang")
else
startVancedInstall(context)
}

} else {
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
}
}, onError = {
if (type == "lang") {
count++
when {
count < lang.size -> downloadSplits(context, "lang")
succesfulLangCount == 0 -> {
lang.add("en")
downloadSplits(context, "lang")
}
else -> startVancedInstall(context)
}
})
}

} else {
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
}
})
}

fun startVancedInstall(context: Context, variant: String? = this.variant) {
Expand Down
Loading

0 comments on commit 0c72ca8

Please sign in to comment.