From dbd13a2019de983fcf29641a142b949581515de4 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Sat, 23 Jan 2021 18:10:26 -0800 Subject: [PATCH] Clean code --- .../main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt | 6 ------ .../com/topjohnwu/magisk/data/repository/NetworkService.kt | 2 -- .../com/topjohnwu/magisk/events/dialog/UninstallDialog.kt | 5 +---- app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt | 2 +- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt b/app/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt index b45d68816..d4ff44455 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/model/UpdateInfo.kt @@ -7,16 +7,10 @@ import kotlinx.parcelize.Parcelize @JsonClass(generateAdapter = true) data class UpdateInfo( val app: ManagerJson = ManagerJson(), - val uninstaller: UninstallerJson = UninstallerJson(), val magisk: MagiskJson = MagiskJson(), val stub: StubJson = StubJson() ) -@JsonClass(generateAdapter = true) -data class UninstallerJson( - val link: String = "" -) - @JsonClass(generateAdapter = true) data class MagiskJson( val version: String = "", diff --git a/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt b/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt index d381febaf..c04e8736c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt +++ b/app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt @@ -50,13 +50,11 @@ class NetworkService( fun ManagerJson.updateCopy() = copy(link = genCDNUrl(link), note = genCDNUrl(note)) fun MagiskJson.updateCopy() = copy(link = genCDNUrl(link), note = genCDNUrl(note)) fun StubJson.updateCopy() = copy(link = genCDNUrl(link)) - fun UninstallerJson.updateCopy() = copy(link = genCDNUrl(link)) return info.copy( app = info.app.updateCopy(), magisk = info.magisk.updateCopy(), stub = info.stub.updateCopy(), - uninstaller = info.uninstaller.updateCopy() ) } diff --git a/app/src/main/java/com/topjohnwu/magisk/events/dialog/UninstallDialog.kt b/app/src/main/java/com/topjohnwu/magisk/events/dialog/UninstallDialog.kt index 7eeb01a69..62bdfacaa 100644 --- a/app/src/main/java/com/topjohnwu/magisk/events/dialog/UninstallDialog.kt +++ b/app/src/main/java/com/topjohnwu/magisk/events/dialog/UninstallDialog.kt @@ -3,7 +3,6 @@ package com.topjohnwu.magisk.events.dialog import android.app.ProgressDialog import android.widget.Toast import com.topjohnwu.magisk.R -import com.topjohnwu.magisk.core.Info import com.topjohnwu.magisk.ui.flash.FlashFragment import com.topjohnwu.magisk.utils.Utils import com.topjohnwu.magisk.view.MagiskDialog @@ -18,12 +17,10 @@ class UninstallDialog : DialogEvent() { titleRes = R.string.restore_img onClick { restore() } } - if (Info.remote.uninstaller.link.isNotEmpty()) { - dialog.applyButton(MagiskDialog.ButtonType.NEGATIVE) { + .applyButton(MagiskDialog.ButtonType.NEGATIVE) { titleRes = R.string.complete_uninstall onClick { completeUninstall() } } - } } @Suppress("DEPRECATION") diff --git a/app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt b/app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt index d8ba1edec..5e9dedc70 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt @@ -45,8 +45,8 @@ import androidx.interpolator.view.animation.FastOutSlowInInterpolator import androidx.transition.AutoTransition import androidx.transition.TransitionManager import com.topjohnwu.magisk.R -import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.AssetHack +import com.topjohnwu.magisk.core.Const import com.topjohnwu.magisk.core.utils.currentLocale import com.topjohnwu.magisk.utils.DynamicClassLoader import com.topjohnwu.magisk.utils.Utils