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 #418 from YTVanced/dev
Browse files Browse the repository at this point in the history
Update 2.5.0
  • Loading branch information
KevinX8 authored Feb 16, 2021
2 parents 7f6d0b3 + 6618445 commit dfdeb48
Show file tree
Hide file tree
Showing 93 changed files with 957 additions and 1,008 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ assignees: ''
**Please only report your issue here, if all points below are true**
- I installed the App from [vancedapp.com](https://vancedapp.com), this github repository or the Vanced Discord server
- I am using the latest version
- This is an issue in the Vanced Manager app (NOT Youtube Vanced)
- This is an issue in the Vanced Manager app (NOT Youtube Vanced/Music)
- This issue keeps re-occurring every time I try
- For MIUI users: I disabled MIUI optimisation
- For MIUI users: I disabled MIUI optimisations

**Phone Specifications:**
- Brand:
Expand Down
24 changes: 12 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
applicationId = "com.vanced.manager"
minSdkVersion(21)
targetSdkVersion(30)
versionCode = 240
versionName = "2.4.0 (java.lang.TrashManagerException)"
versionCode = 250
versionName = "2.5.0 (Weed)"

vectorDrawables.useSupportLibrary = true

Expand Down Expand Up @@ -90,27 +90,27 @@ dependencies {

implementation(project(":library-network"))

// Kotlin
// Kotlin
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))

// AndroidX
// AndroidX
implementation("androidx.appcompat:appcompat:1.2.0")
implementation("androidx.browser:browser:1.3.0")
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
implementation("androidx.core:core-ktx:1.3.2")
implementation("androidx.fragment:fragment-ktx:1.2.5")
implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.2.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0")
implementation("androidx.fragment:fragment-ktx:1.3.0")
implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.3.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0")
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.0.0")
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")

//Appearance
// Appearance
implementation("com.github.madrapps:pikolo:2.0.1")
implementation("com.google.android.material:material:1.3.0-rc01")
implementation("com.google.android.material:material:1.3.0")

