Skip to content

Conversation

@shrimpnaur
Copy link
Contributor

@shrimpnaur shrimpnaur commented Nov 20, 2025

Contributor checklist

  • This pull request is on a separate branch and not the main branch
  • I have tested my code with the ./gradlew lintKotlin detekt test command as directed in the testing section of the contributing guide

Description

This PR implements the data storage layer for the clipboard history feature (Issue #459).

Changes Made:

  • Created ClipboardDataManager class that manages clipboard item storage using SQLite
  • Implemented full CRUD operations: insert, retrieve (latest/pinned), pin/unpin, delete, clear, and time-based expiration
  • Added duplicate prevention to avoid storing consecutive identical clipboard items
  • Created ClipboardDataManagerTest with comprehensive test coverage for all operations
  • Integrated ClipboardDataManager into the DatabaseManagers, following the existing patterns

Testing:

  • All unit tests pass via ./gradlew test
  • Detekt and ktlint checks pass
  • Tests verify insert, retrieve, pin/unpin, delete, and expiration functionality

This is PR #1 from the following PRs (forming different parts of the implementation)

  1. Data Storage Layer (this PR)
  2. Clipboard Monitoring (next)
  3. UI Components
  4. Full Keyboard Integration

Related issue

@github-actions
Copy link

Thank you for the pull request! 💙

The Scribe-Android team will do our best to address your contribution as soon as we can. If you're not already a member of our public Matrix community, please consider joining! We'd suggest that you use the Element client as well as Element X for a mobile app, and definitely join the General and Android rooms once you're in. Also consider attending our bi-weekly Saturday dev syncs. It'd be great to meet you 😊

Note

Scribe uses Conventional Comments in reviews to make sure that communication is as clear as possible.

@github-actions
Copy link

github-actions bot commented Nov 20, 2025

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • The linting, formatting and testing workflows within the PR checks do not indicate new errors in the files changed

    • Tests may need to be reran as they're at times not deterministic
  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@andrewtavis
Copy link
Member

Hey @shrimpnaur 👋 Thanks so much for the PR! Could we ask that you fix the license headers and KTLint issues? You can also set up pre-commit as directed in the readme/contributing guide to check these rules on commit :)

@andrewtavis
Copy link
Member

Thanks so much, @shrimpnaur! We'll try to get to the review in the coming days :)

Copy link
Member

@angrezichatterbox angrezichatterbox left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @shrimpnaur.

I have added a suggestion. However I would like room to be used instead of this. I think room would be very helpful to use in long term. We did SQL queries without room earlier as we had existing Sqlite databases. However we could think about changing them as well at some point.

Comment on lines +12 to +19
*/
data class ClipboardItem(
val id: Long,
val text: String,
val timestampMs: Long,
val isPinned: Boolean,
)

Copy link
Member

Choose a reason for hiding this comment

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

This could be made into a separate file rather than having it here itself. Import and use it here instead.

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.

3 participants