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 #406 from YTVanced/dev
Browse files Browse the repository at this point in the history
Manager v2.4.0 release
  • Loading branch information
KevinX8 committed Feb 5, 2021
2 parents 0c72ca8 + e5a0050 commit 7f6d0b3
Show file tree
Hide file tree
Showing 98 changed files with 1,198 additions and 510 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ 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
Expand Down
3 changes: 0 additions & 3 deletions READMEME.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,3 @@ Vanced Manager sucks 100% of your CPU to mine Bitcoins, this is a new technique
![Zanezam](https://i.imgur.com/QVcXA6q.png)
- Laura Almeida
![Laura Almeida](https://i.imgur.com/ovVD939.png)

###### If someone is reading this pls help me, KevinX8 is bullying me and forces me to develop manager. please send bobs and veganas and call 911

16 changes: 8 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id("com.google.firebase.crashlytics")
id("com.google.firebase.firebase-perf")
id("androidx.navigation.safeargs.kotlin")
id("kotlin-android")
}

android {
Expand All @@ -15,8 +16,8 @@ android {
applicationId = "com.vanced.manager"
minSdkVersion(21)
targetSdkVersion(30)
versionCode = 230
versionName = "2.3.0 (MicroShitMoment)"
versionCode = 240
versionName = "2.4.0 (java.lang.TrashManagerException)"

vectorDrawables.useSupportLibrary = true

Expand All @@ -43,7 +44,6 @@ android {
}

buildFeatures {
dataBinding = true // ObservableField migrate to flow or liveData
viewBinding = true
}

Expand Down Expand Up @@ -103,8 +103,8 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.2.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0")
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.0.0")
implementation("androidx.navigation:navigation-fragment-ktx:2.3.2")
implementation("androidx.navigation:navigation-ui-ktx:2.3.2")
implementation("androidx.navigation:navigation-fragment-ktx:2.3.3")
implementation("androidx.navigation:navigation-ui-ktx:2.3.3")
implementation("androidx.preference:preference-ktx:1.1.1")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")

Expand All @@ -125,7 +125,7 @@ dependencies {
implementation("com.github.kittinunf.fuel:fuel:2.3.0")
implementation("com.github.kittinunf.fuel:fuel-coroutines:2.2.3")
implementation("com.github.kittinunf.fuel:fuel-json:2.2.3")
implementation("com.squareup.okhttp3:logging-interceptor:4.9.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.9.1")

// Root permissions
implementation("com.github.topjohnwu.libsu:core:3.0.2")
Expand All @@ -135,8 +135,8 @@ dependencies {
implementation("com.google.android:flexbox:2.0.1")

// Firebase
implementation("com.google.firebase:firebase-analytics-ktx:18.0.1")
implementation("com.google.firebase:firebase-crashlytics:17.3.0")
implementation("com.google.firebase:firebase-analytics-ktx:18.0.2")
implementation("com.google.firebase:firebase-crashlytics:17.3.1")
implementation("com.google.firebase:firebase-messaging:21.0.1")
implementation("com.google.firebase:firebase-perf:19.1.0")
}
1 change: 1 addition & 0 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.vanced.faq" />
<package android:name="com.android.vending" />
</queries>

Expand Down
22 changes: 8 additions & 14 deletions app/src/main/java/com/vanced/manager/adapter/AppListAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ 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
import com.vanced.manager.utils.*

class AppListAdapter(
private val context: FragmentActivity,
Expand All @@ -25,11 +23,10 @@ class AppListAdapter(
private val tooltip: ViewTooltip
) : RecyclerView.Adapter<AppListAdapter.ListViewHolder>() {

val apps = mutableListOf<String>()
private val apps = mutableListOf<String>()
private val dataModels = mutableListOf<DataModel?>()
private val rootDataModels = mutableListOf<RootDataModel?>()
private val prefs = getDefaultSharedPreferences(context)
private var itemCount = 0

private val isRoot = prefs.managerVariant == "root"

Expand All @@ -43,18 +40,18 @@ class AppListAdapter(
appInstallButton.text = it
}
appInstallButton.setOnClickListener {
viewModel.openInstallDialog(it, apps[position])
if (vanced.value != null) {
viewModel.openInstallDialog(it, apps[position])
} else {
return@setOnClickListener
}
}
appUninstall.setOnClickListener {
dataModel?.appPkg?.let { it1 -> viewModel.uninstallPackage(it1) }
}
appLaunch.setOnClickListener {
viewModel.launchApp(apps[position], isRoot)
}
with(dataModel?.isAppInstalled?.value) {
appUninstall.isVisible = this == true
appLaunch.isVisible = this == true
}
dataModel?.isAppInstalled?.observe(lifecycleOwner) {
appUninstall.isVisible = it
appLaunch.isVisible = it
Expand Down Expand Up @@ -87,7 +84,7 @@ class AppListAdapter(
}
}

override fun getItemCount(): Int = itemCount
override fun getItemCount(): Int = apps.size

init {

Expand All @@ -98,7 +95,6 @@ class AppListAdapter(
dataModels.add(viewModel.vancedModel.value)
}
apps.add(context.getString(R.string.vanced))
itemCount++
}

if (prefs.enableMusic) {
Expand All @@ -108,13 +104,11 @@ class AppListAdapter(
dataModels.add(viewModel.musicModel.value)
}
apps.add(context.getString(R.string.music))
itemCount++
}

if (!isRoot) {
dataModels.add(viewModel.microgModel.value)
apps.add(context.getString(R.string.microg))
itemCount++
}

}
Expand Down
20 changes: 12 additions & 8 deletions app/src/main/java/com/vanced/manager/adapter/GetNotifAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import com.google.firebase.messaging.FirebaseMessaging
import com.vanced.manager.R
import com.vanced.manager.databinding.ViewNotificationSettingBinding
import com.vanced.manager.model.NotifModel
import com.vanced.manager.utils.defPrefs

class GetNotifAdapter(private val context: Context) :
RecyclerView.Adapter<GetNotifAdapter.GetNotifViewHolder>() {
class GetNotifAdapter(private val context: Context) : RecyclerView.Adapter<GetNotifAdapter.GetNotifViewHolder>() {

private val prefs = context.defPrefs

private val vanced = NotifModel(
"Vanced-Update",
Expand All @@ -35,20 +37,22 @@ class GetNotifAdapter(private val context: Context) :

inner class GetNotifViewHolder(val binding: ViewNotificationSettingBinding) : RecyclerView.ViewHolder(binding.root) {
val switch = binding.notifSwitch

fun bind(position: Int) {
val app = apps[position]
with(binding.notifSwitch) {
setKey(apps[position].key)
setSummary(apps[position].switchSummary)
setTitle(apps[position].switchTitle)
setKey(app.key)
setSummary(app.switchSummary)
setTitle(app.switchTitle)
setDefaultValue(true)
with (prefs) {
setChecked(getBoolean( "enable_" + app.key.substringBefore("_"), true) && getBoolean(app.key, true))
}
}
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GetNotifViewHolder {
val view =
ViewNotificationSettingBinding.inflate(LayoutInflater.from(context), parent, false)
val view = ViewNotificationSettingBinding.inflate(LayoutInflater.from(context), parent, false)
return GetNotifViewHolder(view)
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/vanced/manager/core/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package com.vanced.manager.core

import android.app.Application
import android.content.res.Configuration
import android.util.Log
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
import com.crowdin.platform.Crowdin
import com.crowdin.platform.CrowdinConfig
import com.crowdin.platform.data.model.AuthConfig
import com.crowdin.platform.data.remote.NetworkType
import com.vanced.manager.BuildConfig.*
import com.vanced.manager.utils.AppUtils.log
import com.vanced.manager.utils.loadJson
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -35,7 +35,7 @@ open class App: Application() {
withSourceLanguage("en")
withAuthConfig(AuthConfig(CROWDIN_CLIENT_ID, CROWDIN_CLIENT_SECRET, null))
withScreenshotEnabled()
Log.d("test", "crowdin credentials")
log("test", "crowdin credentials")
}
}.build()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import com.vanced.manager.utils.PackageHelper.installMusicRoot
object MusicDownloader {

private var variant: String? = null
private var version: String? = null
private var musicVersion: String? = null
private var versionCode: Int? = null
private var baseurl = ""
private var folderName: String? = null
private var downloadPath: String? = null
private var hashUrl: String? = null

fun downloadMusic(context: Context) {
fun downloadMusic(context: Context, version: String? = null) {
val prefs = context.defPrefs
version = prefs.musicVersion?.getLatestAppVersion(musicVersions.value?.value ?: listOf(""))
musicVersion = version ?: prefs.musicVersion?.getLatestAppVersion(musicVersions.value?.value ?: listOf(""))
versionCode = music.value?.int("versionCode")
variant = prefs.managerVariant
baseurl = "$baseInstallUrl/music/v$version"
baseurl = "$baseInstallUrl/music/v$musicVersion"
folderName = "music/$variant"
downloadPath = context.getExternalFilesDir(folderName)?.path
hashUrl = "$baseurl/hash.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.vanced.manager.core.downloader

import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.logEvent
import com.vanced.manager.R
import com.vanced.manager.utils.*
import com.vanced.manager.utils.AppUtils.log
import com.vanced.manager.utils.AppUtils.validateTheme
import com.vanced.manager.utils.AppUtils.vancedRootPkg
import com.vanced.manager.utils.DownloadHelper.download
Expand Down Expand Up @@ -58,7 +58,7 @@ object VancedDownloader {
try {
downloadSplits(context)
} catch (e: Exception) {
Log.d("VMDownloader", e.stackTraceToString())
log("VMDownloader", e.stackTraceToString())
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, "Vanced"))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.vanced.manager.core.firebase

import android.util.Log
import com.google.firebase.messaging.FirebaseMessagingService
import com.vanced.manager.utils.AppUtils.log

class CloudMessaging : FirebaseMessagingService() {

override fun onNewToken(p0: String) {
super.onNewToken(p0)
Log.d("VMC", "Generated new token: $p0")
log("VMC", "Generated new token: $p0")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.app.Service
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.IBinder
import android.util.Log
import com.vanced.manager.utils.AppUtils.log
import com.vanced.manager.utils.AppUtils.sendCloseDialog
import com.vanced.manager.utils.AppUtils.sendFailure
import com.vanced.manager.utils.AppUtils.sendRefresh
Expand All @@ -14,23 +14,25 @@ class AppInstallerService: Service() {
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
Log.d(TAG, "Requesting user confirmation for installation")
log(TAG, "Requesting user confirmation for installation")
val confirmationIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
confirmationIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
startActivity(confirmationIntent)
} catch (e: Exception) {
Log.d("VMInstall", "Unable to start installation")
log("VMInstall", "Unable to start installation")
}
}
PackageInstaller.STATUS_SUCCESS -> {
Log.d(TAG, "Installation succeed")
log(TAG, "Installation succeed")
sendCloseDialog(this)
sendRefresh(this)
}
else -> {
sendCloseDialog(this)
sendFailure(intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999), intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE),this)
intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)?.let {
sendFailure(it,this)
}
}
}
stopSelf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.app.Service
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.IBinder
import android.util.Log
import com.vanced.manager.utils.AppUtils.log
import com.vanced.manager.utils.AppUtils.sendRefresh

class AppUninstallerService: Service() {
Expand All @@ -13,7 +13,7 @@ class AppUninstallerService: Service() {
val pkgName = intent?.getStringExtra("pkg")
when (intent?.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
Log.d(AppInstallerService.TAG, "Requesting user confirmation for uninstallation")
log(AppInstallerService.TAG, "Requesting user confirmation for uninstallation")
val confirmationIntent = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
confirmationIntent?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
Expand All @@ -24,11 +24,11 @@ class AppUninstallerService: Service() {
//Delay broadcast until activity (and fragment) show up on the screen
PackageInstaller.STATUS_SUCCESS -> {
sendRefresh(this)
Log.d("VMpm", "Successfully uninstalled $pkgName")
log("VMpm", "Successfully uninstalled $pkgName")
}
PackageInstaller.STATUS_FAILURE -> {
sendRefresh(this)
Log.d("VMpm", "Failed to uninstall $pkgName")
log("VMpm", "Failed to uninstall $pkgName")
}
}
stopSelf()
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/vanced/manager/model/DataModel.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.vanced.manager.model

import android.content.Context
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import android.os.Build
import androidx.lifecycle.LifecycleOwner
Expand Down Expand Up @@ -58,22 +59,24 @@ open class DataModel(

private fun getPkgVersionName(pkg: String): String {
val pm = context.packageManager
return if (isAppInstalled.value == true) {
return try {
pm?.getPackageInfo(pkg, 0)?.versionName?.removeSuffix("-vanced") ?: context.getString(R.string.unavailable)
} else {
} catch (e: PackageManager.NameNotFoundException) {
context.getString(R.string.unavailable)
}
}

@Suppress("DEPRECATION")
private fun getPkgVersionCode(pkg: String): Int {
val pm = context.packageManager
return if (isAppInstalled.value == true) {
return try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
pm?.getPackageInfo(pkg, 0)?.longVersionCode?.and(0xFFFFFFFF)?.toInt() ?: 0
else
pm?.getPackageInfo(pkg, 0)?.versionCode ?: 0
} else 0
} catch (e: PackageManager.NameNotFoundException) {
0
}
}

private fun compareInt(int1: Int?, int2: Int?): String {
Expand Down
Loading

0 comments on commit 7f6d0b3

Please sign in to comment.