Skip to content

Commit

Permalink
ReVancedUpdater: Rename some MicroG references to GmsCore
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Ledda <leonardoledda@gmail.com>
  • Loading branch information
LeddaZ committed Apr 8, 2024
1 parent 35f71b5 commit d909629
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions app/src/main/java/it/leddaz/revancedupdater/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.google.gson.reflect.TypeToken
import it.leddaz.revancedupdater.dialogs.AboutDialog
import it.leddaz.revancedupdater.utils.apputils.AppInstaller
import it.leddaz.revancedupdater.utils.apputils.Downloader
import it.leddaz.revancedupdater.utils.json.MicroGJSONObject
import it.leddaz.revancedupdater.utils.json.GmsCoreJSONObject
import it.leddaz.revancedupdater.utils.json.ReVancedJSONObject
import it.leddaz.revancedupdater.utils.json.UpdaterDebugJSONObject
import it.leddaz.revancedupdater.utils.json.UpdaterReleaseJSONObject
Expand Down Expand Up @@ -69,9 +69,9 @@ class MainActivity : AppCompatActivity() {
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 = ""
private var installedGmsCoreVersion = Version("99.99")
private var latestGmsCoreVersion = Version("0.0")
private var gmsCoreDownloadUrl = ""

/**
* Actions executed when the activity is created at runtime.
Expand Down Expand Up @@ -104,7 +104,7 @@ class MainActivity : AppCompatActivity() {
val microGCard = findViewById<MaterialCardView>(R.id.microg_info_card)
microGCard.setOnLongClickListener {
openLink(
"https://github.com/WSTxda/MicroG-RE/releases/tag/${latestMicroGVersion}",
"https://github.com/WSTxda/MicroG-RE/releases/tag/${latestGmsCoreVersion}",
this
)
true
Expand Down Expand Up @@ -160,7 +160,7 @@ class MainActivity : AppCompatActivity() {
getAppVersion(
GMSCORE_PACKAGE,
findViewById(R.id.installed_microg_version),
installedMicroGVersion,
installedGmsCoreVersion,
findViewById(R.id.microg_download_button)
)

Expand Down Expand Up @@ -193,11 +193,11 @@ class MainActivity : AppCompatActivity() {
"https://raw.githubusercontent.com/LeddaZ/revanced-repo/main/updater.json"
val updaterAPIUrl = "https://api.github.com/repos/LeddaZ/ReVancedUpdater/releases/latest"
val updaterCommitUrl = "https://api.github.com/repos/LeddaZ/ReVancedUpdater/commits/master"
val microGAPIUrl = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
val gmsCoreAPIUrl = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest"
var reVancedReply: ReVancedJSONObject
var updaterReleaseReply: UpdaterReleaseJSONObject
var updaterDebugReply: UpdaterDebugJSONObject
var microGReply: MicroGJSONObject
var gmsCoreReply: GmsCoreJSONObject

val urlPrefix = "https://github.com/LeddaZ/revanced-repo/releases/download/"

Expand Down Expand Up @@ -240,19 +240,19 @@ class MainActivity : AppCompatActivity() {
callback.onSuccess()
}, {})

val microGRequest = StringRequest(GET, microGAPIUrl, { response ->
microGReply =
Gson().fromJson(response, object : TypeToken<MicroGJSONObject>() {}.type)
latestMicroGVersion = Version(microGReply.latestMicroGVersion.substring(1))
microGDownloadUrl = if (isHmsInstalled(this) && !isGmsInstalled(this))
microGReply.assets[0].latestMicroGUrl
val gmsCoreRequest = StringRequest(GET, gmsCoreAPIUrl, { response ->
gmsCoreReply =
Gson().fromJson(response, object : TypeToken<GmsCoreJSONObject>() {}.type)
latestGmsCoreVersion = Version(gmsCoreReply.latestMicroGVersion.substring(1))
gmsCoreDownloadUrl = if (isHmsInstalled(this) && !isGmsInstalled(this))
gmsCoreReply.assets[0].latestMicroGUrl
else
microGReply.assets[1].latestMicroGUrl
gmsCoreReply.assets[1].latestMicroGUrl
callback.onSuccess()
}, {})

queue.add(reVancedRequest)
queue.add(microGRequest)
queue.add(gmsCoreRequest)
if (IS_DEBUG)
queue.add(updaterDevRequest)
else
Expand All @@ -265,8 +265,8 @@ class MainActivity : AppCompatActivity() {
*/
private fun compareVersions() {
compareAppVersion(
GMSCORE_PACKAGE, installedMicroGVersion,
latestMicroGVersion, findViewById(R.id.microg_update_status),
GMSCORE_PACKAGE, installedGmsCoreVersion,
latestGmsCoreVersion, findViewById(R.id.microg_update_status),
findViewById(R.id.microg_download_button)
)
if (isGmsCoreInstalled(this)) {
Expand Down Expand Up @@ -318,7 +318,7 @@ class MainActivity : AppCompatActivity() {
*/
fun downloadMicroG(view: View) {
view.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK)
dlAndInstall("microg.apk", microGDownloadUrl, this)
dlAndInstall("microg.apk", gmsCoreDownloadUrl, this)
}

/**
Expand Down Expand Up @@ -500,7 +500,7 @@ class MainActivity : AppCompatActivity() {
val latestMicroGTextView: TextView =
findViewById(R.id.latest_microg_version)
latestMicroGTextView.text =
getString(R.string.latest_app_version, latestMicroGVersion)
getString(R.string.latest_app_version, latestGmsCoreVersion)

val latestAppTextView: TextView = findViewById(R.id.latest_updater_version)
if (!IS_DEBUG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package it.leddaz.revancedupdater.utils.json

import com.google.gson.annotations.SerializedName

data class MicroGJSONObject(
data class GmsCoreJSONObject(
@SerializedName("tag_name")
val latestMicroGVersion: String,

Expand Down

0 comments on commit d909629

Please sign in to comment.