fix: move card favourite star to bottom-right so it no longer overlaps the overflow button (v0.3.3.4)
build / Assemble debug APK (push) Failing after 9s

This commit is contained in:
Incido Developer committed 2026-08-17 12:59:10 +12:00
1 parent 5b82d2a9fe
commit 089926377c
44 files changed
+5490 -140

No files matched your search

@@ -14,7 +14,18 @@ data class Note(
val color: NoteColor = NoteColor.NONE,
/** Tags attached to this note (normalised lowercase, sorted ascending). */
val hashtags: List<String> = emptyList(),
/**
* v0.3.1.0 — files attached to this note (photo / document / etc).
* Metadata only; bytes are loaded on demand via
* [org.incido.domain.repository.NoteRepository.getAttachmentBytes].
* Sorted by [NoteAttachment.createdAt] ascending (oldest first)
* so the UI can render them in stable order.
*/
val attachments: List<NoteAttachment> = emptyList(),
) {
/** Convenience: the first image attachment, or `null` if none. */
val firstImageAttachment: NoteAttachment?
get() = attachments.firstOrNull { it.isImage }
companion object {
private const val UNTITLED = "Untitled"
@@ -0,0 +1,27 @@
package org.incido.domain.model
/**
* v0.3.1.0 — Metadata for a single file attached to a note.
*
* **Bytes are not part of this model.** They're stored in the
* database alongside the metadata row (see
* `NoteAttachmentEntity.bytes`) and loaded on demand via
* `NoteRepository.getAttachmentBytes(id)`. Keeping bytes out of the
* domain list payload means list snapshots stay cheap even for
* notes with many large attachments.
*/
data class NoteAttachment(
val id: Long,
val noteId: Long,
/** e.g. `image/jpeg`, `application/pdf`, `text/plain`. */
val mimeType: String,
/** User-visible filename (or generated name like `IMG_20260815.jpg`). */
val displayName: String,
/** Epoch millis, for stable ordering. */
val createdAt: Long,
/** Cached size in bytes — cheap to read; lets the UI show file sizes without loading bytes. */
val sizeBytes: Long,
) {
/** Convenience: true for any image-prefixed mime type. */
val isImage: Boolean get() = mimeType.startsWith("image/")
}
@@ -3,6 +3,7 @@ package org.incido.domain.repository
import kotlinx.coroutines.flow.Flow
import org.incido.domain.model.HashtagUsage
import org.incido.domain.model.Note
import org.incido.domain.model.NoteAttachment
/**
* Persistence boundary for [Note]s. The UI layer depends on this interface
@@ -43,6 +44,22 @@ interface NoteRepository {
/** Only notes that have zero hashtags, sorted by updatedAt DESC. */
fun observeUntagged(): Flow<List<Note>>
/**
* Context-aware search across **favourites only** — matches
* [Note.content] (contains, case-insensitive) AND any of the note's
* hashtags (case-insensitive equality), sorted by favourites first
* then newest-first. Blank [query] returns the same as
* [observeFavorites].
*/
fun searchFavorites(query: String): Flow<List<Note>>
/**
* Context-aware search across **untagged notes only** — matches
* [Note.content] (contains, case-insensitive), sorted newest-first.
* Blank [query] returns the same as [observeUntagged].
*/
fun searchUntagged(query: String): Flow<List<Note>>
/** Only notes tagged with [name] (normalised form), sorted by updatedAt DESC. */
fun observeNotesForHashtag(name: String): Flow<List<Note>>
@@ -81,4 +98,61 @@ interface NoteRepository {
* auto-deleted (cleanup is the future "tag browser" feature).
*/
suspend fun removeHashtag(noteId: Long, name: String)
/**
* Persist [note] and reconcile its hashtag set in a single database
* transaction: insert [hashtagsToAdd] (creating backing rows for any
* new tag names) and remove [hashtagsToRemove].
*
* Atomicity matters: the implementation wraps the upsert and the
* hashtag writes in a single store transaction so the observers
* subscribed by [observeHashtagsByRecentUse] fire **once** at commit
* time with the final state. Without that, three separate puts in
* sequence (noteBox, then tagBox, then cross-refBox) caused the
* drawer's hashtag-usage snapshot to read a transient empty
* cross-ref box and leave `emptyList()` stuck in the StateFlow —
* the new tag would only appear after some unrelated noteBox
* mutation (e.g. toggling the favourite star). See v0.3.0.5.
*
* Returns the persisted [Note] (with its assigned id when [note] was
* new). [hashtagsToAdd] / [hashtagsToRemove] should be in their
* normalised form (lowercase, no leading `#`, already validated).
*/
suspend fun saveNoteWithHashtags(
note: Note,
hashtagsToAdd: Set<String>,
hashtagsToRemove: Set<String>,
): Note
// --- Attachments (v0.3.1.0) ---
/**
* Stream of attachments (metadata only, no bytes) belonging to
* [noteId], sorted by [NoteAttachment.createdAt] ascending. Emits
* a fresh list whenever any attachment row changes for this note.
*/
fun observeAttachments(noteId: Long): Flow<List<NoteAttachment>>
/**
* Fetch the raw bytes for an attachment row. Returns `null` if no
* row exists with [id]. Use sparingly — bytes are the largest
* column in the store.
*/
suspend fun getAttachmentBytes(id: Long): ByteArray?
/**
* Insert a new attachment row for [noteId]. [bytes] is stored
* verbatim in the database (ObjectBox `ByteArray` column). The
* generated id is returned so the caller can reference the row
* (e.g. for display or removal).
*/
suspend fun addAttachment(
noteId: Long,
bytes: ByteArray,
mimeType: String,
displayName: String,
): Long
/** Delete an attachment by id. Idempotent. */
suspend fun removeAttachment(id: Long)
}