From da9749f314ba42bac9b65d1f2006c72ee8723f0e Mon Sep 17 00:00:00 2001 From: soralit Date: Wed, 15 Mar 2023 11:51:03 +0800 Subject: [PATCH] fix(rwm): import wallet navigation issue --- app/src/main/assets/coin/config.json | 2 +- .../helper/CoinConfigHelper.java | 1 + .../ui/fragment/setup/MnemonicInputFragment.java | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/assets/coin/config.json b/app/src/main/assets/coin/config.json index 8495a60f..a8e3a4f9 100644 --- a/app/src/main/assets/coin/config.json +++ b/app/src/main/assets/coin/config.json @@ -128,7 +128,7 @@ "MATIC", "DOT", "LTC", - "OKB", + "OKT", "SOL", "TRX", "AVAX", diff --git a/app/src/main/java/com/keystone/cold/remove_wallet_mode/helper/CoinConfigHelper.java b/app/src/main/java/com/keystone/cold/remove_wallet_mode/helper/CoinConfigHelper.java index ea80db10..68165e00 100644 --- a/app/src/main/java/com/keystone/cold/remove_wallet_mode/helper/CoinConfigHelper.java +++ b/app/src/main/java/com/keystone/cold/remove_wallet_mode/helper/CoinConfigHelper.java @@ -56,6 +56,7 @@ public static void initCoinConfig() { try { JSONObject coinConfig = new JSONObject(ScriptLoader.readAsset("coin/config.json")); int version = coinConfig.getInt("version"); + //TODO load local config when version upgrade SharePreferencesUtil.setCoinConfig(MainApplication.getApplication(), mapToLocalConfig(coinConfig.getJSONArray("extraCoins"))); SharePreferencesUtil.setCoinConfigVersion(MainApplication.getApplication(), version); diff --git a/app/src/main/java/com/keystone/cold/remove_wallet_mode/ui/fragment/setup/MnemonicInputFragment.java b/app/src/main/java/com/keystone/cold/remove_wallet_mode/ui/fragment/setup/MnemonicInputFragment.java index d5265c48..5aecd8f4 100644 --- a/app/src/main/java/com/keystone/cold/remove_wallet_mode/ui/fragment/setup/MnemonicInputFragment.java +++ b/app/src/main/java/com/keystone/cold/remove_wallet_mode/ui/fragment/setup/MnemonicInputFragment.java @@ -27,6 +27,7 @@ import static com.keystone.cold.viewmodel.SetupVaultViewModel.VAULT_STATE_CREATING_FAILED; import static com.keystone.cold.viewmodel.SetupVaultViewModel.VAULT_STATE_NOT_CREATE; +import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; @@ -52,6 +53,7 @@ import com.keystone.cold.databinding.CreateVaultModalBinding; import com.keystone.cold.databinding.MnemonicInputFragmentBinding; import com.keystone.cold.databinding.ModalWithTwoButtonBinding; +import com.keystone.cold.remove_wallet_mode.ui.MainActivity; import com.keystone.cold.remove_wallet_mode.ui.SetupVaultActivity; import com.keystone.cold.remove_wallet_mode.ui.fragment.unlock.VerifyMnemonicFragment; import com.keystone.cold.remove_wallet_mode.viewmodel.SetupVaultViewModel; @@ -291,13 +293,17 @@ void subscribeVaultState(MutableLiveData vaultState) { if (dialog != null && dialog.getDialog() != null && dialog.getDialog().isShowing()) { dialog.dismiss(); } - Bundle data = new Bundle(); + boolean isSetupProcess = ((SetupVaultActivity) mActivity).inSetupProcess; - data.putBoolean(IS_SETUP_VAULT, isSetupProcess); - if (isSetupProcess) { + if (!isSetupProcess) { + startActivity(new Intent(mActivity, MainActivity.class)); + mActivity.finish(); + } else { + Bundle data = new Bundle(); + data.putBoolean(IS_SETUP_VAULT, true); viewModel.setVaultCreateStep(VAULT_CREATE_STEP_DONE); + navigate(R.id.action_to_setupSelectWalletFragment, data); } - navigate(R.id.action_to_setupSelectWalletFragment, data); }; //List coins = PresetData.generateCoins(mActivity);