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

Commit dfdeb48

Browse files
authored
Merge pull request #418 from YTVanced/dev
Update 2.5.0
2 parents 7f6d0b3 + 6618445 commit dfdeb48

File tree

93 files changed

+957
-1008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+957
-1008
lines changed

.github/ISSUE_TEMPLATE/bug-issue-template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ assignees: ''
1010
**Please only report your issue here, if all points below are true**
1111
- I installed the App from [vancedapp.com](https://vancedapp.com), this github repository or the Vanced Discord server
1212
- I am using the latest version
13-
- This is an issue in the Vanced Manager app (NOT Youtube Vanced)
13+
- This is an issue in the Vanced Manager app (NOT Youtube Vanced/Music)
1414
- This issue keeps re-occurring every time I try
15-
- For MIUI users: I disabled MIUI optimisation
15+
- For MIUI users: I disabled MIUI optimisations
1616

1717
**Phone Specifications:**
1818
- Brand:

app/build.gradle.kts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ android {
1616
applicationId = "com.vanced.manager"
1717
minSdkVersion(21)
1818
targetSdkVersion(30)
19-
versionCode = 240
20-
versionName = "2.4.0 (java.lang.TrashManagerException)"
19+
versionCode = 250
20+
versionName = "2.5.0 (Weed)"
2121

2222
vectorDrawables.useSupportLibrary = true
2323

@@ -90,27 +90,27 @@ dependencies {
9090

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

93-
// Kotlin
93+
// Kotlin
9494
implementation(kotlin("stdlib-jdk8"))
9595
implementation(kotlin("reflect"))
9696

97-
// AndroidX
97+
// AndroidX
9898
implementation("androidx.appcompat:appcompat:1.2.0")
9999
implementation("androidx.browser:browser:1.3.0")
100100
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
101101
implementation("androidx.core:core-ktx:1.3.2")
102-
implementation("androidx.fragment:fragment-ktx:1.2.5")
103-
implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.2.0")
104-
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0")
102+
implementation("androidx.fragment:fragment-ktx:1.3.0")
103+
implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.3.0")
104+
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0")
105105
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.0.0")
106106
implementation("androidx.navigation:navigation-fragment-ktx:2.3.3")
107107
implementation("androidx.navigation:navigation-ui-ktx:2.3.3")
108108
implementation("androidx.preference:preference-ktx:1.1.1")
109109
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
110110

111-
//Appearance
111+
// Appearance
112112
implementation("com.github.madrapps:pikolo:2.0.1")
113-
implementation("com.google.android.material:material:1.3.0-rc01")
113+
implementation("com.google.android.material:material:1.3.0")
114114

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

130130
// Root permissions
131-
implementation("com.github.topjohnwu.libsu:core:3.0.2")
132-
implementation("com.github.topjohnwu.libsu:io:3.0.2")
131+
implementation("com.github.topjohnwu.libsu:core:3.1.1")
132+
implementation("com.github.topjohnwu.libsu:io:3.1.1")
133133

134134
// Layout
135135
implementation("com.google.android:flexbox:2.0.1")
@@ -138,5 +138,5 @@ dependencies {
138138
implementation("com.google.firebase:firebase-analytics-ktx:18.0.2")
139139
implementation("com.google.firebase:firebase-crashlytics:17.3.1")
140140
implementation("com.google.firebase:firebase-messaging:21.0.1")
141-
implementation("com.google.firebase:firebase-perf:19.1.0")
141+
implementation("com.google.firebase:firebase-perf:19.1.1")
142142
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<activity
5858
android:name=".ui.MainActivity"
59-
android:configChanges="layoutDirection|locale"
59+
android:configChanges="layoutDirection|locale|keyboardHidden|orientation|screenSize"
6060
android:exported="true"
6161
android:label="@string/app_name"
6262
android:theme="@style/DarkTheme">

app/src/main/java/com/vanced/manager/adapter/SponsorAdapter.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ import com.vanced.manager.R
99
import com.vanced.manager.databinding.ViewSponsorBinding
1010
import com.vanced.manager.model.SponsorModel
1111
import com.vanced.manager.ui.viewmodels.HomeViewModel
12+
import com.vanced.manager.utils.LIGHT
13+
import com.vanced.manager.utils.currentTheme
14+
import com.vanced.manager.utils.defPrefs
15+
import com.vanced.manager.utils.managerTheme
1216

1317
class SponsorAdapter(
1418
private val context: Context,
15-
private val viewModel: HomeViewModel,
16-
//private val json: ObservableField<JsonObject?>
19+
private val viewModel: HomeViewModel
1720
) : RecyclerView.Adapter<SponsorAdapter.LinkViewHolder>() {
1821

1922
private val brave = SponsorModel(
20-
AppCompatResources.getDrawable(context, R.drawable.ic_brave),
23+
if (currentTheme == LIGHT) AppCompatResources.getDrawable(context, R.drawable.ic_brave_light) else AppCompatResources.getDrawable(context, R.drawable.ic_brave),
2124
"Brave",
2225
BRAVE
2326
)

app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloader.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ package com.vanced.manager.core.downloader
22

33
import android.content.Context
44
import com.vanced.manager.R
5+
import com.vanced.manager.utils.*
56
import com.vanced.manager.utils.DownloadHelper.download
6-
import com.vanced.manager.utils.DownloadHelper.downloadProgress
77
import com.vanced.manager.utils.PackageHelper.install
8-
import com.vanced.manager.utils.baseInstallUrl
9-
import com.vanced.manager.utils.microg
108

119
object MicrogDownloader {
1210

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

2422
}
2523

2624
fun startMicrogInstall(context: Context) {
27-
downloadProgress.value?.installing?.postValue(true)
28-
downloadProgress.value?.postReset()
25+
installing.postValue(true)
26+
postReset()
2927
install("${context.getExternalFilesDir(folderName)}/$fileName", context)
3028
}
3129
}

app/src/main/java/com/vanced/manager/core/downloader/MusicDownloader.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import com.vanced.manager.utils.*
66
import com.vanced.manager.utils.AppUtils.musicRootPkg
77
import com.vanced.manager.utils.AppUtils.validateTheme
88
import com.vanced.manager.utils.DownloadHelper.download
9-
import com.vanced.manager.utils.DownloadHelper.downloadProgress
109
import com.vanced.manager.utils.PackageHelper.downloadStockCheck
1110
import com.vanced.manager.utils.PackageHelper.install
1211
import com.vanced.manager.utils.PackageHelper.installMusicRoot
@@ -59,13 +58,13 @@ object MusicDownloader {
5958
"stock" -> startMusicInstall(context)
6059
}
6160
}, onError = {
62-
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
61+
downloadingFile.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
6362
})
6463
}
6564

6665
fun startMusicInstall(context: Context) {
67-
downloadProgress.value?.installing?.postValue(true)
68-
downloadProgress.value?.postReset()
66+
installing.postValue(true)
67+
postReset()
6968
if (variant == "root")
7069
installMusicRoot(context)
7170
else

app/src/main/java/com/vanced/manager/core/downloader/VancedDownloader.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import com.vanced.manager.utils.AppUtils.log
1010
import com.vanced.manager.utils.AppUtils.validateTheme
1111
import com.vanced.manager.utils.AppUtils.vancedRootPkg
1212
import com.vanced.manager.utils.DownloadHelper.download
13-
import com.vanced.manager.utils.DownloadHelper.downloadProgress
1413
import com.vanced.manager.utils.PackageHelper.downloadStockCheck
15-
import com.vanced.manager.utils.PackageHelper.installVanced
14+
import com.vanced.manager.utils.PackageHelper.installSplitApkFiles
1615
import com.vanced.manager.utils.PackageHelper.installVancedRoot
1716
import java.io.File
1817

@@ -59,7 +58,7 @@ object VancedDownloader {
5958
downloadSplits(context)
6059
} catch (e: Exception) {
6160
log("VMDownloader", e.stackTraceToString())
62-
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, "Vanced"))
61+
downloadingFile.postValue(context.getString(R.string.error_downloading, "Vanced"))
6362
}
6463

