Allow offline hide manager

This commit is contained in:
vvb2060 2021-01-27 23:16:56 +08:00 committed by John Wu
parent 591788c0df
commit 6635ea3e29
3 changed files with 4 additions and 9 deletions

View File

@ -106,7 +106,9 @@ object HideAPK {
svc.fetchFile(Info.remote.stub.link).byteStream().writeTo(stub)
} catch (e: IOException) {
Timber.e(e)
return false
stub.createNewFile()
val cmd = "\$MAGISKBIN/magiskinit -x manager ${stub.path}"
if (!Shell.su(cmd).exec().isSuccess) return false
}
// Generate a new random package name and signature

View File

@ -100,10 +100,6 @@ object Hide : BaseSettingsItem.Input() {
override fun getView(context: Context) = DialogSettingsAppNameBinding
.inflate(LayoutInflater.from(context)).also { it.data = this }.root
override fun refresh() {
isEnabled = Info.remote.stub.versionCode > 0
}
}
object Restore : BaseSettingsItem.Blank() {

View File

@ -56,10 +56,7 @@ class SettingsViewModel : BaseViewModel(), BaseSettingsItem.Callback {
))
if (Info.env.isActive) {
if (Const.USER_ID == 0) {
if (hidden)
list.add(Restore)
else if (Info.isConnected.get())
list.add(Hide)
if (hidden) list.add(Restore) else list.add(Hide)
}
}