BootstrapReAuthFragment: fix infinite loading wheel by submitting at start up.

This commit is contained in:
Benoit Marty 2024-03-19 17:47:52 +01:00
parent 5cd78c02aa
commit 1155c43fe0
2 changed files with 30 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.lifecycle.ViewModelProvider
import com.airbnb.mvrx.parentFragmentViewModel import com.airbnb.mvrx.parentFragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@ -43,6 +44,12 @@ class BootstrapReAuthFragment :
views.bootstrapRetryButton.debouncedClicks { submit() } views.bootstrapRetryButton.debouncedClicks { submit() }
views.bootstrapCancelButton.debouncedClicks { cancel() } views.bootstrapCancelButton.debouncedClicks { cancel() }
val viewModel = ViewModelProvider(this).get(BootstrapReAuthViewModel::class.java)
if (!viewModel.isFirstSubmitDone) {
viewModel.isFirstSubmitDone = true
submit()
}
} }
private fun submit() = withState(sharedViewModel) { state -> private fun submit() = withState(sharedViewModel) { state ->

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.crypto.recover
import androidx.lifecycle.ViewModel
class BootstrapReAuthViewModel : ViewModel() {
var isFirstSubmitDone = false
}