Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Android import first wallet navigation stack #6393

Merged
merged 5 commits into from
Jan 15, 2025
Merged

Conversation

walmat
Copy link
Contributor

@walmat walmat commented Jan 10, 2025

Fixes APP-2259

What changed (plus any additional context for devs)

1. Seed Phrase Handling

  • Added trimming of seed phrases during import to prevent whitespace issues:
const handleSetSeedPhrase = useCallback(
  (text: string) => {
    if (isImporting) return null;
    return setSeedPhrase(text.trim());
  },
  [isImporting]
);

2. Wallet Loading State Management

  • Added new wallet loading state tracking during import process:
walletLoadingStore.setState({
  loadingState: WalletLoadingStates.IMPORTING_WALLET,
});
  • Properly clearing loading state after import completion:
walletLoadingStore.setState({
  loadingState: null,
});

3. Navigation Flow Improvements

  • Simplified navigation logic after wallet import
  • Removed redundant navigation code paths
  • Unified navigation handling through Navigation.handleAction:
Navigation.handleAction(
  Routes.SWIPE_LAYOUT,
  { screen: Routes.WALLET_SCREEN },
  previousWalletCount === 0
);

4. Code Cleanup

  • Removed unused imports:
    • Removed isValidBluetoothDeviceId
    • Removed WalletBackupStepTypes
    • Removed IS_TEST
  • Removed debug console logs from Portal component
  • Improved code organization and readability

This PR focuses on improving the wallet import experience by handling edge cases better, providing clearer loading states, and simplifying the navigation flow after import completion.

Screen recordings / screenshots

https://rainbowhaus.slack.com/archives/C0468CDBE75/p1736530454941719

What to test

importing, watching, restoring from backup, etc. etc.

@walmat walmat marked this pull request as ready for review January 10, 2025 17:35
@@ -74,7 +74,7 @@ export default function useImportingWallet({ showImportModal = true } = {}) {
const handleSetSeedPhrase = useCallback(
(text: string) => {
if (isImporting) return null;
return setSeedPhrase(text);
return setSeedPhrase(text.trim());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this removes any extraneous newlines when pasting. Got tired of seeing that.

@brunobar79
Copy link
Member

Launch in simulator or device for b20e671

@brunobar79
Copy link
Member

Launch in simulator or device for a48f6cc

@derHowie derHowie self-requested a review January 14, 2025 15:59
@derHowie
Copy link
Member

Could be wrong but I think the most recent rebase removed 2 imports that file still wants

Copy link
Member

@derHowie derHowie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will approve after lint fix 🫡

@derHowie derHowie self-requested a review January 14, 2025 16:03
@brunobar79
Copy link
Member

Launch in simulator or device for 0cf2342

@walmat walmat merged commit 6c94cd4 into develop Jan 15, 2025
8 checks passed
@walmat walmat deleted the @matthew/APP-2259 branch January 15, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants