From 5f4cd50cc40803642cc3be87f2d5087b97fa58af Mon Sep 17 00:00:00 2001 From: canyie Date: Thu, 20 Jan 2022 17:31:36 +0800 Subject: [PATCH] Properly prevent fix env dialog from constantly showing ViewModel has been reconstructed when switching fragment so we lost previous state. --- .../main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt index 938eb1321..0edcd405c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt @@ -80,7 +80,9 @@ class HomeViewModel( it.bindExtra(BR.viewModel, this) } - private var checkedEnv = false + companion object { + private var checkedEnv = false + } override fun refresh() = viewModelScope.launch { state = State.LOADING