6564
}
@@ -113,21 +112,21 @@ object VancedDownloader {
113112
}
114113

115114
} else {
116-
downloadProgress.value?.downloadingFile?.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
115+
downloadingFile.postValue(context.getString(R.string.error_downloading, getFileNameFromUrl(url)))
117116
}
118117
})
119118
}
120119

121120
fun startVancedInstall(context: Context, variant: String? = this.variant) {
122-
downloadProgress.value?.installing?.postValue(true)
123-
downloadProgress.value?.postReset()
121+
installing.postValue(true)
122+
postReset()
124123
FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event.SELECT_ITEM) {
125124
variant?.let { param("vanced_variant", it) }
126125
theme?.let { param("vanced_theme", it) }
127126
}
128127
if (variant == "root")
129128
installVancedRoot(context)
130129
else
131-
installVanced(context)
130+
installSplitApkFiles(context, "vanced")
132131
}
133132
}

app/src/main/java/com/vanced/manager/model/ProgressModel.kt

Lines changed: 0 additions & 30 deletions
This file was deleted.

app/src/main/java/com/vanced/manager/ui/MainActivity.kt

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.vanced.manager.ui.dialogs.URLChangeDialog
2828
import com.vanced.manager.ui.fragments.HomeFragmentDirections
2929
import com.vanced.manager.ui.fragments.SettingsFragmentDirections
3030
import com.vanced.manager.utils.*
31+
import com.vanced.manager.utils.AppUtils.currentLocale
3132
import com.vanced.manager.utils.AppUtils.faqpkg
3233
import com.vanced.manager.utils.AppUtils.log
3334
import com.vanced.manager.utils.AppUtils.playStorePkg
@@ -154,14 +155,29 @@ class MainActivity : AppCompatActivity() {
154155
super.attachBaseContext(Crowdin.wrapContext(LanguageContextWrapper.wrap(newBase)))
155156
}
156157

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

