Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 25, 2025

Creates a pluggable import system for bookmarks from various sources (CSV, Chrome, Firefox) with a dynamic Settings UI that allows users to import from different formats.

Interface Design

BookmarkImporter - Base interface all importers implement:

  • import(uri: Uri): RequestResult<ImportResult> - Parse and import bookmarks
  • getDisplayName(): String - UI display name
  • getSupportedMimeTypes(): Array<String> - File type filters

Implementations

  • CsvBookmarkImporter - Refactored existing CSV logic, maintains backward compatibility
  • HtmlBookmarkImporter - Abstract base using JSoup, handles common HTML bookmark parsing
  • ChromeBookmarkImporter - Chrome/Chromium HTML export format with folder structure
  • MozillaBookmarkImporter - Firefox HTML export, filters special folders

Repository & ViewModel Updates

interface ImportRepository {
    suspend fun importFromCsv(uri: Uri): RequestResult<ImportResult>  // Existing
    fun getAvailableImporters(): List<BookmarkImporter>                // New
    suspend fun importBookmarks(uri: Uri, importer: BookmarkImporter): RequestResult<ImportResult>  // New
}

ImportRepositoryImpl uses composition pattern with individual importers, delegating CSV import to CsvBookmarkImporter.import().

Added importBookmarks() and getAvailableImporters() methods to AccountViewModel to support the UI integration.

Settings UI Updates

The Settings screen now dynamically displays import options for all available importers:

Import & Export section includes:

  • 📥 Import from CSV
  • 📥 Import from Chrome Bookmarks
  • 📥 Import from Mozilla/Firefox Bookmarks
  • 📤 Export links (unchanged)

Each import option:

  • Opens a file picker with appropriate MIME type filters
  • Shows progress messages specific to the import type
  • Reports import results with counts of added and skipped bookmarks

The UI automatically generates options based on registered importers, making it extensible for future import formats.

Extension Pattern

Adding new formats requires implementing the interface and registering in ImportRepositoryImpl:

class SafariBookmarkImporter(context: Context, deeprQueries: DeeprQueries) : BookmarkImporter {
    override suspend fun import(uri: Uri) = /* parse Safari bookmarks */
    override fun getDisplayName() = "Safari Bookmarks"
    override fun getSupportedMimeTypes() = arrayOf("text/html")
}

Future candidates: Safari, Edge, JSON formats, Pocket/Instapaper integration.

Code Quality

  • ✅ All ktlint checks pass
  • ✅ Code review completed with no issues
  • ✅ Security scan (CodeQL) passed
  • ✅ Unit tests added for the import interface
  • ✅ Comprehensive documentation included

Fixes #228

Original prompt

This section details on the original issue you should resolve

<issue_title>Import Browser booksmarks</issue_title>
<issue_description>- Create a Import interface that can be extended to different type of imports like html file, chrome bookmarks, mozilla bookmarks, etc.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add import interface for browser bookmarks Add extensible bookmark import interface for browser formats Oct 25, 2025
Copilot AI requested a review from yogeshpaliyal October 25, 2025 14:03
Copilot finished work on behalf of yogeshpaliyal October 25, 2025 14:03
@yogeshpaliyal
Copy link
Owner

@copilot fox lint issues.

Copy link
Contributor Author

Copilot AI commented Oct 25, 2025

@copilot fox lint issues.

Fixed all ktlint issues in commit c233964. Changes include:

  • Converted function bodies to expression bodies
  • Removed trailing whitespace
  • Fixed multiline expression wrapping
  • Removed needless blank lines

All files now pass ktlint validation.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of yogeshpaliyal October 25, 2025 15:01
@yogeshpaliyal
Copy link
Owner

@copilot Add options to import from different places in settings page

Copy link
Contributor Author

Copilot AI commented Oct 25, 2025

@copilot Add options to import from different places in settings page

Added import options in Settings page (commit fac20c5). The Settings screen now displays dynamic import options for all available importers:

Import & Export section now includes:

  • 📥 Import from CSV
  • 📥 Import from Chrome Bookmarks
  • 📥 Import from Mozilla/Firefox Bookmarks
  • 📤 Export links (unchanged)

Each option opens a file picker with the appropriate MIME type filters. The UI dynamically generates options based on registered importers, making it easy to add new import formats in the future.

Copilot AI changed the title Add extensible bookmark import interface for browser formats Add extensible bookmark import interface with UI for multiple import formats Oct 25, 2025
Copilot finished work on behalf of yogeshpaliyal October 25, 2025 15:41
@yogeshpaliyal yogeshpaliyal marked this pull request as ready for review October 28, 2025 05:25
@yogeshpaliyal yogeshpaliyal merged commit 476f6fe into master Oct 28, 2025
1 check passed
@yogeshpaliyal yogeshpaliyal deleted the copilot/add-import-interface branch October 28, 2025 05:26
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.

Import Browser booksmarks

2 participants