Fixed same events not being able to propagate consecutively

This commit is contained in:
Viktor De Pasquale 2019-04-14 12:21:04 +02:00
parent 861ad9881c
commit 796c16237d
3 changed files with 11 additions and 11 deletions

View File

@ -5,10 +5,10 @@ import com.skoumal.teanity.viewevents.ViewEvent
data class OpenLinkEvent(val url: String) : ViewEvent() data class OpenLinkEvent(val url: String) : ViewEvent()
object ManagerInstallEvent : ViewEvent() class ManagerInstallEvent : ViewEvent()
object MagiskInstallEvent : ViewEvent() class MagiskInstallEvent : ViewEvent()
object ManagerChangelogEvent : ViewEvent() class ManagerChangelogEvent : ViewEvent()
object MagiskChangelogEvent : ViewEvent() class MagiskChangelogEvent : ViewEvent()
object UninstallEvent : ViewEvent() class UninstallEvent : ViewEvent()

View File

@ -80,18 +80,18 @@ class HomeViewModel(
fun twitterPressed() = OpenLinkEvent(Const.Url.TWITTER_URL).publish() fun twitterPressed() = OpenLinkEvent(Const.Url.TWITTER_URL).publish()
fun githubPressed() = OpenLinkEvent(Const.Url.REPO_URL).publish() fun githubPressed() = OpenLinkEvent(Const.Url.REPO_URL).publish()
fun xdaPressed() = OpenLinkEvent(Const.Url.XDA_THREAD).publish() fun xdaPressed() = OpenLinkEvent(Const.Url.XDA_THREAD).publish()
fun uninstallPressed() = UninstallEvent.publish() fun uninstallPressed() = UninstallEvent().publish()
fun advancedPressed() = isAdvancedExpanded.toggle() fun advancedPressed() = isAdvancedExpanded.toggle()
fun installPressed(item: MagiskItem) = when (item) { fun installPressed(item: MagiskItem) = when (item) {
MagiskItem.MANAGER -> ManagerInstallEvent.publish() MagiskItem.MANAGER -> ManagerInstallEvent().publish()
MagiskItem.MAGISK -> MagiskInstallEvent.publish() MagiskItem.MAGISK -> MagiskInstallEvent().publish()
} }
fun cardPressed(item: MagiskItem) = when (item) { fun cardPressed(item: MagiskItem) = when (item) {
MagiskItem.MANAGER -> ManagerChangelogEvent.publish() MagiskItem.MANAGER -> ManagerChangelogEvent().publish()
MagiskItem.MAGISK -> MagiskChangelogEvent.publish() MagiskItem.MAGISK -> MagiskChangelogEvent().publish()
} }
fun refresh() { fun refresh() {

View File

@ -67,7 +67,7 @@ class MagiskFragment : NewMagiskFragment<HomeViewModel, com.topjohnwu.magisk.dat
private fun installMagisk() { private fun installMagisk() {
// Show Manager update first // Show Manager update first
if (Config.remoteManagerVersionCode > BuildConfig.VERSION_CODE) { if (Config.remoteManagerVersionCode > BuildConfig.VERSION_CODE) {
ManagerInstallDialog(requireActivity()).show() installManager()
return return
} }
//FIXME dialog requires old base //FIXME dialog requires old base