fix(mobile-app): skip backup mnemonic page for MPC wallet mode

- Fix mnemonic parsing: empty string "" now correctly becomes empty list
- MPC mode (no mnemonic) skips backup page and navigates directly to home
- Apply fix to both initial load and polling logic

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-07 12:00:38 -08:00
parent 72c49ffe7a
commit f1390a85c8
2 changed files with 32 additions and 5 deletions

View File

@ -41,7 +41,8 @@
"Bash(git -C \"c:\\Users\\dong\\Desktop\\rwadurian\" commit -m \"$(cat <<''EOF''\nfix(identity): update migration to TEXT avatar and remove province/city/address\n\n- Change avatar_url column from VARCHAR(500) to TEXT\n- Remove province_code, city_code, address columns from user_accounts\n- Remove idx_province_city index\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")",
"Bash(git -C \"c:\\Users\\dong\\Desktop\\rwadurian\" commit -m \"$(cat <<''EOF''\nfix(identity): remove address from updateProfile and fix deviceInfo type\n\n- Remove dto.address parameter from updateProfile controller\n- Remove address property from updateProfile service\n- Fix deviceInfo JSON serialization for Prisma InputJsonValue type\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")",
"Bash(git -C \"c:\\Users\\dong\\Desktop\\rwadurian\" checkout -- backend/services/identity-service/prisma/migrations/20241204000000_init/migration.sql)",
"Bash(git -C \"c:\\Users\\dong\\Desktop\\rwadurian\" commit -m \"$(cat <<''EOF''\nfix(identity): add device_info columns to user_devices migration\n\n- Add device_info JSONB column for storing complete device info\n- Add platform, device_model, os_version, app_version columns\n- Add screen_width, screen_height, locale, timezone columns\n- Add idx_platform index\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")"
"Bash(git -C \"c:\\Users\\dong\\Desktop\\rwadurian\" commit -m \"$(cat <<''EOF''\nfix(identity): add device_info columns to user_devices migration\n\n- Add device_info JSONB column for storing complete device info\n- Add platform, device_model, os_version, app_version columns\n- Add screen_width, screen_height, locale, timezone columns\n- Add idx_platform index\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")",
"Bash(git -C \"c:\\Users\\dong\\Desktop\\rwadurian\" commit -m \"$(cat <<''EOF''\nfix(mobile-app): fix API response parsing for auto-create and wallet\n\n- Extract ''data'' field from API response before parsing\n- Fix createAccount() to parse responseData[''data'']\n- Fix getWalletInfo() to parse responseData[''data'']\n- Resolves: type ''Null'' is not a subtype of type ''int'' in type cast\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")"
],
"deny": [],
"ask": []

View File

@ -89,14 +89,27 @@ class _BackupMnemonicPageState extends ConsumerState<BackupMnemonicPage> {
if (response.isReady) {
//
final wordCount = response.mnemonic?.split(' ').length ?? 0;
// null都视为无助记词MPC模式
final mnemonic = response.mnemonic?.trim() ?? '';
final words = mnemonic.isEmpty ? <String>[] : mnemonic.split(' ');
final wordCount = words.length;
debugPrint('[BackupMnemonicPage] _loadWalletInfo - 钱包就绪! 助记词数量: $wordCount');
debugPrint('[BackupMnemonicPage] _loadWalletInfo - KAVA: ${_maskAddress(response.walletAddresses?.kava)}');
debugPrint('[BackupMnemonicPage] _loadWalletInfo - DST: ${_maskAddress(response.walletAddresses?.dst)}');
debugPrint('[BackupMnemonicPage] _loadWalletInfo - BSC: ${_maskAddress(response.walletAddresses?.bsc)}');
// MPC模式
if (wordCount == 0) {
debugPrint('[BackupMnemonicPage] _loadWalletInfo - MPC模式无助记词跳转到主页');
if (mounted) {
context.go('/home');
}
return;
}
setState(() {
_walletInfo = response;
_mnemonicWords = response.mnemonic?.split(' ') ?? [];
_mnemonicWords = words;
_kavaAddress = response.walletAddresses?.kava;
_dstAddress = response.walletAddresses?.dst;
_bscAddress = response.walletAddresses?.bsc;
@ -197,11 +210,24 @@ class _BackupMnemonicPageState extends ConsumerState<BackupMnemonicPage> {
debugPrint('[BackupMnemonicPage] _startPolling - 钱包就绪! 停止轮询 (共轮询 $_pollCount 次)');
timer.cancel();
_stopCountdown();
final wordCount = response.mnemonic?.split(' ').length ?? 0;
// null都视为无助记词MPC模式
final mnemonic = response.mnemonic?.trim() ?? '';
final words = mnemonic.isEmpty ? <String>[] : mnemonic.split(' ');
final wordCount = words.length;
debugPrint('[BackupMnemonicPage] _startPolling - 助记词数量: $wordCount');
// MPC模式
if (wordCount == 0) {
debugPrint('[BackupMnemonicPage] _startPolling - MPC模式无助记词跳转到主页');
if (mounted) {
context.go('/home');
}
return;
}
setState(() {
_walletInfo = response;
_mnemonicWords = response.mnemonic?.split(' ') ?? [];
_mnemonicWords = words;
_kavaAddress = response.walletAddresses?.kava;
_dstAddress = response.walletAddresses?.dst;
_bscAddress = response.walletAddresses?.bsc;