Skip to content

Commit

Permalink
ReVancedUpdater: Move most variables inside the MainActivity class
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Ledda <leonardoledda@gmail.com>
  • Loading branch information
LeddaZ committed Feb 11, 2024
1 parent 4ab9ebf commit a201964
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ android {
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core.ktx)
implementation(libs.android.volley)
implementation(libs.material)
implementation(libs.gson)
Expand Down
33 changes: 17 additions & 16 deletions app/src/main/java/it/leddaz/revancedupdater/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,8 @@ import java.io.File
import java.io.FileInputStream
import kotlin.concurrent.thread


private var installedReVancedVersion = Version("99.99")
private var latestReVancedVersion = Version("0.0")
private var latestReVancedHash = ""
private var installedReVancedMusicVersion = Version("99.99")
private var latestReVancedMusicVersion = Version("0.0")
private var latestReVancedMusicHash = ""
private var installedUpdaterVersion = Version("99.99")
private var installedMicroGVersion = Version("99.99")
private var latestUpdaterVersion = Version("0.0")
private var latestUpdaterCommit = ""
private var latestMicroGVersion = Version("0.0")
private var updaterDownloadUrl = ""
private var downloadUrl = ""
private var musicDownloadUrl = ""
var microGDownloadUrl = ""

/**
* The app's main activity, started at launch.
Expand All @@ -70,6 +56,20 @@ var microGDownloadUrl = ""
*/
class MainActivity : AppCompatActivity() {

private var installedReVancedVersion = Version("99.99")
private var latestReVancedVersion = Version("0.0")
private var reVancedDownloadUrl = ""
private var installedReVancedMusicVersion = Version("99.99")
private var latestReVancedMusicVersion = Version("0.0")
private var musicDownloadUrl = ""
private var installedUpdaterVersion = Version("99.99")
private var latestUpdaterVersion = Version("0.0")
private var latestUpdaterCommit = ""
private var updaterDownloadUrl = ""
private var installedMicroGVersion = Version("99.99")
private var latestMicroGVersion = Version("0.0")
private var microGDownloadUrl = ""

/**
* Actions executed when the activity is created at runtime.
* @property savedInstanceState
Expand Down Expand Up @@ -218,7 +218,7 @@ class MainActivity : AppCompatActivity() {
latestReVancedVersion = Version(reVancedReply.latestReVancedVersion)
latestReVancedHash = reVancedReply.latestReVancedHash
latestReVancedMusicVersion = Version(reVancedReply.latestReVancedMusicVersion)
downloadUrl =
reVancedDownloadUrl =
urlPrefix + reVancedReply.latestReVancedDate + "-yt/yt-signed.apk"
val preferredABI: String = Build.SUPPORTED_ABIS[0]
Log.i(LOG_TAG, "Preferred ABI: $preferredABI")
Expand Down Expand Up @@ -311,7 +311,7 @@ class MainActivity : AppCompatActivity() {
*/
fun downloadReVanced(view: View) {
view.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK)
dlAndInstall("revanced-nonroot-signed.apk", downloadUrl, this)
dlAndInstall("revanced-nonroot-signed.apk", reVancedDownloadUrl, this)
}

/**
Expand Down Expand Up @@ -531,6 +531,7 @@ class MainActivity : AppCompatActivity() {
* Companion object
*/
companion object {

/**
* Returns the latest ReVanced hash.
* @return Latest ReVanced hash.
Expand Down

0 comments on commit a201964

Please sign in to comment.