feat: v0.4.1.0 — colour filters, drafts, empty trash, editor polish
Ships everything staged since v0.4.0.0 as v0.4.1.0: - Colour filters: a five-swatch strip under the drawer's Favorites narrows the list to active notes of that colour (NoteFilter ByColor, observeByColor/searchByColor, color:<NAME> route). - Auto-saved drafts: new notes persist as drafts while typed (Note.isDraft, Drafts filter + drawer row, debounced autosave with flush-on-exit) and ride along in encrypted backups. - Empty Trash: a DeleteForever button + confirmation dialog in the Trash view; deleteAllTrashed() cascades hashtag xrefs and attachments exactly like delete(). - Editor row rebuild: EditorLineField unified on one underlined BasicTextField (M3 TextField's 56 dp min container was the root of the double-height rows); checklist controls centre vertically beside wrapping labels. - Untitled drafts read "Shopping List — (draft)" on cards and in the editor bar via NoteType.displayName (display-only; stored content untouched). Version lockstep per §11.1: versionCode 36, versionName 0.4.1.0, APP_VERSION, README intro + smoke-test checklist, PREVIOUS_HISTORY.md section, ReleaseNotes.RECENT (v0.3.7.0 drops off the tail), Dev Plan §10 row.
This commit is contained in:
1 parent
d45cb7c31e
commit
d9043db857
20 files changed
+777
-112
No files matched your search
@@ -24,6 +24,14 @@ data class Note(
|
||||
val attachments: List<NoteAttachment> = emptyList(),
|
||||
/** True only for notes moved to the Trash view; active-note queries exclude these rows. */
|
||||
val isTrashed: Boolean = false,
|
||||
/**
|
||||
* True while a new note is being drafted. Drafts auto-save every
|
||||
* edit and are visible only in the Drafts view — Home / Favorites /
|
||||
* Untagged / tag / colour views / ordinary search / Trash all
|
||||
* exclude them. Saving from the editor (or moving to Trash) clears
|
||||
* the flag.
|
||||
*/
|
||||
val isDraft: Boolean = false,
|
||||
/** v0.3.8.0 — which editor surface opens this note (see [NoteType]). */
|
||||
val type: NoteType = NoteType.TEXT,
|
||||
) {
|
||||
@@ -31,7 +39,8 @@ data class Note(
|
||||
val firstImageAttachment: NoteAttachment?
|
||||
get() = attachments.firstOrNull { it.isImage }
|
||||
companion object {
|
||||
private const val UNTITLED = "Untitled"
|
||||
/** Shown when a note's content has no usable first line. */
|
||||
const val UNTITLED = "Untitled"
|
||||
|
||||
/**
|
||||
* Splits [content] into a (title, body) pair. The title is the first
|
||||
|
||||
@@ -5,13 +5,13 @@ package org.incido.domain.model
|
||||
* Stored as a short (`SHORT`) in ObjectBox — additive-safe migration from
|
||||
* the v0.1 schema.
|
||||
*/
|
||||
enum class NoteColor(val storageKey: Short) {
|
||||
NONE(0),
|
||||
BLUE(1),
|
||||
GREEN(2),
|
||||
AMBER(3),
|
||||
RED(4),
|
||||
PURPLE(5);
|
||||
enum class NoteColor(val storageKey: Short, val label: String) {
|
||||
NONE(0, "None"),
|
||||
BLUE(1, "Blue"),
|
||||
GREEN(2, "Green"),
|
||||
AMBER(3, "Amber"),
|
||||
RED(4, "Red"),
|
||||
PURPLE(5, "Purple");
|
||||
|
||||
companion object {
|
||||
/** Convert from the stored [Short] back to the enum, defaulting to [NONE]. */
|
||||
|
||||
@@ -9,21 +9,29 @@ package org.incido.domain.model
|
||||
* - [Favorites] — only notes with `isFavorite = true`; ordinary search is enabled.
|
||||
* - [Untagged] — only notes that have zero hashtags; ordinary search is enabled.
|
||||
* - [ByTag] — only notes tagged with [hashtag]; text search is not offered.
|
||||
* - [ByColor] — active notes with accent colour [color]; ordinary search is
|
||||
* enabled and narrows within the colour (like Favorites).
|
||||
* - [Drafts] — auto-saved new notes; visible nowhere else until saved
|
||||
* or trashed. Ordinary search is enabled.
|
||||
* - [Trash] — only notes moved out of the active list; no edit actions.
|
||||
*/
|
||||
sealed class NoteFilter {
|
||||
object Home : NoteFilter()
|
||||
object Favorites : NoteFilter()
|
||||
object Untagged : NoteFilter()
|
||||
object Drafts : NoteFilter()
|
||||
object Trash : NoteFilter()
|
||||
data class ByTag(val hashtag: String) : NoteFilter()
|
||||
data class ByColor(val color: NoteColor) : NoteFilter()
|
||||
|
||||
/** Stable identifier used by the drawer for `selected` matching. */
|
||||
fun key(): String = when (this) {
|
||||
Home -> "home"
|
||||
Favorites -> "favorites"
|
||||
Untagged -> "untagged"
|
||||
Drafts -> "drafts"
|
||||
Trash -> "trash"
|
||||
is ByTag -> "tag:$hashtag"
|
||||
is ByColor -> "color:${color.name}"
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,15 @@ package org.incido.domain.model
|
||||
* Stored as a `Short` in ObjectBox — additive-safe migration from
|
||||
* the pre-v0.3.8.0 schema (rows without the column default to [TEXT]).
|
||||
*/
|
||||
enum class NoteType(val storageKey: Short) {
|
||||
enum class NoteType(val storageKey: Short, val displayName: String) {
|
||||
/** Free-form body edited in the plain multi-line field. */
|
||||
TEXT(0),
|
||||
TEXT(0, "Text Note"),
|
||||
|
||||
/** Editable checklist: checkbox + item text rows. */
|
||||
TASK_LIST(1),
|
||||
TASK_LIST(1, "Task List"),
|
||||
|
||||
/** Checklist plus a per-item cost (number pad) and a running total. */
|
||||
SHOPPING_LIST(2);
|
||||
SHOPPING_LIST(2, "Shopping List");
|
||||
|
||||
companion object {
|
||||
/** Convert from the stored [Short] back to the enum, defaulting to [TEXT]. */
|
||||
|
||||
@@ -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.NoteColor
|
||||
import org.incido.domain.model.NoteAttachment
|
||||
|
||||
/**
|
||||
@@ -37,6 +38,13 @@ interface NoteRepository {
|
||||
/** Permanently delete a note by id. No-op if it doesn't exist. */
|
||||
suspend fun delete(id: Long)
|
||||
|
||||
/**
|
||||
* "Empty Trash": permanently delete EVERY trashed note in one go,
|
||||
* with the same cascade as [delete] (row + hashtag links +
|
||||
* attachment blobs). No-op when the Trash is already empty.
|
||||
*/
|
||||
suspend fun deleteAllTrashed()
|
||||
|
||||
/** Move a note to Trash without removing its row, tags, or attachments. */
|
||||
suspend fun softDelete(id: Long)
|
||||
|
||||
@@ -56,6 +64,35 @@ interface NoteRepository {
|
||||
/** Only notes in Trash, sorted by updatedAt DESC. */
|
||||
fun observeTrashed(): Flow<List<Note>>
|
||||
|
||||
/**
|
||||
* Only auto-saved draft notes (new notes the user hasn't saved yet),
|
||||
* sorted favourites-first then newest-first. Drafts appear in no
|
||||
* other view — see [Note.isDraft].
|
||||
*/
|
||||
fun observeDrafts(): Flow<List<Note>>
|
||||
|
||||
/**
|
||||
* Context-aware content search across drafts only; blank [query]
|
||||
* returns the same as [observeDrafts].
|
||||
*/
|
||||
fun searchDrafts(query: String): Flow<List<Note>>
|
||||
|
||||
/**
|
||||
* Only **active** notes (never trashed) whose accent colour is
|
||||
* [color], sorted favourites-first then newest-first. Tagged and
|
||||
* untagged notes are both eligible — only the colour matters.
|
||||
*/
|
||||
fun observeByColor(color: NoteColor): Flow<List<Note>>
|
||||
|
||||
/**
|
||||
* Context-aware search across notes of [color] only — matches
|
||||
* [Note.content] (contains, case-insensitive) AND any of the
|
||||
* note's hashtags (case-insensitive equality), intersected with
|
||||
* the colour and the active (non-trashed) set. Blank [query]
|
||||
* returns the same as [observeByColor].
|
||||
*/
|
||||
fun searchByColor(query: String, color: NoteColor): Flow<List<Note>>
|
||||
|
||||
/**
|
||||
* Context-aware search across **favourites only** — matches
|
||||
* [Note.content] (contains, case-insensitive) AND any of the note's
|
||||
|
||||
Reference in new issue
Block a user