mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
BootstrapReAuthFragment: fix infinite loading wheel by submitting at start up.
This commit is contained in:
parent
5cd78c02aa
commit
1155c43fe0
2 changed files with 30 additions and 0 deletions
|
@ -21,6 +21,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.airbnb.mvrx.parentFragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
@ -43,6 +44,12 @@ class BootstrapReAuthFragment :
|
|||
|
||||
views.bootstrapRetryButton.debouncedClicks { submit() }
|
||||
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 ->
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue