Skip to content

Commit 1155c43

Browse files
committed
BootstrapReAuthFragment: fix infinite loading wheel by submitting at start up.
1 parent 5cd78c0 commit 1155c43

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapReAuthFragment.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import android.view.LayoutInflater
2121
import android.view.View
2222
import android.view.ViewGroup
2323
import androidx.core.view.isVisible
24+
import androidx.lifecycle.ViewModelProvider
2425
import com.airbnb.mvrx.parentFragmentViewModel
2526
import com.airbnb.mvrx.withState
2627
import dagger.hilt.android.AndroidEntryPoint
@@ -43,6 +44,12 @@ class BootstrapReAuthFragment :
4344

4445
views.bootstrapRetryButton.debouncedClicks { submit() }
4546
views.bootstrapCancelButton.debouncedClicks { cancel() }
47+
48+
val viewModel = ViewModelProvider(this).get(BootstrapReAuthViewModel::class.java)
49+
if (!viewModel.isFirstSubmitDone) {
50+
viewModel.isFirstSubmitDone = true
51+
submit()
52+
}
4653
}
4754

4855
private fun submit() = withState(sharedViewModel) { state ->
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2024 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.app.features.crypto.recover
18+
19+
import androidx.lifecycle.ViewModel
20+
21+
class BootstrapReAuthViewModel : ViewModel() {
22+
var isFirstSubmitDone = false
23+
}

0 commit comments

Comments
 (0)