// JSON parser
implementation("com.beust:klaxon:5.4")
Expand All @@ -128,8 +128,8 @@ dependencies {
implementation("com.squareup.okhttp3:logging-interceptor:4.9.1")

// Root permissions
implementation("com.github.topjohnwu.libsu:core:3.0.2")
implementation("com.github.topjohnwu.libsu:io:3.0.2")
implementation("com.github.topjohnwu.libsu:core:3.1.1")
implementation("com.github.topjohnwu.libsu:io:3.1.1")

// Layout
implementation("com.google.android:flexbox:2.0.1")
Expand All @@ -138,5 +138,5 @@ dependencies {
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")
implementation("com.google.firebase:firebase-perf:19.1.1")
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<activity
android:name=".ui.MainActivity"
android:configChanges="layoutDirection|locale"
android:configChanges="layoutDirection|locale|keyboardHidden|orientation|screenSize"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/DarkTheme">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ import com.vanced.manager.R
import com.vanced.manager.databinding.ViewSponsorBinding
import com.vanced.manager.model.SponsorModel
import com.vanced.manager.ui.viewmodels.HomeViewModel
import com.vanced.manager.utils.LIGHT
import com.vanced.manager.utils.currentTheme
import com.vanced.manager.utils.defPrefs
import com.vanced.manager.utils.managerTheme

class SponsorAdapter(
private val context: Context,
private val viewModel: HomeViewModel,
//private val json: ObservableField<JsonObject?>
private val viewModel: HomeViewModel
) : RecyclerView.Adapter<SponsorAdapter.LinkViewHolder>() {

private val brave = SponsorModel(
AppCompatResources.getDrawable(context, R.drawable.ic_brave),
if (currentTheme == LIGHT) AppCompatResources.getDrawable(context, R.drawable.ic_brave_light) else AppCompatResources.getDrawable(context, R.drawable.ic_brave),
"Brave",
BRAVE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package com.vanced.manager.core.downloader

import android.content.Context
import com.vanced.manager.R
import com.vanced.manager.utils.*
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.baseInstallUrl
import com.vanced.manager.utils.microg

object MicrogDownloader {

Expand All @@ -18,14 +16,14 @@ object MicrogDownloader {
download(url, "$baseInstallUrl/", folderName, fileName, context, onDownloadComplete = {
startMicrogInstall(context)
}, onError = {
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, fileName))
downloadingFile.postValue(context.getString(R.string.error_downloading, fileName))
})

}

fun startMicrogInstall(context: Context) {
downloadProgress.value?.installing?.postValue(true)
downloadProgress.value?.postReset()
installing.postValue(true)
postReset()
install("${context.getExternalFilesDir(folderName)}/$fileName", context)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.vanced.manager.utils.*
import com.vanced.manager.utils.AppUtils.musicRootPkg
import com.vanced.manager.utils.AppUtils.validateTheme
import com.vanced.manager.utils.DownloadHelper.download
import com.vanced.manager.utils.DownloadHelper.downloadProgress
import com.vanced.manager.utils.PackageHelper.downloadStockCheck
import com.vanced.manager.utils.PackageHelper.install
import com.vanced.manager.utils.PackageHelper.installMusicRoot
Expand Down Expand Up @@ -59,13 +58,13 @@ object MusicDownloader {
"stock" -> startMusicInstall(context)
}
}, onError = {
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
downloadingFile.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
})
}

fun startMusicInstall(context: Context) {
downloadProgress.value?.installing?.postValue(true)
downloadProgress.value?.postReset()
installing.postValue(true)
postReset()
if (variant == "root")
installMusicRoot(context)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ 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
import com.vanced.manager.utils.DownloadHelper.downloadProgress
import com.vanced.manager.utils.PackageHelper.downloadStockCheck
import com.vanced.manager.utils.PackageHelper.installVanced
import com.vanced.manager.utils.PackageHelper.installSplitApkFiles
import com.vanced.manager.utils.PackageHelper.installVancedRoot
import java.io.File

Expand Down Expand Up @@ -59,7 +58,7 @@ object VancedDownloader {
downloadSplits(context)
} catch (e: Exception) {
log("VMDownloader", e.stackTraceToString())
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, "Vanced"))
downloadingFile.postValue(context.getString(R.string.error_downloading, "Vanced"))
}

}
Expand Down Expand Up @@ -113,21 +112,21 @@ object VancedDownloader {
}

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

fun startVancedInstall(context: Context, variant: String? = this.variant) {
downloadProgress.value?.installing?.postValue(true)
downloadProgress.value?.postReset()
installing.postValue(true)
postReset()
FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event.SELECT_ITEM) {
variant?.let { param("vanced_variant", it) }
theme?.let { param("vanced_theme", it) }
}
if (variant == "root")
installVancedRoot(context)
else
installVanced(context)
installSplitApkFiles(context, "vanced")
}
}
30 changes: 0 additions & 30 deletions app/src/main/java/com/vanced/manager/model/ProgressModel.kt

This file was deleted.

60 changes: 40 additions & 20 deletions app/src/main/java/com/vanced/manager/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.vanced.manager.ui.dialogs.URLChangeDialog
import com.vanced.manager.ui.fragments.HomeFragmentDirections
import com.vanced.manager.ui.fragments.SettingsFragmentDirections
import com.vanced.manager.utils.*
import com.vanced.manager.utils.AppUtils.currentLocale
import com.vanced.manager.utils.AppUtils.faqpkg
import com.vanced.manager.utils.AppUtils.log
import com.vanced.manager.utils.AppUtils.playStorePkg
Expand Down Expand Up @@ -154,14 +155,29 @@ class MainActivity : AppCompatActivity() {
super.attachBaseContext(Crowdin.wrapContext(LanguageContextWrapper.wrap(newBase)))
}

//I have no idea why the fuck is super method deprecated
@Suppress("DEPRECATION")
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
onActivityResult(requestCode)
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
recreate() //restarting activity to recreate viewmodels, otherwise some text won't update

//update manager language when system language is changed
@Suppress("DEPRECATION")
if (newConfig.locale != currentLocale) {
recreate() //restarting activity in order to recreate viewmodels, otherwise some text won't update
return
}

