Fix OnboardingViewModel range exception (#26317)
Fix onboarding range exception
This commit is contained in:
+4
@@ -6,6 +6,7 @@
|
||||
package org.chromium.chrome.browser.crypto_wallet.fragments.onboarding;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -137,6 +138,9 @@ public class OnboardingRecoveryPhraseFragment extends BaseOnboardingWalletFragme
|
||||
keyringService.getWalletMnemonic(
|
||||
mOnboardingViewModel.getPassword(),
|
||||
result -> {
|
||||
if (TextUtils.isEmpty(result)) {
|
||||
return;
|
||||
}
|
||||
mRecoveryPhrases = Utils.getRecoveryPhraseAsList(result);
|
||||
mRecoveryPhraseAdapter.setRecoveryPhraseList(mRecoveryPhrases);
|
||||
mRecoveryPhraseRecyclerView.setAdapter(mRecoveryPhraseAdapter);
|
||||
|
||||
+3
-1
@@ -195,7 +195,9 @@ public class OnboardingVerifyRecoveryPhraseFragment extends BaseOnboardingWallet
|
||||
super.onResume();
|
||||
if (mVerificationStep != null && mWordToMatch == null) {
|
||||
mWordToMatch = mOnboardingViewModel.getVerificationStep(mVerificationStep);
|
||||
mCheckWord.setText(getString(R.string.enter_word, mWordToMatch.first + 1));
|
||||
if (mWordToMatch != null) {
|
||||
mCheckWord.setText(getString(R.string.enter_word, mWordToMatch.first + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -64,10 +64,12 @@ public class OnboardingViewModel extends ViewModel {
|
||||
return mPassword;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Nullable
|
||||
public Pair<Integer, String> getVerificationStep(@NonNull final VerificationStep step) {
|
||||
assert mVerificationWords.size() != 0 : "Verification word list must not be empty.";
|
||||
|
||||
if (mVerificationWords.size() <= step.getValue()) {
|
||||
return null;
|
||||
}
|
||||
return extractPositionAndWordAtIndex(step.getValue());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user