Refactor constant variable names
This commit is contained in:
parent
7c693fb5e8
commit
5ad4779149
2 changed files with 11 additions and 11 deletions
|
|
@ -14,11 +14,11 @@ class DownloadManager(
|
|||
private val downloadManager = context.getSystemService<DownloadManager>()!!
|
||||
|
||||
suspend fun downloadDiscordApk(version: String): File {
|
||||
return download("$backendHost/download/discord?v=$version", "base-$version.apk")
|
||||
return download("$BACKEND_HOST/download/discord?v=$version", "base-$version.apk")
|
||||
}
|
||||
|
||||
suspend fun downloadSplit(version: String, split: String): File {
|
||||
return download("$backendHost/download/discord?v=$version&split=$split", "$split-$version.apk")
|
||||
return download("$BACKEND_HOST/download/discord?v=$version&split=$split", "$split-$version.apk")
|
||||
}
|
||||
|
||||
private suspend fun download(url: String, fileName: String): File {
|
||||
|
|
@ -47,6 +47,6 @@ class DownloadManager(
|
|||
}
|
||||
|
||||
companion object {
|
||||
private const val backendHost = "https://aliucord.com/"
|
||||
private const val BACKEND_HOST = "https://aliucord.com/"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,25 +13,25 @@ class GithubService(
|
|||
private val httpClient: HttpClient
|
||||
) {
|
||||
suspend fun getCommits(page: Int): List<Commit> = withContext(Dispatchers.IO) {
|
||||
httpClient.get(commitsUrl) {
|
||||
httpClient.get(COMMITS_URL) {
|
||||
parameter("page", page)
|
||||
}.body()
|
||||
}
|
||||
|
||||
suspend fun getVersion(): String = withContext(Dispatchers.IO) {
|
||||
httpClient.get(dataUrl).bodyAsText()
|
||||
httpClient.get(DATA_URL).bodyAsText()
|
||||
}
|
||||
|
||||
suspend fun getContributors(): List<GithubUser> = withContext(Dispatchers.IO) {
|
||||
httpClient.get(contributorsUrl).body()
|
||||
httpClient.get(CONTRIBUTORS_URL).body()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val org = "Aliucord"
|
||||
private const val repo = "Aliucord"
|
||||
private const val ORG = "Aliucord"
|
||||
private const val REPO = "Aliucord"
|
||||
|
||||
private const val commitsUrl = "https://api.github.com/repos/$org/$repo/commits"
|
||||
private const val contributorsUrl = "https://api.github.com/repos/$org/$repo/contributors"
|
||||
private const val dataUrl = "https://raw.githubusercontent.com/$org/$repo/builds/data.json"
|
||||
private const val COMMITS_URL = "https://api.github.com/repos/$ORG/$REPO/commits"
|
||||
private const val CONTRIBUTORS_URL = "https://api.github.com/repos/$ORG/$REPO/contributors"
|
||||
private const val DATA_URL = "https://raw.githubusercontent.com/$ORG/$REPO/builds/data.json"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue