Skip to content

feat(search): Implement automatic GitHub link detection from clipboard#278

Merged
rainxchzed merged 2 commits intomainfrom
feat-translate
Mar 1, 2026
Merged

feat(search): Implement automatic GitHub link detection from clipboard#278
rainxchzed merged 2 commits intomainfrom
feat-translate

Conversation

@rainxchzed
Copy link
Member

@rainxchzed rainxchzed commented Mar 1, 2026

This commit introduces a feature that automatically detects GitHub links in the clipboard when opening the search screen. It includes the necessary logic to monitor the clipboard setting and UI strings for multiple languages.

  • feat(search): Updated SearchViewModel to observe the autoDetectClipboardLinks setting. When enabled, it triggers a clipboard check and updates the state with detected links and banner visibility; when disabled, it clears detected links and hides the banner.
  • i18n: Added string resources for clipboard detection features (e.g., "Open GitHub link", "Clipboard link detected", "Auto detect clipboard links") across multiple locales including Turkish, Spanish, Chinese, French, Hindi, Italian, Japanese, Korean, Polish, Bengali, and Russian.

Summary by CodeRabbit

  • New Features
    • Added clipboard link auto-detection functionality with configurable toggle
    • Added multi-language support for clipboard link detection UI across 11 languages (Bengali, Spanish, French, Hindi, Italian, Japanese, Korean, Polish, Russian, Turkish, and Chinese)
    • Enhanced state management to properly handle clipboard link data based on feature activation status

This commit introduces a feature that automatically detects GitHub links in the clipboard when opening the search screen. It includes the necessary logic to monitor the clipboard setting and UI strings for multiple languages.

- **feat(search)**: Updated `SearchViewModel` to observe the `autoDetectClipboardLinks` setting. When enabled, it triggers a clipboard check and updates the state with detected links and banner visibility; when disabled, it clears detected links and hides the banner.
- **i18n**: Added string resources for clipboard detection features (e.g., "Open GitHub link", "Clipboard link detected", "Auto detect clipboard links") across multiple locales including Turkish, Spanish, Chinese, French, Hindi, Italian, Japanese, Korean, Polish, Bengali, and Russian.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb61bbd and 3e28828.

📒 Files selected for processing (12)
  • core/presentation/src/commonMain/composeResources/values-bn/strings-bn.xml
  • core/presentation/src/commonMain/composeResources/values-es/strings-es.xml
  • core/presentation/src/commonMain/composeResources/values-fr/strings-fr.xml
  • core/presentation/src/commonMain/composeResources/values-hi/strings-hi.xml
  • core/presentation/src/commonMain/composeResources/values-it/strings-it.xml
  • core/presentation/src/commonMain/composeResources/values-ja/strings-ja.xml
  • core/presentation/src/commonMain/composeResources/values-kr/strings-kr.xml
  • core/presentation/src/commonMain/composeResources/values-pl/strings-pl.xml
  • core/presentation/src/commonMain/composeResources/values-ru/strings-ru.xml
  • core/presentation/src/commonMain/composeResources/values-tr/strings-tr.xml
  • core/presentation/src/commonMain/composeResources/values-zh-rCN/strings-zh-rCN.xml
  • feature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchViewModel.kt

Walkthrough

Adds seven new localization strings for GitHub/clipboard link handling across eleven language files and updates SearchViewModel to atomically update clipboard-related state and trigger a clipboard link check when auto-detect is enabled.

Changes

Cohort / File(s) Summary
Localization Strings
core/presentation/src/commonMain/composeResources/values-bn/strings-bn.xml, core/presentation/src/commonMain/composeResources/values-es/strings-es.xml, core/presentation/src/commonMain/composeResources/values-fr/strings-fr.xml, core/presentation/src/commonMain/composeResources/values-hi/strings-hi.xml, core/presentation/src/commonMain/composeResources/values-it/strings-it.xml, core/presentation/src/commonMain/composeResources/values-ja/strings-ja.xml, core/presentation/src/commonMain/composeResources/values-kr/strings-kr.xml, core/presentation/src/commonMain/composeResources/values-pl/strings-pl.xml, core/presentation/src/commonMain/composeResources/values-ru/strings-ru.xml, core/presentation/src/commonMain/composeResources/values-tr/strings-tr.xml, core/presentation/src/commonMain/composeResources/values-zh-rCN/strings-zh-rCN.xml
Added seven identical string resources in each file: open_github_link, clipboard_link_detected, auto_detect_clipboard_links, auto_detect_clipboard_description, detected_links, open_in_app, no_github_link_in_clipboard.
View Model State Management
feature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchViewModel.kt
Updated observeClipboardSetting to update autoDetectClipboardEnabled, clipboardLinks (cleared when disabled), and isClipboardBannerVisible atomically; added immediate call to checkClipboardForLinks() when enabling auto-detect.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through code with tiny paws,

New words for links and clipboard laws,
Eleven tongues to help us find,
The GH links hiding in your mind,
Hop—now the app will seek and show! ✨🔗

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-translate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rainxchzed rainxchzed merged commit b154c49 into main Mar 1, 2026
1 check passed
@rainxchzed rainxchzed deleted the feat-translate branch March 1, 2026 10:18
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