Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
bf9ac825
Commit
bf9ac825
authored
Jun 16, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup UpdateInfo
parent
4a3f5dc6
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
79 additions
and
110 deletions
+79
-110
Info.java
app/src/main/java/com/topjohnwu/magisk/Info.java
+8
-14
GithubRawApiServices.kt
...com/topjohnwu/magisk/data/network/GithubRawApiServices.kt
+6
-6
MagiskRepository.kt
.../com/topjohnwu/magisk/data/repository/MagiskRepository.kt
+2
-15
MagiskApp.kt
.../main/java/com/topjohnwu/magisk/model/entity/MagiskApp.kt
+0
-11
MagiskConfig.kt
...in/java/com/topjohnwu/magisk/model/entity/MagiskConfig.kt
+0
-10
MagiskFlashable.kt
...java/com/topjohnwu/magisk/model/entity/MagiskFlashable.kt
+0
-13
MagiskLink.kt
...main/java/com/topjohnwu/magisk/model/entity/MagiskLink.kt
+0
-8
UpdateInfo.kt
...main/java/com/topjohnwu/magisk/model/entity/UpdateInfo.kt
+33
-0
GeneralReceiver.kt
...va/com/topjohnwu/magisk/model/receiver/GeneralReceiver.kt
+2
-1
UpdateCheckService.kt
...a/com/topjohnwu/magisk/model/update/UpdateCheckService.kt
+2
-2
MagiskInstaller.java
...main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java
+2
-2
HomeFragment.kt
...rc/main/java/com/topjohnwu/magisk/ui/home/HomeFragment.kt
+1
-1
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+4
-4
DownloadApp.java
...src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java
+2
-2
Notifications.java
...rc/main/java/com/topjohnwu/magisk/view/Notifications.java
+2
-2
InstallMethodDialog.kt
.../com/topjohnwu/magisk/view/dialogs/InstallMethodDialog.kt
+3
-3
MagiskInstallDialog.kt
.../com/topjohnwu/magisk/view/dialogs/MagiskInstallDialog.kt
+6
-7
ManagerInstallDialog.kt
...com/topjohnwu/magisk/view/dialogs/ManagerInstallDialog.kt
+4
-4
UninstallDialog.kt
...java/com/topjohnwu/magisk/view/dialogs/UninstallDialog.kt
+2
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/Info.java
View file @
bf9ac825
package
com
.
topjohnwu
.
magisk
;
import
androidx.annotation.NonNull
;
import
com.topjohnwu.magisk.model.entity.UpdateInfo
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.ShellUtils
;
public
final
class
Info
{
public
static
int
magiskVersionCode
=
-
1
;
// Current status
@NonNull
public
static
String
magiskVersionString
=
""
;
// Update Info
public
static
String
remoteMagiskVersionString
=
""
;
public
static
int
remoteMagiskVersionCode
=
-
1
;
public
static
String
magiskLink
=
""
;
public
static
String
magiskNoteLink
=
""
;
public
static
String
magiskMD5
=
""
;
public
static
String
remoteManagerVersionString
=
""
;
public
static
int
remoteManagerVersionCode
=
-
1
;
public
static
String
managerLink
=
""
;
public
static
String
managerNoteLink
=
""
;
public
static
String
uninstallerLink
=
""
;
// Install flags
public
static
UpdateInfo
remote
=
new
UpdateInfo
();
public
static
boolean
keepVerity
=
false
;
public
static
boolean
keepEnc
=
false
;
public
static
boolean
recovery
=
false
;
...
...
app/src/main/java/com/topjohnwu/magisk/data/network/GithubRawApiServices.kt
View file @
bf9ac825
package
com.topjohnwu.magisk.data.network
import
com.topjohnwu.magisk.Const
import
com.topjohnwu.magisk.model.entity.
MagiskConfig
import
com.topjohnwu.magisk.model.entity.
UpdateInfo
import
io.reactivex.Single
import
okhttp3.ResponseBody
import
retrofit2.http.GET
...
...
@@ -15,19 +15,19 @@ interface GithubRawApiServices {
//region topjohnwu/magisk_files
@GET
(
"$MAGISK_FILES/master/stable.json"
)
fun
fetchStableUpdate
():
Single
<
MagiskConfig
>
fun
fetchStableUpdate
():
Single
<
UpdateInfo
>
@GET
(
"$MAGISK_FILES/master/beta.json"
)
fun
fetchBetaUpdate
():
Single
<
MagiskConfig
>
fun
fetchBetaUpdate
():
Single
<
UpdateInfo
>
@GET
(
"$MAGISK_FILES/master/canary_builds/release.json"
)
fun
fetchCanaryUpdate
():
Single
<
MagiskConfig
>
fun
fetchCanaryUpdate
():
Single
<
UpdateInfo
>
@GET
(
"$MAGISK_FILES/master/canary_builds/canary.json"
)
fun
fetchCanaryDebugUpdate
():
Single
<
MagiskConfig
>
fun
fetchCanaryDebugUpdate
():
Single
<
UpdateInfo
>
@GET
fun
fetchCustomUpdate
(
@Url
url
:
String
):
Single
<
MagiskConfig
>
fun
fetchCustomUpdate
(
@Url
url
:
String
):
Single
<
UpdateInfo
>
@GET
(
"$MAGISK_FILES/{$REVISION}/snet.apk"
)
@Streaming
...
...
app/src/main/java/com/topjohnwu/magisk/data/repository/MagiskRepository.kt
View file @
bf9ac825
...
...
@@ -50,27 +50,14 @@ class MagiskRepository(
else
->
throw
IllegalArgumentException
()
}.
flatMap
{
// If remote version is lower than current installed, try switching to beta
if
(
it
.
magisk
.
versionCode
.
toIntOrNull
()
?:
-
1
<
Info
.
magiskVersionCode
if
(
it
.
magisk
.
versionCode
<
Info
.
magiskVersionCode
&&
Config
.
updateChannel
==
Config
.
Value
.
DEFAULT_CHANNEL
)
{
Config
.
updateChannel
=
Config
.
Value
.
BETA_CHANNEL
apiRaw
.
fetchBetaUpdate
()
}
else
{
Single
.
just
(
it
)
}
}.
doOnSuccess
{
Info
.
remoteMagiskVersionString
=
it
.
magisk
.
version
Info
.
remoteMagiskVersionCode
=
it
.
magisk
.
versionCode
.
toIntOrNull
()
?:
-
1
Info
.
magiskLink
=
it
.
magisk
.
link
Info
.
magiskNoteLink
=
it
.
magisk
.
note
Info
.
magiskMD5
=
it
.
magisk
.
hash
Info
.
remoteManagerVersionString
=
it
.
app
.
version
Info
.
remoteManagerVersionCode
=
it
.
app
.
versionCode
.
toIntOrNull
()
?:
-
1
Info
.
managerLink
=
it
.
app
.
link
Info
.
managerNoteLink
=
it
.
app
.
note
Info
.
uninstallerLink
=
it
.
uninstaller
.
link
}
}.
map
{
Info
.
remote
=
it
;
it
}
fun
fetchApps
()
=
Single
.
fromCallable
{
packageManager
.
getInstalledApplications
(
0
)
}
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskApp.kt
deleted
100644 → 0
View file @
4a3f5dc6
package
com.topjohnwu.magisk.model.entity
import
se.ansman.kotshi.JsonSerializable
@JsonSerializable
data class
MagiskApp
(
val
version
:
String
,
val
versionCode
:
String
,
val
link
:
String
,
val
note
:
String
)
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskConfig.kt
deleted
100644 → 0
View file @
4a3f5dc6
package
com.topjohnwu.magisk.model.entity
import
se.ansman.kotshi.JsonSerializable
@JsonSerializable
data class
MagiskConfig
(
val
app
:
MagiskApp
,
val
uninstaller
:
MagiskLink
,
val
magisk
:
MagiskFlashable
)
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskFlashable.kt
deleted
100644 → 0
View file @
4a3f5dc6
package
com.topjohnwu.magisk.model.entity
import
com.squareup.moshi.Json
import
se.ansman.kotshi.JsonSerializable
@JsonSerializable
data class
MagiskFlashable
(
val
version
:
String
,
val
versionCode
:
String
,
val
link
:
String
,
val
note
:
String
,
@Json
(
name
=
"md5"
)
val
hash
:
String
)
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskLink.kt
deleted
100644 → 0
View file @
4a3f5dc6
package
com.topjohnwu.magisk.model.entity
import
se.ansman.kotshi.JsonSerializable
@JsonSerializable
data class
MagiskLink
(
val
link
:
String
)
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/model/entity/UpdateInfo.kt
0 → 100644
View file @
bf9ac825
package
com.topjohnwu.magisk.model.entity
import
com.squareup.moshi.Json
import
se.ansman.kotshi.JsonSerializable
@JsonSerializable
data class
UpdateInfo
(
val
app
:
ManagerJson
=
ManagerJson
(),
val
uninstaller
:
UninstallerJson
=
UninstallerJson
(),
val
magisk
:
MagiskJson
=
MagiskJson
()
)
@JsonSerializable
data class
UninstallerJson
(
val
link
:
String
=
""
)
@JsonSerializable
data class
MagiskJson
(
val
version
:
String
=
""
,
val
versionCode
:
Int
=
-
1
,
val
link
:
String
=
""
,
val
note
:
String
=
""
,
@Json
(
name
=
"md5"
)
val
hash
:
String
=
""
)
@JsonSerializable
data class
ManagerJson
(
val
version
:
String
=
""
,
val
versionCode
:
Int
=
-
1
,
val
link
:
String
=
""
,
val
note
:
String
=
""
)
app/src/main/java/com/topjohnwu/magisk/model/receiver/GeneralReceiver.kt
View file @
bf9ac825
...
...
@@ -73,7 +73,8 @@ open class GeneralReceiver : BroadcastReceiver() {
}
Intent
.
ACTION_LOCALE_CHANGED
->
Shortcuts
.
setup
(
context
)
Const
.
Key
.
BROADCAST_MANAGER_UPDATE
->
{
Info
.
managerLink
=
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_LINK
)
Info
.
remote
=
Info
.
remote
.
copy
(
app
=
Info
.
remote
.
app
.
copy
(
link
=
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_LINK
)
?:
""
))
DownloadApp
.
upgrade
(
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_NAME
))
}
Const
.
Key
.
BROADCAST_REBOOT
->
reboot
()
...
...
app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.kt
View file @
bf9ac825
...
...
@@ -18,9 +18,9 @@ class UpdateCheckService : DelegateWorker() {
Shell
.
getShell
()
return
runCatching
{
magiskRepo
.
fetchUpdate
().
blockingGet
()
if
(
BuildConfig
.
VERSION_CODE
<
Info
.
remote
ManagerV
ersionCode
)
if
(
BuildConfig
.
VERSION_CODE
<
Info
.
remote
.
app
.
v
ersionCode
)
Notifications
.
managerUpdate
()
else
if
(
Info
.
magiskVersionCode
<
Info
.
remote
MagiskV
ersionCode
)
else
if
(
Info
.
magiskVersionCode
<
Info
.
remote
.
magisk
.
v
ersionCode
)
Notifications
.
magiskUpdate
()
ListenableWorker
.
Result
.
success
()
}.
getOrElse
{
...
...
app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java
View file @
bf9ac825
...
...
@@ -123,9 +123,9 @@ public abstract class MagiskInstaller {
File
zip
=
new
File
(
App
.
self
.
getCacheDir
(),
"magisk.zip"
);
if
(!
ShellUtils
.
checkSum
(
"MD5"
,
zip
,
Info
.
magiskMD5
))
{
if
(!
ShellUtils
.
checkSum
(
"MD5"
,
zip
,
Info
.
remote
.
getMagisk
().
getHash
()
))
{
console
.
add
(
"- Downloading zip"
);
Networking
.
get
(
Info
.
magiskLink
)
Networking
.
get
(
Info
.
remote
.
getMagisk
().
getLink
()
)
.
setDownloadProgressListener
(
new
ProgressLog
())
.
execForFile
(
zip
);
}
else
{
...
...
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeFragment.kt
View file @
bf9ac825
...
...
@@ -56,7 +56,7 @@ class HomeFragment : MagiskFragment<HomeViewModel, FragmentMagiskBinding>(),
private
fun
installMagisk
()
{
// Show Manager update first
if
(
Info
.
remote
ManagerV
ersionCode
>
BuildConfig
.
VERSION_CODE
)
{
if
(
Info
.
remote
.
app
.
v
ersionCode
>
BuildConfig
.
VERSION_CODE
)
{
installManager
()
return
}
...
...
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
bf9ac825
...
...
@@ -172,7 +172,7 @@ class HomeViewModel(
state
=
State
.
LOADED
magiskState
.
value
=
when
(
Info
.
magiskVersionCode
)
{
in
Int
.
MIN_VALUE
until
0
->
MagiskState
.
NOT_INSTALLED
!
in
Info
.
remote
MagiskV
ersionCode
..
Int
.
MAX_VALUE
->
MagiskState
.
OBSOLETE
!
in
Info
.
remote
.
magisk
.
v
ersionCode
..
Int
.
MAX_VALUE
->
MagiskState
.
OBSOLETE
else
->
MagiskState
.
UP_TO_DATE
}
...
...
@@ -183,9 +183,9 @@ class HomeViewModel(
}
magiskLatestVersion
.
value
=
version
.
format
(
Info
.
remote
MagiskVersionString
,
Info
.
remoteMagiskV
ersionCode
)
.
format
(
Info
.
remote
.
magisk
.
version
,
Info
.
remote
.
magisk
.
v
ersionCode
)
managerState
.
value
=
when
(
Info
.
remote
ManagerV
ersionCode
)
{
managerState
.
value
=
when
(
Info
.
remote
.
app
.
v
ersionCode
)
{
in
Int
.
MIN_VALUE
until
0
->
MagiskState
.
NOT_INSTALLED
//wrong update channel
in
(
BuildConfig
.
VERSION_CODE
+
1
)
..
Int
.
MAX_VALUE
->
MagiskState
.
OBSOLETE
else
->
MagiskState
.
UP_TO_DATE
...
...
@@ -195,7 +195,7 @@ class HomeViewModel(
.
format
(
BuildConfig
.
VERSION_NAME
,
BuildConfig
.
VERSION_CODE
)
managerLatestVersion
.
value
=
version
.
format
(
Info
.
remote
ManagerVersionString
,
Info
.
remoteManagerV
ersionCode
)
.
format
(
Info
.
remote
.
app
.
version
,
Info
.
remote
.
app
.
v
ersionCode
)
}
private
fun
ensureEnv
()
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java
View file @
bf9ac825
...
...
@@ -26,7 +26,7 @@ public class DownloadApp {
public
static
void
restore
()
{
String
name
=
Utils
.
INSTANCE
.
fmt
(
"MagiskManager v%s(%d)"
,
Info
.
remote
ManagerVersionString
,
Info
.
remoteManagerVersionCode
);
Info
.
remote
.
getApp
().
getVersion
(),
Info
.
remote
.
getApp
().
getVersionCode
()
);
dlInstall
(
name
,
new
RestoreManager
());
}
...
...
@@ -34,7 +34,7 @@ public class DownloadApp {
File
apk
=
new
File
(
App
.
self
.
getCacheDir
(),
"manager.apk"
);
ProgressNotification
progress
=
new
ProgressNotification
(
name
);
listener
.
progress
=
progress
;
Networking
.
get
(
Info
.
managerLink
)
Networking
.
get
(
Info
.
remote
.
getApp
().
getLink
()
)
.
setExecutor
(
App
.
THREAD_POOL
)
.
setDownloadProgressListener
(
progress
)
.
setErrorHandler
((
conn
,
e
)
->
progress
.
dlFail
())
...
...
app/src/main/java/com/topjohnwu/magisk/view/Notifications.java
View file @
bf9ac825
...
...
@@ -63,11 +63,11 @@ public class Notifications {
public
static
void
managerUpdate
()
{
App
app
=
App
.
self
;
String
name
=
Utils
.
INSTANCE
.
fmt
(
"MagiskManager v%s(%d)"
,
Info
.
remote
ManagerVersionString
,
Info
.
remoteManagerVersionCode
);
Info
.
remote
.
getApp
().
getVersion
(),
Info
.
remote
.
getApp
().
getVersionCode
()
);
Intent
intent
=
new
Intent
(
app
,
ClassMap
.
get
(
GeneralReceiver
.
class
));
intent
.
setAction
(
Const
.
Key
.
BROADCAST_MANAGER_UPDATE
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_LINK
,
Info
.
managerLink
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_LINK
,
Info
.
remote
.
getApp
().
getLink
()
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_NAME
,
name
);
PendingIntent
pendingIntent
=
PendingIntent
.
getBroadcast
(
app
,
Const
.
ID
.
APK_UPDATE_NOTIFICATION_ID
,
intent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
...
...
app/src/main/java/com/topjohnwu/magisk/view/dialogs/InstallMethodDialog.kt
View file @
bf9ac825
...
...
@@ -57,11 +57,11 @@ internal class InstallMethodDialog(activity: MagiskActivity<*, *>, options: List
private
fun
downloadOnly
(
activity
:
MagiskActivity
<
*
,
*
>)
{
activity
.
withExternalRW
{
onSuccess
{
val
filename
=
"Magisk-v${Info.remote
MagiskVersionString
}"
+
"(${Info.remote
MagiskV
ersionCode}).zip"
val
filename
=
"Magisk-v${Info.remote
.magisk.version
}"
+
"(${Info.remote
.magisk.v
ersionCode}).zip"
val
zip
=
File
(
Const
.
EXTERNAL_PATH
,
filename
)
val
progress
=
ProgressNotification
(
filename
)
Networking
.
get
(
Info
.
magiskL
ink
)
Networking
.
get
(
Info
.
remote
.
magisk
.
l
ink
)
.
setDownloadProgressListener
(
progress
)
.
setErrorHandler
{
_
,
_
->
progress
.
dlFail
()
}
.
getAsFile
(
zip
)
{
...
...
app/src/main/java/com/topjohnwu/magisk/view/dialogs/MagiskInstallDialog.kt
View file @
bf9ac825
package
com.topjohnwu.magisk.view.dialogs
import
android.net.Uri
import
android.text.TextUtils
import
com.topjohnwu.magisk.Info
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.ui.base.MagiskActivity
...
...
@@ -13,8 +12,8 @@ import java.util.*
class
MagiskInstallDialog
(
a
:
MagiskActivity
<
*
,
*
>)
:
CustomAlertDialog
(
a
)
{
init
{
val
filename
=
"Magisk v${Info.remote
MagiskVersionString
}"
+
"(${Info.remote
MagiskV
ersionCode})"
val
filename
=
"Magisk v${Info.remote
.magisk.version
}"
+
"(${Info.remote
.magisk.v
ersionCode})"
setTitle
(
a
.
getString
(
R
.
string
.
repo_install_title
,
a
.
getString
(
R
.
string
.
magisk
)))
setMessage
(
a
.
getString
(
R
.
string
.
repo_install_msg
,
filename
))
setCancelable
(
true
)
...
...
@@ -31,13 +30,13 @@ class MagiskInstallDialog(a: MagiskActivity<*, *>) : CustomAlertDialog(a) {
}
InstallMethodDialog
(
a
,
options
).
show
()
}
if
(
!
TextUtils
.
isEmpty
(
Info
.
magiskNoteLink
))
{
if
(
Info
.
remote
.
magisk
.
note
.
isNotEmpty
(
))
{
setNeutralButton
(
R
.
string
.
release_notes
)
{
_
,
_
->
if
(
Info
.
magiskNoteLink
.
contains
(
"forum.xda-developers"
))
{
if
(
Info
.
remote
.
magisk
.
note
.
contains
(
"forum.xda-developers"
))
{
// Open forum links in browser
Utils
.
openLink
(
a
,
Uri
.
parse
(
Info
.
magiskNoteLink
))
Utils
.
openLink
(
a
,
Uri
.
parse
(
Info
.
remote
.
magisk
.
note
))
}
else
{
MarkDownWindow
.
show
(
a
,
null
,
Info
.
magiskNoteLink
)
MarkDownWindow
.
show
(
a
,
null
,
Info
.
remote
.
magisk
.
note
)
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/view/dialogs/ManagerInstallDialog.kt
View file @
bf9ac825
...
...
@@ -9,15 +9,15 @@ import com.topjohnwu.magisk.view.MarkDownWindow
class
ManagerInstallDialog
(
a
:
Activity
)
:
CustomAlertDialog
(
a
)
{
init
{
val
name
=
"MagiskManager v${Info.remote
ManagerVersionString
}"
+
"(${Info.remote
ManagerV
ersionCode})"
val
name
=
"MagiskManager v${Info.remote
.app.version
}"
+
"(${Info.remote
.app.v
ersionCode})"
setTitle
(
a
.
getString
(
R
.
string
.
repo_install_title
,
a
.
getString
(
R
.
string
.
app_name
)))
setMessage
(
a
.
getString
(
R
.
string
.
repo_install_msg
,
name
))
setCancelable
(
true
)
setPositiveButton
(
R
.
string
.
install
)
{
_
,
_
->
DownloadApp
.
upgrade
(
name
)
}
if
(
Info
.
managerNoteLink
.
isNotEmpty
())
{
if
(
Info
.
remote
.
app
.
note
.
isNotEmpty
())
{
setNeutralButton
(
R
.
string
.
app_changelog
)
{
_
,
_
->
MarkDownWindow
.
show
(
a
,
null
,
Info
.
managerNoteLink
)
}
MarkDownWindow
.
show
(
a
,
null
,
Info
.
remote
.
app
.
note
)
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/view/dialogs/UninstallDialog.kt
View file @
bf9ac825
...
...
@@ -4,9 +4,7 @@ import android.app.Activity
import
android.app.ProgressDialog
import
android.content.Intent
import
android.net.Uri
import
android.text.TextUtils
import
android.widget.Toast
import
com.topjohnwu.magisk.ClassMap
import
com.topjohnwu.magisk.Const
import
com.topjohnwu.magisk.Info
...
...
@@ -16,7 +14,6 @@ import com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.view.ProgressNotification
import
com.topjohnwu.net.Networking
import
com.topjohnwu.superuser.Shell
import
java.io.File
class
UninstallDialog
(
activity
:
Activity
)
:
CustomAlertDialog
(
activity
)
{
...
...
@@ -37,11 +34,11 @@ class UninstallDialog(activity: Activity) : CustomAlertDialog(activity) {
}
}
}
if
(
!
TextUtils
.
isEmpty
(
Info
.
uninstallerLink
))
{
if
(
Info
.
remote
.
uninstaller
.
link
.
isNotEmpty
(
))
{
setPositiveButton
(
R
.
string
.
complete_uninstall
)
{
d
,
i
->
val
zip
=
File
(
activity
.
filesDir
,
"uninstaller.zip"
)
val
progress
=
ProgressNotification
(
zip
.
name
)
Networking
.
get
(
Info
.
uninstallerL
ink
)
Networking
.
get
(
Info
.
remote
.
uninstaller
.
l
ink
)
.
setDownloadProgressListener
(
progress
)
.
setErrorHandler
{
_
,
_
->
progress
.
dlFail
()
}
.
getAsFile
(
zip
)
{
f
->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment