feat: v0.3.0.0 — hashtags (visible on editor) + bolder colour accent + centred title + nav drawer + new version scheme
v0.3.0.0 bundles four user-facing features, the plan-compliance polish
that was deferred from v0.2, and a permanent change to how we name
releases going forward.
VERSION SCHEME (app/build.gradle.kts)
- versionName = '0.3.0.0' (MAJOR.MINOR.MAINTENANCE.EMERGENCY)
- versionCode = 5
- New gradle taskGraph validator fails the build if versionName
doesn't match ^\d+\.\d+\.\d+\.\d+$ — we can't accidentally
regress the scheme.
- History re-keyed across README, Plan §10, CONTRIBUTING.md.
HASHTAGS
- value class Hashtag (domain/model) with normalise/parseOrNull
helpers; pattern: ^[a-z0-9][a-z0-9._-]{0,30}$
- data class HashtagUsage (name, noteCount, lastUsedAt)
- sealed class NoteFilter { Home, Favorites, Untagged, ByTag(name) }
- Note gains hashtags: List<String> (sorted ascending)
- Repository:
- new entities HashtagEntity (@Index on name) and
NoteHashtagCrossRef (many-to-many junction)
- new methods: observeFavorites / observeUntagged /
observeNotesForHashtag / observeHashtagsByRecentUse /
observeAllHashtags / searchHashtags / addHashtag / removeHashtag
- search() now matches content OR hashtag-name (case-insensitive)
- ObjectBox queries use explicit StringOrder + type annotations
(kapt's stubs are finicky around Property<String> overloads)
UI
- CenterAlignedTopAppBar on both list and editor screens
- List:
- Hamburger top-left opens a ModalNavigationDrawer (Home /
Favorites / Untagged / divider / scrollable Recent tags)
- Drawer selection drives a NoteFilter state held at root
- Search bar visible only when filter == Home
- NoteCard redesign — 14 dp vertical gradient stripe +
tinted surface (12 % colour blend) + 10 dp corner chip
- Empty-state copy is filter-aware
- Editor:
- Persistent hashtag chip row above the text field
- Tag # icon in the top bar + '+ add' chip opens a ModalBottomSheet
- Autocomplete suggestions live from repository.searchHashtags
- '+ Create name' button when the typed value is valid + new
- Snackbar 'Maximum 5 tags reached.' when the cap is hit
- Reconciled on save via addHashtag / removeHashtag diff
DOCS
- README v0.3.0.0 section + re-keyed changelog
- Development Plan §10 history re-keyed (0.1.0.0 / 0.1.1.0 /
0.2.0.0 / 0.2.0.1 / 0.3.0.0)
- CONTRIBUTING.md release-process note updated for the new scheme
VERIFIED
- ./gradlew assembleDebug assembleRelease both green
- Debug 25.7 MB, release 19.8 MB (v2-signed)
- versionCode=5, versionName='0.3.0.0'
- No INTERNET permission
- Validator regression: setting versionName='0.3' causes
assembleDebug to fail with the new scheme error message
This commit is contained in:
1 parent
84900838f7
commit
d616ce3021
20 files changed
+1285
-251
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package org.incido.domain.model
|
||||
|
||||
/**
|
||||
* A single hashtag, normalised: lowercase, no leading `#`, no
|
||||
* surrounding whitespace. The [name] is the on-disk identifier so
|
||||
* two notes tagging "Work" and "work" share a row.
|
||||
*
|
||||
* Allowed characters: `a-z`, `0-9`, `.`, `_`, `-`. Must start with an
|
||||
* alphanumeric. Length 1..31.
|
||||
*/
|
||||
@JvmInline
|
||||
value class Hashtag(val name: String) {
|
||||
init {
|
||||
require(name.matches(Regex("^[a-z0-9][a-z0-9._-]{0,30}$"))) {
|
||||
"Invalid hashtag name: \"$name\". Must match ^[a-z0-9][a-z0-9._-]{0,30}$"
|
||||
}
|
||||
}
|
||||
|
||||
/** Render with leading `#` for display. */
|
||||
fun displayName(): String = "#$name"
|
||||
|
||||
companion object {
|
||||
/** Normalise raw user input — trim, lowercase, strip leading `#`s. */
|
||||
fun normalise(raw: String): String =
|
||||
raw.trim().lowercase().trimStart('#').trim()
|
||||
|
||||
/** Try to parse; returns null when the input doesn't match the rules. */
|
||||
fun parseOrNull(raw: String): Hashtag? {
|
||||
val n = normalise(raw)
|
||||
return if (n.matches(Regex("^[a-z0-9][a-z0-9._-]{0,30}$"))) Hashtag(n) else null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.incido.domain.model
|
||||
|
||||
/**
|
||||
* Aggregate info about a single hashtag, for the nav drawer's "Recent
|
||||
* tags" list.
|
||||
*/
|
||||
data class HashtagUsage(
|
||||
val name: String,
|
||||
val noteCount: Int,
|
||||
val lastUsedAt: Long,
|
||||
)
|
||||
@@ -12,6 +12,8 @@ data class Note(
|
||||
val updatedAt: Long,
|
||||
val isFavorite: Boolean = false,
|
||||
val color: NoteColor = NoteColor.NONE,
|
||||
/** Tags attached to this note (normalised lowercase, sorted ascending). */
|
||||
val hashtags: List<String> = emptyList(),
|
||||
) {
|
||||
companion object {
|
||||
private const val UNTITLED = "Untitled"
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.incido.domain.model
|
||||
|
||||
/**
|
||||
* What the note list is currently showing. Drives both the
|
||||
* `NoteListScreen` body and the selected entry in the navigation
|
||||
* drawer.
|
||||
*
|
||||
* - [Home] — every note (the default). The search bar is enabled.
|
||||
* - [Favorites] — only notes with `isFavorite = true`. No search.
|
||||
* - [Untagged] — only notes that have zero hashtags. No search.
|
||||
* - [ByTag] — only notes tagged with [hashtag]. No search.
|
||||
*/
|
||||
sealed class NoteFilter {
|
||||
object Home : NoteFilter()
|
||||
object Favorites : NoteFilter()
|
||||
object Untagged : NoteFilter()
|
||||
data class ByTag(val hashtag: String) : NoteFilter()
|
||||
|
||||
/** Stable identifier used by the drawer for `selected` matching. */
|
||||
fun key(): String = when (this) {
|
||||
Home -> "home"
|
||||
Favorites -> "favorites"
|
||||
Untagged -> "untagged"
|
||||
is ByTag -> "tag:$hashtag"
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,26 @@
|
||||
package org.incido.domain.repository
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import org.incido.domain.model.HashtagUsage
|
||||
import org.incido.domain.model.Note
|
||||
|
||||
/**
|
||||
* Persistence boundary for [Note]s. The UI layer depends on this interface
|
||||
* only — never on the ObjectBox-backed implementation in `:core:data`.
|
||||
*
|
||||
* Implementations are expected to:
|
||||
* - Return a [Flow] that emits whenever the underlying data changes,
|
||||
* so the list screen satisfies F7 (auto-refresh).
|
||||
* - Assign a fresh id (0 or 0L on construction) for new notes and use the
|
||||
* ObjectBox-managed id once persisted.
|
||||
* - Sort [observeAll] / [search] with favourites first, then by [Note.updatedAt]
|
||||
* descending.
|
||||
* Sort order for [observeAll] / [search]: `isFavorite DESC, updatedAt DESC`.
|
||||
* [search] additionally matches against any of the note's hashtags
|
||||
* (case-insensitive equality).
|
||||
*/
|
||||
interface NoteRepository {
|
||||
/** Stream of all notes, newest-first, favourites pinned to the top. */
|
||||
fun observeAll(): Flow<List<Note>>
|
||||
|
||||
/**
|
||||
* Stream of notes whose [Note.content] contains [query] (case-insensitive),
|
||||
* favourites first then newest-first. An empty / blank [query] returns
|
||||
* the same list as [observeAll].
|
||||
* Stream of notes whose [Note.content] contains [query] (case-insensitive)
|
||||
* OR whose hashtags contain [query] as one of the names. Favourites
|
||||
* first then newest-first. Blank [query] returns the same as
|
||||
* [observeAll].
|
||||
*/
|
||||
fun search(query: String): Flow<List<Note>>
|
||||
|
||||
@@ -37,4 +35,50 @@ interface NoteRepository {
|
||||
|
||||
/** Toggle the favourite flag on a single note. */
|
||||
suspend fun setFavorite(id: Long, isFavorite: Boolean)
|
||||
|
||||
// --- Filter streams (v0.3.0.0) ---
|
||||
/** Only notes with `isFavorite = true`, sorted by updatedAt DESC. */
|
||||
fun observeFavorites(): Flow<List<Note>>
|
||||
|
||||
/** Only notes that have zero hashtags, sorted by updatedAt DESC. */
|
||||
fun observeUntagged(): Flow<List<Note>>
|
||||
|
||||
/** Only notes tagged with [name] (normalised form), sorted by updatedAt DESC. */
|
||||
fun observeNotesForHashtag(name: String): Flow<List<Note>>
|
||||
|
||||
/**
|
||||
* Every distinct hashtag, sorted by `lastUsedAt DESC` then
|
||||
* `noteCount DESC` then `name ASC`. Each entry also carries the
|
||||
* number of notes that use it.
|
||||
*/
|
||||
fun observeHashtagsByRecentUse(): Flow<List<HashtagUsage>>
|
||||
|
||||
// --- Hashtag autocomplete (v0.3.0.0) ---
|
||||
/**
|
||||
* Every distinct hashtag in the store, sorted by usage count DESC
|
||||
* then name ASC. Used to populate the autocomplete "suggestions"
|
||||
* list when the input is empty.
|
||||
*/
|
||||
fun observeAllHashtags(): Flow<List<String>>
|
||||
|
||||
/**
|
||||
* Hashtags whose name starts with [prefix] (case-insensitive),
|
||||
* sorted by usage count DESC then name ASC. Blank [prefix] is
|
||||
* equivalent to [observeAllHashtags].
|
||||
*/
|
||||
fun searchHashtags(prefix: String): Flow<List<String>>
|
||||
|
||||
/**
|
||||
* Add [name] to the note's hashtag set. Creates the hashtag row
|
||||
* if it doesn't exist yet. Idempotent. No-op if the note already
|
||||
* has the tag.
|
||||
*/
|
||||
suspend fun addHashtag(noteId: Long, name: String)
|
||||
|
||||
/**
|
||||
* Remove [name] from the note's hashtag set. Idempotent. No-op if
|
||||
* the note doesn't have the tag. The hashtag row itself is NOT
|
||||
* auto-deleted (cleanup is the future "tag browser" feature).
|
||||
*/
|
||||
suspend fun removeHashtag(noteId: Long, name: String)
|
||||
}
|
||||
Reference in new issue
Block a user