when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> log("VMUI", "screen orientation changed to portrait")
Configuration.ORIENTATION_LANDSCAPE -> log("VMUI", "screen orientation changed to landscape")
else -> log("VMUI", "screen orientation changed to [REDACTED]")
}

}

override fun recreate() {
Expand All @@ -183,26 +199,30 @@ class MainActivity : AppCompatActivity() {
urldialog.show(this)
}

when {
firstLaunch -> {
DialogContainer.showSecurityDialog(this)
with(FirebaseMessaging.getInstance()) {
subscribeToTopic("Vanced-Update")
subscribeToTopic("Music-Update")
subscribeToTopic("MicroG-Update")
}
if (firstLaunch) {
DialogContainer.showSecurityDialog(this)
with(FirebaseMessaging.getInstance()) {
subscribeToTopic("Vanced-Update")
subscribeToTopic("Music-Update")
subscribeToTopic("MicroG-Update")
}
!prefs.getBoolean("statement", true) -> DialogContainer.statementFalse(this)
variant == "root" -> {
if (PackageHelper.getPackageVersionName(
"com.google.android.youtube",
packageManager
) == "14.21.54")
DialogContainer.basicDialog(
getString(R.string.hold_on),
getString(R.string.magisk_vanced),
this
)
} else {
if (isMiuiOptimizationsEnabled) {
DialogContainer.applyAccentMiuiDialog(this)
}
}

if (!prefs.getBoolean("statement", true)) {
DialogContainer.statementFalse(this)
}

if (variant == "root") {
if (PackageHelper.getPackageVersionName("com.google.android.youtube", packageManager) == "14.21.54") {
DialogContainer.basicDialog(
getString(R.string.hold_on),
getString(R.string.magisk_vanced),
this
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import com.vanced.manager.core.downloader.MusicDownloader.downloadMusic
import com.vanced.manager.core.downloader.VancedDownloader.downloadVanced
import com.vanced.manager.core.ui.base.BindingDialogFragment
import com.vanced.manager.databinding.DialogAppDownloadBinding
import com.vanced.manager.utils.DownloadHelper.downloadProgress
import com.vanced.manager.utils.applyAccent
import com.vanced.manager.utils.*

class AppDownloadDialog : BindingDialogFragment<DialogAppDownloadBinding>() {

Expand Down Expand Up @@ -82,30 +81,26 @@ class AppDownloadDialog : BindingDialogFragment<DialogAppDownloadBinding>() {
}

private fun DialogAppDownloadBinding.bindDownloadProgress() {
with(downloadProgress) {
observe(viewLifecycleOwner) { progressModel ->
progressModel.downloadProgress.observe(viewLifecycleOwner) {
appDownloadProgressbar.progress = it
}
progressModel.installing.observe(viewLifecycleOwner) { installing ->
appDownloadProgressbar.isVisible = !installing
appInstallProgressbar.isVisible = installing
appDownloadFile.isVisible = !installing
appDownloadCancel.isEnabled = !installing
appDownloadCancel.setOnClickListener {
if (installing) {
return@setOnClickListener
}
progressModel.currentDownload?.cancel()
progressModel.downloadProgress.value = 0
dismiss()
}
}
progressModel.downloadingFile.observe(viewLifecycleOwner) {
appDownloadFile.text = it
downloadProgress.observe(viewLifecycleOwner) {
appDownloadProgressbar.progress = it
}
installing.observe(viewLifecycleOwner) { installing ->
appDownloadProgressbar.isVisible = !installing
appInstallProgressbar.isVisible = installing
appDownloadFile.isVisible = !installing
appDownloadCancel.isEnabled = !installing
appDownloadCancel.setOnClickListener {
if (installing) {
return@setOnClickListener
}
currentDownload?.cancel()
downloadProgress.value = 0
dismiss()
}
}
downloadingFile.observe(viewLifecycleOwner) {
appDownloadFile.text = it
}
}

override fun onResume() {
Expand Down
Loading

0 comments on commit dfdeb48

Please sign in to comment.