162165
override fun onConfigurationChanged(newConfig: Configuration) {
163166
super.onConfigurationChanged(newConfig)
164-
recreate() //restarting activity to recreate viewmodels, otherwise some text won't update
167+
168+
//update manager language when system language is changed
169+
@Suppress("DEPRECATION")
170+
if (newConfig.locale != currentLocale) {
171+
recreate() //restarting activity in order to recreate viewmodels, otherwise some text won't update
172+
return
173+
}
174+
175+
when (newConfig.orientation) {
176+
Configuration.ORIENTATION_PORTRAIT -> log("VMUI", "screen orientation changed to portrait")
177+
Configuration.ORIENTATION_LANDSCAPE -> log("VMUI", "screen orientation changed to landscape")
178+
else -> log("VMUI", "screen orientation changed to [REDACTED]")
179+
}
180+
165181
}
166182

167183
override fun recreate() {
@@ -183,26 +199,30 @@ class MainActivity : AppCompatActivity() {
183199
urldialog.show(this)
184200
}
185201

186-
when {
187-
firstLaunch -> {
188-
DialogContainer.showSecurityDialog(this)
189-
with(FirebaseMessaging.getInstance()) {
190-
subscribeToTopic("Vanced-Update")
191-
subscribeToTopic("Music-Update")
192-
subscribeToTopic("MicroG-Update")
193-
}
202+
if (firstLaunch) {
203+
DialogContainer.showSecurityDialog(this)
204+
with(FirebaseMessaging.getInstance()) {
205+
subscribeToTopic("Vanced-Update")
206+
subscribeToTopic("Music-Update")
207+
subscribeToTopic("MicroG-Update")
194208
}
195-
!prefs.getBoolean("statement", true) -> DialogContainer.statementFalse(this)
196-
variant == "root" -> {
197-
if (PackageHelper.getPackageVersionName(
198-
"com.google.android.youtube",
199-
packageManager
200-
) == "14.21.54")
201-
DialogContainer.basicDialog(
202-
getString(R.string.hold_on),
203-
getString(R.string.magisk_vanced),
204-
this
205-
)
209+
} else {
210+
if (isMiuiOptimizationsEnabled) {
211+
DialogContainer.applyAccentMiuiDialog(this)
212+
}
213+
}
214+
215+
if (!prefs.getBoolean("statement", true)) {
216+
DialogContainer.statementFalse(this)
217+
}
218+
219+
if (variant == "root") {
220+
if (PackageHelper.getPackageVersionName("com.google.android.youtube", packageManager) == "14.21.54") {
221+
DialogContainer.basicDialog(
222+
getString(R.string.hold_on),
223+
getString(R.string.magisk_vanced),
224+
this
225+
)
206226
}
207227
}
208228
}

app/src/main/java/com/vanced/manager/ui/dialogs/AppDownloadDialog.kt

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import com.vanced.manager.core.downloader.MusicDownloader.downloadMusic
1717
import com.vanced.manager.core.downloader.VancedDownloader.downloadVanced
1818
import com.vanced.manager.core.ui.base.BindingDialogFragment
1919
import com.vanced.manager.databinding.DialogAppDownloadBinding
20-
import com.vanced.manager.utils.DownloadHelper.downloadProgress
21-
import com.vanced.manager.utils.applyAccent
20+
import com.vanced.manager.utils.*
2221

2322
class AppDownloadDialog : BindingDialogFragment<DialogAppDownloadBinding>() {
2423

@@ -82,30 +81,26 @@ class AppDownloadDialog : BindingDialogFragment<DialogAppDownloadBinding>() {
8281
}
8382

8483
private fun DialogAppDownloadBinding.bindDownloadProgress() {
85-
with(downloadProgress) {
86-
observe(viewLifecycleOwner) { progressModel ->
87-
progressModel.downloadProgress.observe(viewLifecycleOwner) {
88-
appDownloadProgressbar.progress = it
89-
}
90-
progressModel.installing.observe(viewLifecycleOwner) { installing ->
91-
appDownloadProgressbar.isVisible = !installing
92-
appInstallProgressbar.isVisible = installing
93-
appDownloadFile.isVisible = !installing
94-
appDownloadCancel.isEnabled = !installing
95-
appDownloadCancel.setOnClickListener {
96-
if (installing) {
97-
return@setOnClickListener
98-
}
99-
progressModel.currentDownload?.cancel()
100-
progressModel.downloadProgress.value = 0
101-
dismiss()
102-
}
103-
}
104-
progressModel.downloadingFile.observe(viewLifecycleOwner) {
105-
appDownloadFile.text = it
84+
downloadProgress.observe(viewLifecycleOwner) {
85+
appDownloadProgressbar.progress = it
86+
}
87+
installing.observe(viewLifecycleOwner) { installing ->
88+
appDownloadProgressbar.isVisible = !installing
89+
appInstallProgressbar.isVisible = installing
90+
appDownloadFile.isVisible = !installing
91+
appDownloadCancel.isEnabled = !installing
92+
appDownloadCancel.setOnClickListener {
93+
if (installing) {
94+
return@setOnClickListener
10695
}
96+
currentDownload?.cancel()
97+
downloadProgress.value = 0
98+
dismiss()
10799
}
108100
}
101+
downloadingFile.observe(viewLifecycleOwner) {
102+
appDownloadFile.text = it
103+
}
109104
}
110105

111106
override fun onResume() {

0 commit comments

Comments
 (0)