Workaround stupid Moshi proguard rules

This commit is contained in:
topjohnwu 2019-08-07 22:25:39 -07:00
parent f5c3ee3ae1
commit 42ce6fd334
4 changed files with 7 additions and 7 deletions

View File

@ -69,8 +69,8 @@ abstract class RemoteFileService : NotificationService() {
supportedFolders.firstMap { it.find(subject.file.name) }.also { supportedFolders.firstMap { it.find(subject.file.name) }.also {
if (subject is Magisk) { if (subject is Magisk) {
if (!ShellUtils.checkSum("MD5", it, subject.magisk.hash)) { if (!ShellUtils.checkSum("MD5", it, subject.magisk.md5)) {
throw IllegalStateException("The given file doesn't match the hash") throw IllegalStateException("The given file doesn't match the md5")
} }
} }
} }

View File

@ -1,7 +1,6 @@
package com.topjohnwu.magisk.model.entity package com.topjohnwu.magisk.model.entity
import android.os.Parcelable import android.os.Parcelable
import com.squareup.moshi.Json
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import se.ansman.kotshi.JsonSerializable import se.ansman.kotshi.JsonSerializable
@ -23,7 +22,7 @@ data class MagiskJson(
val versionCode: Int = -1, val versionCode: Int = -1,
val link: String = "", val link: String = "",
val note: String = "", val note: String = "",
@Json(name = "md5") val hash: String = "" val md5: String = ""
) )
@Parcelize @Parcelize

View File

@ -1,6 +1,5 @@
package com.topjohnwu.magisk.tasks package com.topjohnwu.magisk.tasks
import com.squareup.moshi.Json
import com.topjohnwu.magisk.Const import com.topjohnwu.magisk.Const
import com.topjohnwu.magisk.data.database.RepoDao import com.topjohnwu.magisk.data.database.RepoDao
import com.topjohnwu.magisk.data.network.GithubApiServices import com.topjohnwu.magisk.data.network.GithubApiServices
@ -89,9 +88,11 @@ private val dateFormat: SimpleDateFormat =
@JsonSerializable @JsonSerializable
data class GithubRepoInfo( data class GithubRepoInfo(
@Json(name = "name") val id: String, val name: String,
val pushed_at: String val pushed_at: String
) { ) {
val id get() = name
@Transient @Transient
val pushDate = dateFormat.parse(pushed_at)!! val pushDate = dateFormat.parse(pushed_at)!!
} }

View File

@ -32,7 +32,7 @@ class EnvFixDialog(activity: Activity) : CustomAlertDialog(activity) {
installDir = SuFile("/data/adb/magisk") installDir = SuFile("/data/adb/magisk")
Shell.su("rm -rf /data/adb/magisk/*").exec() Shell.su("rm -rf /data/adb/magisk/*").exec()
val zip : File = activity.cachedFile("magisk.zip") val zip : File = activity.cachedFile("magisk.zip")
if (!ShellUtils.checkSum("MD5", zip, Info.remote.magisk.hash)) if (!ShellUtils.checkSum("MD5", zip, Info.remote.magisk.md5))
Networking.get(Info.remote.magisk.link).execForFile(zip) Networking.get(Info.remote.magisk.link).execForFile(zip)
zipUri = zip.toUri() zipUri = zip.toUri()
return extractZip() && Shell.su("fix_env").exec().isSuccess return extractZip() && Shell.su("fix_env").exec().isSuccess