feat: add legacy firmware update flow for web/extension platforms#9886
feat: add legacy firmware update flow for web/extension platforms#9886
Conversation
Add independent firmware update flow for legacy devices (firmware versions below minimum limit) on Web and Extension platforms. Changes: - Add ServiceLegacyFirmwareUpdate with device-specific handlers (Touch, Mini, Classic) - Add Jotai atoms for legacy firmware update state management - Add LegacyFirmwareUpdate page with UI components: - LegacyUpdateStepIndicator (progress steps display) - LegacyUpdateCheckList (pre-update checklist) - LegacyUpdateProgress (progress bar and status) - LegacyUpdateResult (success/failure result) - MiniBootloaderModeGuide (bootloader mode instructions) - WebUsbDeviceReselectPrompt (USB device reselect prompt) - Add route configuration for legacy firmware update modal - Integrate with existing firmware update actions
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
- Remove platform restriction in shouldUseLegacyFlow() to support iOS/Android - Add platform-aware bootloader mode instructions in MiniBootloaderModeGuide - Mobile: power off → hold button → power on flow - Web/Extension: disconnect USB → hold button → connect USB flow - Add platform-aware device reselect UI in WebUsbDeviceReselectPrompt - Mobile: shows spinner with Bluetooth search status - Web/Extension: shows USB icon with reselect button
- LegacyUpdateStepIndicator: Add spring animation for step dots (scale 1.25x when active) and smooth progress bar fill animation - LegacyUpdateProgress: Add useSmoothProgress hook for fluid progress interpolation, enable animated prop on Progress component - LegacyUpdateResult: Add entrance animations for success/error states (scale from 0.5, fade in, slide up) - LegacyUpdateCheckList: Add card entrance animations (fade + slide) - MiniBootloaderModeGuide: Add layered entrance animations - WebUsbDeviceReselectPrompt: Add unified entrance animations for both native and web platforms Animation types used: - quick: Fast spring (damping: 20, mass: 0.1) - medium: Balanced spring (damping: 10, mass: 0.9) - slow: Smooth spring (damping: 20, stiffness: 60) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
wabicai
left a comment
There was a problem hiding this comment.
🔍 Code Review - Legacy Firmware Update
Issues Found
1. ⚠️ README.md Deletion (High Priority)
File: packages/kit/src/views/LegacyFirmwareUpdate/README.md
The entire README documentation has been replaced with just # ., effectively deleting all documentation for this feature module. This appears to be accidental.
Recommendation: Restore the original README content or create proper documentation for the Legacy Firmware Update feature.
2. 🔧 Missing Transport Type Locking Pattern (Medium Priority)
File: packages/kit-bg/src/services/ServiceLegacyFirmwareUpdate.ts
The ServiceLegacyFirmwareUpdate service doesn't implement the setForceTransportType pattern that ensures consistent transport layer usage during firmware updates. This pattern is used in the existing ServiceFirmwareUpdate to lock the transport type (USB/Bluetooth) during the update process, preventing connection switching mid-update.
Reference: See ServiceFirmwareUpdate.ts for the existing pattern implementation.
Recommendation: Consider adding transport type locking to ensure stable connections during legacy firmware updates, especially important when dealing with bootloader mode transitions.
Summary
| Priority | Issue | Status |
|---|---|---|
| High | README deletion | |
| Medium | Transport type locking | 📋 Consider adding |
🤖 Automated code review by Claude Code
…e update - Add transport type locking pattern to ServiceLegacyFirmwareUpdate to prevent auto-switching during firmware updates - Lock transport type at start, clear in finally block - Emit BeginFirmwareUpdate/FinishFirmwareUpdate events - Create proper README.md documentation for the feature module Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…riction - Remove firmware/bootloader version restrictions for Classic, Classic1s, ClassicPure devices so they all use normal startUpdateWorkflow - Add Mini USB-only warning on Native platforms (iOS/Android) since Mini has no Bluetooth - Auto-continue to normal ChangeLog modal after Legacy firmware update completes for remaining updates (bootloader, BLE, etc.) - Fix version parameter passing in Legacy firmware handlers (TouchFirmwareHandler, MiniFirmwareHandler, ClassicFirmwareHandler)
- Remove upfront bootloader mode check in MiniFirmwareHandler - Let SDK handle bootloader mode detection and throw FirmwareUpdateManuallyEnterBoot error - Catch the error and show bootloader mode guidance UI - Fix startLegacyUpdate to not set done state when needsBootloaderMode is true - Add cleanupAfterUpdate method to properly cleanup on success/error only - Keep running state and transport lock when waiting for bootloader mode This follows the same pattern as firmware-updater-web - rely on SDK's automatic handling rather than implementing custom pre-checks.
… guide - Add illustration image (enter-boot-guide-mini.png) to MiniBootloaderModeGuide - Add device polling (5s interval) when waiting for bootloader mode - Auto-restart firmware update when device is detected in bootloader mode - Show "Detecting device in bootloader mode..." status during polling - Replace deprecated 'space' prop with 'gap' for consistency
- Add isRestartingRef to prevent multiple restart attempts - Check if update still needs bootloader mode after restart attempt - If device not in bootloader mode yet, reset flag and continue polling - Remove immediate first poll to give user time to enter bootloader mode - Only stop polling when update actually succeeds or is in progress
- Remove redundant Alert component to simplify UI and avoid text overflow - Add bootloader mode verification in polling logic - Only start firmware update when device.features.bootloader_mode is true - Prevents flicker by not entering installing state until confirmed
The firmware update modal will be shown instead, so the toast is redundant. This prevents showing both a toast and a modal at the same time.
The firmware update modal will be shown instead of a toast. Similar to how DefectiveFirmware errors are handled.
Toast suppression should only apply during firmware update flow, not globally for all scenarios where this error might occur.
In all scenarios (firmware update, signing, etc.), the firmware update modal will be shown via ShowFirmwareUpdateForce event, so toast is redundant.
Summary
Add an independent firmware update flow for legacy devices on Web and Extension platforms. This feature handles devices with firmware versions below the minimum required limit, providing a dedicated upgrade path separate from the standard firmware update flow.
Latest Changes (2026-02-03)
Classic Series Unified Flow
startUpdateWorkflowMini USB Restriction
Legacy Flow Auto-Continue
Legacy Device Criteria
Devices will use the legacy firmware update flow when their version is below the minimum required version:
3.0.0(removed)2.0.0(removed)3.0.0(removed)2.0.0(removed)3.0.0(removed)2.0.0(removed)Hardware Compatibility Notes
Based on 硬件兼容变更文档:
RebootToBootloaderChanges
Service Layer:
ServiceLegacyFirmwareUpdate- Main service with device type detection and workflow managementState Management:
UI Components:
PageLegacyFirmwareUpdate- Main page componentLegacyFirmwareInstallingView- Unified progress view (same as normal flow)LegacyUpdateCheckList- Pre-update checklist with device info and confirmation itemsLegacyUpdateResult- Success/failure result display with retry optionMiniBootloaderModeGuide- Instructions for manually entering bootloader mode (Mini devices)WebUsbDeviceReselectPrompt- USB device reselection promptRouting:
Test Plan
🤖 Generated with Claude Code