You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Use new service to download uninstall.zip
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
package com.topjohnwu.magisk.model.download
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.webkit.MimeTypeMap
|
||||
import androidx.annotation.RequiresPermission
|
||||
import androidx.core.app.NotificationCompat
|
||||
import com.topjohnwu.magisk.ClassMap
|
||||
import com.topjohnwu.magisk.R
|
||||
@@ -115,7 +113,6 @@ open class DownloadService : RemoteFileService() {
|
||||
|
||||
companion object {
|
||||
|
||||
@RequiresPermission(allOf = [Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE])
|
||||
inline operator fun invoke(context: Context, argBuilder: Builder.() -> Unit) {
|
||||
val builder = Builder().apply(argBuilder)
|
||||
val intent = Intent(context, ClassMap[DownloadService::class.java])
|
||||
|
||||
@@ -49,6 +49,17 @@ sealed class DownloadSubject : Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
protected class Uninstall : Magisk() {
|
||||
override val configuration: Configuration get() = Configuration.Uninstall
|
||||
override val url: String get() = Info.remote.uninstaller.link
|
||||
|
||||
@IgnoredOnParcel
|
||||
override val file by lazy {
|
||||
get<Context>().cachedFile("uninstall.zip")
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
protected class Download : Magisk() {
|
||||
override val configuration: Configuration get() = Configuration.Download
|
||||
@@ -63,6 +74,7 @@ sealed class DownloadSubject : Parcelable {
|
||||
companion object {
|
||||
operator fun invoke(configuration: Configuration) = when (configuration) {
|
||||
Configuration.Download -> Download()
|
||||
Configuration.Uninstall -> Uninstall()
|
||||
else -> Flash(configuration)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user