mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-30 07:07:45 +00:00
@@ -31,11 +31,11 @@ class HomeFragment : BaseUIFragment<HomeViewModel, FragmentHomeMd2Binding>() {
|
||||
|
||||
// Set barrier reference IDs in code, since resource IDs will be stripped in release mode
|
||||
binding.homeMagiskWrapper.homeMagiskTitleBarrier.referencedIds =
|
||||
intArrayOf(R.id.home_magisk_action, R.id.home_magisk_title, R.id.home_magisk_icon)
|
||||
intArrayOf(R.id.home_magisk_button, R.id.home_magisk_title, R.id.home_magisk_icon)
|
||||
binding.homeMagiskWrapper.homeMagiskBarrier.referencedIds =
|
||||
intArrayOf(R.id.home_magisk_latest_version, R.id.home_magisk_installed_version)
|
||||
binding.homeManagerWrapper.homeManagerTitleBarrier.referencedIds =
|
||||
intArrayOf(R.id.home_manager_action, R.id.home_manager_title, R.id.home_manager_icon)
|
||||
intArrayOf(R.id.home_manager_button, R.id.home_manager_title, R.id.home_manager_icon)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.topjohnwu.magisk.core.model.MagiskJson
|
||||
import com.topjohnwu.magisk.core.model.ManagerJson
|
||||
import com.topjohnwu.magisk.data.repository.MagiskRepository
|
||||
import com.topjohnwu.magisk.events.OpenInappLinkEvent
|
||||
import com.topjohnwu.magisk.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.events.dialog.EnvFixDialog
|
||||
import com.topjohnwu.magisk.events.dialog.ManagerInstallDialog
|
||||
import com.topjohnwu.magisk.events.dialog.UninstallDialog
|
||||
@@ -126,10 +127,14 @@ class HomeViewModel(
|
||||
|
||||
fun onDeletePressed() = UninstallDialog().publish()
|
||||
|
||||
fun onManagerPressed() = ManagerInstallDialog().publish()
|
||||
fun onManagerPressed() =
|
||||
if (isConnected.get()) ManagerInstallDialog().publish()
|
||||
else SnackbarEvent(R.string.no_connection).publish()
|
||||
|
||||
fun onMagiskPressed() = withExternalRW {
|
||||
fun onMagiskPressed() = if (isConnected.get()) withExternalRW {
|
||||
HomeFragmentDirections.actionHomeFragmentToInstallFragment().publish()
|
||||
} else {
|
||||
SnackbarEvent(R.string.no_connection).publish()
|
||||
}
|
||||
|
||||
fun onSafetyNetPressed() =
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.topjohnwu.magisk.data.database.RepoByUpdatedDao
|
||||
import com.topjohnwu.magisk.databinding.RvItem
|
||||
import com.topjohnwu.magisk.events.InstallExternalModuleEvent
|
||||
import com.topjohnwu.magisk.events.OpenChangelogEvent
|
||||
import com.topjohnwu.magisk.events.SnackbarEvent
|
||||
import com.topjohnwu.magisk.events.dialog.ModuleInstallDialog
|
||||
import com.topjohnwu.magisk.ktx.addOnListChangedCallback
|
||||
import com.topjohnwu.magisk.ktx.reboot
|
||||
@@ -300,16 +301,27 @@ class ModuleViewModel(
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
fun downloadPressed(item: RepoItem) = withExternalRW {
|
||||
fun downloadPressed(item: RepoItem) = if (isConnected.get()) withExternalRW {
|
||||
ModuleInstallDialog(item.item).publish()
|
||||
} else {
|
||||
SnackbarEvent(R.string.no_connection).publish()
|
||||
}
|
||||
|
||||
fun installPressed() = withExternalRW {
|
||||
InstallExternalModuleEvent().publish()
|
||||
}
|
||||
|
||||
fun infoPressed(item: RepoItem) = OpenChangelogEvent(item.item).publish()
|
||||
fun infoPressed(item: RepoItem) =
|
||||
if (isConnected.get()) OpenChangelogEvent(item.item).publish()
|
||||
else SnackbarEvent(R.string.no_connection).publish()
|
||||
|
||||
|
||||
fun infoPressed(item: ModuleItem) {
|
||||
OpenChangelogEvent(item.repo ?: return).publish()
|
||||
item.repo?.also {
|
||||
if (isConnected.get())
|
||||
OpenChangelogEvent(it).publish()
|
||||
else
|
||||
SnackbarEvent(R.string.no_connection).publish()
|
||||
} ?: return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user