openless icon indicating copy to clipboard operation
openless copied to clipboard

feat(windows): WebView2 lazy webviews + Android auto-update + history repolish

Open HKLHaoBin opened this issue 5 months ago • 1 comments

User description

Summary

  • Windows (WebView2 memory): Lazy-create auxiliary webviews (QA, less-computer, glow) and destroy them on dismiss; add QaStateSnapshot for cold-start hydrate; lazy-load FloatingShell tabs and Settings sections to shrink main-window first paint and idle renderer count.
  • Android auto-update: Background check/download with stable/beta channels, settings UI alignment, updater logic extraction + unit tests, CI release signing on dispatch when keystore secrets exist, and fixes for launch-time JNI crashes (Build.SUPPORTED_ABIS, accessibility state, ProGuard @Keep on bridge methods).
  • History (#653): Opt-in polish-unchanged detection, history-level repolish IPC/UI (excluding translation history), and preserve insert error codes on retry.
  • Dictation: Compute done_message before moving error_code into session (fixes a move-after-use bug).

Test plan

  • [ ] Windows: cold start — confirm main window loads; open/close QA panel, glow, less-computer; verify auxiliary webviews are created on demand and memory drops after dismiss
  • [ ] Windows: QA panel re-open after dismiss — state hydrates via snapshot
  • [ ] Android: launch app — no crash ~4s after start (updater background check)
  • [ ] Android: auto-update settings — stable/beta toggle, manual check, download + install flow
  • [ ] Android: overlay recording still works after foreground-service changes
  • [ ] History: enable polish-unchanged detection; verify repolish retry on unchanged polish; translation history excluded
  • [ ] Dictation: error paths still emit correct done message

PR Type

Bug fix, Enhancement, Tests


Description

  • Lazy-create auxiliary webviews (qa, less-computer)

  • Android auto-update with stable/beta channels

  • Detect polish unchanged and allow history repolish

  • Fix JNI read of Build.SUPPORTED_ABIS


Diagram Walkthrough

flowchart LR
  subgraph Desktop
    A[WebView2 lazy-create] --> B[qa/less-computer/glow]
    C[Hide→destroy] --> D[Free memory]
  end
  subgraph Android
    E[AutoUpdateGate] --> F[stable/beta manifest]
    F --> G[Download+install]
  end
  subgraph History
    H[Polish unchanged detection] --> I[mark polishUnchanged]
    I --> J[Repolish button]
  end

File Walkthrough

Relevant files
Enhancement
28 files
lib.rs
Add repolish/show QA window commands; lazy webview creation
+82/-33 
dictation.rs
Detect polish unchanged; resolve error codes; add tests   
+272/-9 
coordinator.rs
Add QA snapshot, repolish methods, style-pack resolution 
+137/-14
types.rs
Add polish_unchanged_enabled pref; update comments             
+17/-11 
history.rs
Add repolish_history_entry command                                             
+9/-0     
qa.rs
Add get_qa_window_state command and snapshot struct           
+13/-0   
mod.rs
Register updater_logic module                                                       
+1/-0     
AutoUpdate.tsx
Add autoInstallAndroid option; update dialog strings         
+80/-54 
QaPanel.tsx
Refactor state handling; add cold-start hydrate                   
+101/-59
FloatingShell.tsx
Lazy load non-overview tabs and settings modal                     
+38/-26 
History.tsx
Add repolish button and unchanged tag                                       
+51/-2   
types.ts
Add QaStateSnapshot, polishUnchangedEnabled fields             
+18/-6   
SettingsModal.tsx
Lazy load services, privacy, advanced tabs                             
+27/-7   
BetaChannelSection.tsx
Restructure layout; separate toggle and check button         
+12/-15 
ipc.ts
Add repolishHistoryEntry and getQaWindowState mocks           
+32/-0   
CheckUpdateButton.tsx
Show channel-specific button labels                                           
+5/-9     
AutoUpdateGate.tsx
Pass autoInstallAndroid to checkForUpdates                             
+6/-9     
AutoUpdateSection.tsx
Add Android auto-update toggle section                                     
+36/-0   
DataStorageSection.tsx
Add polish unchanged detection toggle                                       
+10/-1   
AdvancedTab.tsx
Compose advanced settings sections                                             
+34/-0   
PrivacyTab.tsx
Lazy load privacy tab                                                                       
+37/-0   
GeneralTab.tsx
Lazy load general tab                                                                       
+28/-0   
ServicesTab.tsx
Lazy load services tab                                                                     
+13/-0   
check-android-updater-pubkey.mjs
Add script to verify pubkey consistency                                   
+37/-0   
OpenLessOverlayBridge.kt
Adjust overlay bridge for new features                                     
+4/-0     
OpenLessAccessibilityService.kt
Align heartbeat with Rust-side checks                                       
+3/-0     
OpenLessUpdateInstaller.kt
Improve install result reporting                                                 
+4/-0     
OpenLessPermissionBridge.kt
Permission handling adjustments                                                   
+3/-0     
Bug fix
3 files
updater.rs
Extract constants; fix JNI field read; add install check 
+19/-65 
jni.rs
Rewrite accessibility checks via Settings.Secure                 
+136/-23
OpenLessOverlayService.kt
Update for background update integration                                 
+37/-18 
Tests
2 files
updater_logic.rs
Add version compare, manifest URLs, pubkey; unit tests     
+123/-0 
stylePrefs.test.ts
Add polishUnchangedEnabled to test defaults                           
+3/-2     
Documentation
7 files
ja.ts
Add Japanese translations for new features                             
+18/-1   
zh-TW.ts
Add Traditional Chinese translations                                         
+18/-1   
ko.ts
Add Korean translations                                                                   
+18/-1   
zh-CN.ts
Add Simplified Chinese translations                                           
+18/-1   
en.ts
Add English translations                                                                 
+18/-1   
android-mobile-apk-overlay-plan.md
Update documentation for auto-update                                         
+26/-2   
README.md
Update build instructions                                                               
+2/-0     
Configuration changes
3 files
android-apk.yml
Add release signing for manual dispatch                                   
+64/-10 
tauri.conf.json
Set create:false for auxiliary windows; update updater pubkey
+3/-0     
ci.yml
Add pubkey check job                                                                         
+3/-0     
Dependencies
1 files
package.json
Dependency adjustments for lazy loading                                   
+2/-1     
Additional files
1 files
tabs.tsx +0/-106 

HKLHaoBin avatar Jun 16 '26 14:06 HKLHaoBin

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

653 - Partially compliant

Compliant requirements:

  • 润色未变化检测:添加了 is_polish_unchanged 和 normalize_for_polish_compare 函数,在 end_session 中调用 resolve_polish_unchanged_error_code 生成 polishUnchanged 错误码。
  • 用户反馈:done_message 中返回中文提示“本次润色未产生变化,可在历史中重新润色”;历史详情页展示黄色提示条。
  • 历史记录标识:列表中添加 polishUnchanged Pill 标签;详情页显示提示块。
  • 重新润色操作:历史详情页提供「重新润色」按钮(触发 repolish_history_entry IPC),复用原 raw_transcript,无需重新录音。
  • 功能默认关闭(polish_unchanged_enabled: false),用户可在设置中开启。

Non-compliant requirements:

  • (无)

Requires further human verification:

  • (无)
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

github-actions[bot] avatar Jun 16 '26 14:06 github-actions[bot]

感谢投入,但这个 PR 先关闭一下 🙏

主要问题是一个 PR 里捆绑了三块互不相关的改动,共 1715 行 / 47 个文件:

  1. Windows WebView2 懒加载 / 内存优化(QaPanel、qa.rs、FloatingShell 懒加载等)
  2. Android 自动更新(OpenLessUpdateInstaller.kt、updater.rs / updater_logic.rs、AutoUpdate*.tsx、BetaChannelSection、android-apk.yml 等)
  3. 历史记录 repolish(History.tsx、history.rs)

这种捆绑违反单一职责,审查、回归、出问题时回滚都很困难;而且重型构建 CI(Linux / Windows / macOS checks)此前没跑过,只有 pr_agent_job。

建议按上面三个关注点拆成三个独立 PR,各自审查、各自合并。欢迎拆分后重新提交,关闭不代表否定其中任何一块。

Felix201209 avatar Jun 21 '26 09:06 Felix201209