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
@@ -1,49 +1,119 @@
|
||||
package org.incido.compose
|
||||
|
||||
import androidx.compose.material3.DrawerValue
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ModalNavigationDrawer
|
||||
import androidx.compose.material3.rememberDrawerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||
import androidx.compose.runtime.toMutableStateList
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import androidx.navigation.navArgument
|
||||
import kotlinx.coroutines.launch
|
||||
import org.incido.compose.ui.drawer.IncidoDrawer
|
||||
import org.incido.compose.ui.editor.NoteEditorScreen
|
||||
import org.incido.compose.ui.notelist.NoteListScreen
|
||||
import org.incido.compose.ui.theme.IncidoTheme
|
||||
import org.incido.domain.model.NoteFilter
|
||||
|
||||
/** Top-level navigation destinations. */
|
||||
private object Routes {
|
||||
const val LIST = "list"
|
||||
const val EDITOR = "editor/{noteId}"
|
||||
fun editor(noteId: Long?): String =
|
||||
"editor/${noteId ?: -1L}"
|
||||
fun editor(noteId: Long?): String = "editor/${noteId ?: -1L}"
|
||||
}
|
||||
|
||||
/** Stable serialisation for [NoteFilter] so `rememberSaveable` works. */
|
||||
private fun NoteFilter.toSaveableKey(): String = key()
|
||||
|
||||
private fun String.toNoteFilter(): NoteFilter = when {
|
||||
this == "home" -> NoteFilter.Home
|
||||
this == "favorites" -> NoteFilter.Favorites
|
||||
this == "untagged" -> NoteFilter.Untagged
|
||||
startsWith("tag:") -> NoteFilter.ByTag(this.removePrefix("tag:"))
|
||||
else -> NoteFilter.Home
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun IncidoApp() {
|
||||
IncidoTheme {
|
||||
val navController = rememberNavController()
|
||||
NavHost(navController = navController, startDestination = Routes.LIST) {
|
||||
composable(Routes.LIST) {
|
||||
NoteListScreen(
|
||||
onOpenEditor = { id -> navController.navigate(Routes.editor(id)) },
|
||||
)
|
||||
}
|
||||
composable(
|
||||
route = Routes.EDITOR,
|
||||
arguments = listOf(
|
||||
navArgument("noteId") {
|
||||
type = NavType.LongType
|
||||
defaultValue = -1L
|
||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||
val scope = rememberCoroutineScope()
|
||||
var filterMode by rememberSaveable(
|
||||
stateSaver = androidx.compose.runtime.saveable.Saver(
|
||||
save = { it.toSaveableKey() },
|
||||
restore = { it.toNoteFilter() },
|
||||
),
|
||||
) { mutableStateOf<NoteFilter>(NoteFilter.Home) }
|
||||
|
||||
val currentBackStack by navController.currentBackStackEntryAsState()
|
||||
val currentRoute = currentBackStack?.destination?.route?.substringBefore("/")
|
||||
// Disable the drawer on the editor so back arrow / gesture do
|
||||
// exactly what the user expects there.
|
||||
val isListRoute = currentRoute == Routes.LIST
|
||||
|
||||
LaunchedEffect(currentRoute) {
|
||||
// If we land on the editor via deep link without a list in
|
||||
// the back stack, snap the drawer closed.
|
||||
if (!isListRoute && drawerState.isOpen) drawerState.close()
|
||||
}
|
||||
|
||||
ModalNavigationDrawer(
|
||||
drawerState = drawerState,
|
||||
gesturesEnabled = isListRoute,
|
||||
drawerContent = {
|
||||
IncidoDrawer(
|
||||
currentFilter = filterMode,
|
||||
onSelectFilter = { picked ->
|
||||
filterMode = picked
|
||||
scope.launch { drawerState.close() }
|
||||
},
|
||||
),
|
||||
) { entry ->
|
||||
val raw = entry.arguments?.getLong("noteId") ?: -1L
|
||||
val id = if (raw <= 0L) null else raw
|
||||
NoteEditorScreen(
|
||||
noteId = id,
|
||||
onClose = { navController.popBackStack() },
|
||||
)
|
||||
},
|
||||
) {
|
||||
NavHost(navController = navController, startDestination = Routes.LIST) {
|
||||
composable(Routes.LIST) {
|
||||
NoteListScreen(
|
||||
filterMode = filterMode,
|
||||
onOpenDrawer = { scope.launch { drawerState.open() } },
|
||||
onOpenEditor = { id -> navController.navigate(Routes.editor(id)) },
|
||||
)
|
||||
}
|
||||
composable(
|
||||
route = Routes.EDITOR,
|
||||
arguments = listOf(
|
||||
navArgument("noteId") {
|
||||
type = NavType.LongType
|
||||
defaultValue = -1L
|
||||
},
|
||||
),
|
||||
) { entry ->
|
||||
val raw = entry.arguments?.getLong("noteId") ?: -1L
|
||||
val id = if (raw <= 0L) null else raw
|
||||
NoteEditorScreen(
|
||||
noteId = id,
|
||||
onClose = { navController.popBackStack() },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suppress unused-import lint for the snapshots helper that may be
|
||||
// re-introduced in future filter-state extensions.
|
||||
@Suppress("unused")
|
||||
private fun <T> List<T>.toSnapshotStateList(): SnapshotStateList<T> = toMutableStateList()
|
||||
Reference in new issue
Block a user