Skip to content

Conversation

@lealobanov
Copy link
Collaborator

Related Issue

Closes #???

Summary of Changes

Need Regression Testing

  • Yes
  • No

Risk Assessment

  • Low
  • Medium
  • High

Additional Notes

Screenshots (if applicable)

lealobanov and others added 30 commits November 20, 2025 13:58
Introduces logic to find and handle redirect URLs after WalletConnect authorization responses.
feat: update preauthz for walletconnect
Implement Android native PDF parsing functionality to extract JSON data from Blocto RecoveryKit PDF files in the keystore import flow.

Changes:
- Add PDFBox-Android dependency (2.0.27.0)
- Create BlocktoPDFExtractor for PDF text extraction and JSON parsing
- Create DocumentPickerManager for file picker and URI handling
- Add "Import from PDF" button to keystore import screen
- Integrate PDF import into PrivateKeyStoreInfoFragment
- Add READ_EXTERNAL_STORAGE permission for API < 33

Key Features:
- Storage Access Framework (SAF) integration for file selection
- Content URI to file stream conversion
- Background processing with Kotlin coroutines
- Multiple regex patterns for robust JSON detection
- Comprehensive error handling and user feedback
- Automatic temp file cleanup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Exclude BouncyCastle dependencies from PDFBox-Android to prevent conflicts
- Fix toast function calls to use named msg parameter
- Uncomment GitHub Packages credentials for Flow-Wallet-Kit dependency

These changes fix the build issues introduced by the PDF parsing feature
and enable successful APK compilation.
- Add error message TextView that displays when PDF parsing fails
- Add clickable link to Chrome Web Store for Flow Wallet Extension
- Hide error by default and show only on parsing failure
- Fix PDF icon aspect ratio (19.68x24dp) and reduce size to 16dp
- Error hides when user starts typing in JSON field

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Show error message when JSON is invalid (from paste or typing)
- Updated error message to be more generic for all invalid JSON cases
- Error shows for any invalid JSON input, not just PDF import failures
- Validates JSON in real-time as user types or pastes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added translations for 14 languages:
- English (en-rUS)
- Simplified Chinese (zh-rCN)
- Traditional Chinese (zh-rTW, zh-rHK, zh-rSG)
- Spanish (es-rES, es-rUS)
- Japanese (ja-rJP)
- Korean (ko-rKR)
- French (fr-rFR)
- German (de-rDE)
- Russian (ru-rRU)
- Italian (it-rIT)
- Hindi (hi-rIN)

Translations cover:
- import_from_pdf button text
- pdf_parse_error_message with extension link
- extension_download_url

Fixed apostrophe escaping in French and Italian strings.
Added -dontwarn rules for optional JPEG2000 codec classes:
- com.gemalto.jp2.JP2Decoder
- com.gemalto.jp2.JP2Encoder

These are optional dependencies in PdfBox-Android used for handling
JPX (JPEG2000) compressed images in PDFs. They are not required for
basic PDF parsing functionality.
- Add pre-validation for keystore JSON format before passing to Trust Wallet Core
- Wrap StoredKey.importJSON and decryptPrivateKey in try-catch for JNI issues
- Improve PDF extractor with brace-balanced JSON extraction for nested keystores
- Add default values to WalletNotification data class for Gson deserialization
- Add comprehensive logging for debugging keystore import issues
- Move error handling inside ioScope to properly catch async exceptions
- Add KeystoreImportError enum for different error types
- Show 'pdf_parse_error_message' for invalid JSON/keystore format
- Show 'wrong_password' for incorrect password
- Always stop loading state on any error path
- Add handleKeystoreError helper for consistent error handling
- Add keystoreFormatErrorLiveData to communicate format errors to UI
- For invalid JSON/keystore: show red error message with Extension download link
- For wrong password/other errors: show toast only
- Fragment observes LiveData and shows/hides tvPdfError accordingly
- Hide error message before starting import attempt
@lealobanov lealobanov requested a review from jaymengxy December 22, 2025 05:10
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