Skip to content

fix(ratewise): 修正 TikTok iOS 內建瀏覽器漏判與減動偏好#455

Merged
s123104 merged 2 commits into
mainfrom
review/ui
Jun 27, 2026
Merged

fix(ratewise): 修正 TikTok iOS 內建瀏覽器漏判與減動偏好#455
s123104 merged 2 commits into
mainfrom
review/ui

Conversation

@s123104

@s123104 s123104 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

摘要

Hotfix:TikTok iOS 內建瀏覽器未被辨識,導致該環境使用者看不到「改用外部瀏覽器開啟」安裝指引;並補齊 prefers-reduced-motion 對安裝步驟脈動動畫的停用。

由並行 Cursor code-review 子代理(composer-2.5-fast,獨立 worktree)在審查 #430 動畫指引功能時發現並修復。

根因

apps/ratewise/src/utils/pwaInstallGuide.ts 的 TikTok UA 規則 /\b(...|musical_ly)\b/i:TikTok iOS 的 UA 為 musical_ly_37.0.0musical_ly 後接底線 _(屬 word char),末端 \b 永遠不成立 → 漏判 → inAppBrowser 為 null → 不顯示外開指引與右上角動畫。

變更

  • regex 改為 /\b(TikTok|BytedanceWebview|musical_ly[\d._]*)/i,吃掉版本後綴。
  • index.cssprefers-reduced-motion 區塊加入 .animate-pulse-soft(安裝步驟 1 使用),完成減動覆蓋。
  • 新增 TikTok iOS UA 偵測單元測試。

Test plan

  • vitest run pwaInstallGuide.test.ts PwaInstallGuide.test.tsx → 13/13 通過
  • diff 最小、KISS、無多餘註解;無其他偵測規則回歸

🤖 Generated with Claude Code

- TikTok iOS UA 為 musical_ly_<版本>,底線破壞 \b 邊界導致漏判,改為 musical_ly[\d._]*
- 漏判使 TikTok iOS 使用者看不到「改用外部瀏覽器開啟」安裝指引
- prefers-reduced-motion 一併停用安裝步驟使用的 animate-pulse-soft
- 補 TikTok iOS UA 偵測單元測試

測試:pnpm --filter @app/ratewise exec vitest run pwaInstallGuide 與 PwaInstallGuide 共 13 項通過
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

Copy link
Copy Markdown
Contributor

✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。

  • ✅ Sitemap 2026 標準
  • ✅ Breadcrumb Schema
  • ✅ JSON-LD 結構化數據
  • ✅ 內部連結結構

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb65e74609

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1 to +3
---
'@app/ratewise': patch
---

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 補上 002 稽核紀錄

AGENTS.md 的 AGT-LOG-01 要求每次 git commit 前更新 docs/dev/002_development_reward_penalty_log.md,且需包含本次分數變化與累計總分;但我檢查此 commit 的 diff,只新增 changeset、程式與測試,未包含 002 更新。這會讓提交不符合 repo SOP/稽核控制,請在同一變更補上 002 條目與分數更新。

Useful? React with 👍 / 👎.

['facebook', /\b(FBAN|FBAV|FBIOS|FB_IAB|FB4A)\b/i],
['line', /\bLine\//i],
['tiktok', /\b(TikTok|BytedanceWebview|musical_ly)\b/i],
['tiktok', /\b(TikTok|BytedanceWebview|musical_ly[\d._]*)/i],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 保留 TikTok 規則的結尾邊界

這裡為了支援 musical_ly_37.0.0 移除了整個 alternation 的結尾邊界,因此 UA 只要含有 TikTokerBytedanceWebviewX 這類以現有 token 開頭的字串,也會被判成 TikTok 內建瀏覽器。因為 getPwaInstallEnvironmentinAppBrowser !== null 時即使平台是 desktop/unknown 也會顯示外部瀏覽器指引,這些 UA 會看到錯誤的 PWA 提示;建議只放寬 musical_ly 的版本後綴,其他 token 仍保留完整邊界。

Useful? React with 👍 / 👎.

- musical_ly[\d._]* 會誤判 musical_lyric,改為要求 _<版本> 才命中
- 補 trill_<版本> TikTok iOS 形式;TikTok/BytedanceWebview 維持邊界
- 測試改 table-driven,含 musical_lyric/Safari 反例

測試:pwaInstallGuide 與 PwaInstallGuide 18 項通過、tsc 通過
@github-actions

Copy link
Copy Markdown
Contributor

✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。

  • ✅ Sitemap 2026 標準
  • ✅ Breadcrumb Schema
  • ✅ JSON-LD 結構化數據
  • ✅ 內部連結結構

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f09dfe730

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

['facebook', /\b(FBAN|FBAV|FBIOS|FB_IAB|FB4A)\b/i],
['line', /\bLine\//i],
['tiktok', /\b(TikTok|BytedanceWebview|musical_ly)\b/i],
['tiktok', /\b(TikTok|BytedanceWebview|musical_ly_[\d.]+|trill_[\d.]+)/i],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 保留 bare musical_ly 偵測

這個改動把舊有可命中的 musical_ly 單獨 token 改成只接受 musical_ly_ + 版本數字;若 TikTok UA 仍是舊規則原本支援的 ... musical_ly JsSdk/...detectInAppBrowser 會回傳 null,PwaInstallGuide.getGuideCopy 便走 iOS/Android 一般安裝文案而不是外部瀏覽器文案(apps/ratewise/src/components/PwaInstallGuide.tsx:42),導致內建瀏覽器使用者仍看不到正確外開指引。建議在支援版本後綴時保留 bare musical_ly 分支。

Useful? React with 👍 / 👎.

@s123104 s123104 merged commit 935e52f into main Jun 27, 2026
17 checks passed
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.

1 participant