Fix "double install" caused by config changes

Configuration changes in FlashFragment may cause the installation process to be triggered twice. The simplest way to reproduce this behavior is to choose a module ZIP file in landscape mode (which is the default on some tablets).

This commit fixes the problem by ensuring `savedInstanceState == null` before starting installation.
This commit is contained in:
Kazurin Nanako 2022-03-13 17:30:00 +08:00 committed by John Wu
parent 90545057e9
commit 42e5f5150a

View File

@ -51,7 +51,9 @@ class FlashFragment : BaseFragment<FragmentFlashMd2Binding>() {
defaultOrientation = activity?.requestedOrientation ?: -1
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
viewModel.startFlashing()
if (savedInstanceState == null) {
viewModel.startFlashing()
}
}
@SuppressLint("WrongConstant")