feat(trash): v0.3.7.0 — Trash / soft delete + release docs backfill
- Deleting a note now soft-deletes it (trashed flag on NoteEntity, additive schema, auto-migrated); trashed notes are hidden from Home, Favorites, Untagged, tag views, and ordinary search. - New Trash drawer entry lists soft-deleted notes; each Trash card's overflow menu exposes Restore and Delete permanently. - NoteFilter gains a Trash case; repository gains moveToTrash / restoreFromTrash / deletePermanently; backups round-trip the trashed state. - Version bump (lockstep): versionCode 30->31, versionName 0.3.6.3->0.3.7.0, SettingsViewModel.APP_VERSION, README intro + changelog, ReleaseNotes.kt 5-most-recent window. - Development Plan §10: fix the merged 0.3.4.0/0.3.3.8 table row and backfill the missing 0.3.6.2/0.3.6.3 rows; add the 0.3.7.0 row. - README changelog: backfill the missing 0.3.6.2 row; promote the Unreleased Trash row to 0.3.7.0.
This commit is contained in:
1 parent
4bbe29851a
commit
a39c52cf89
17 files changed
+386
-165
No files matched your search
@@ -61,6 +61,7 @@ private fun String.toNoteFilter(): NoteFilter = when {
|
||||
this == "home" -> NoteFilter.Home
|
||||
this == "favorites" -> NoteFilter.Favorites
|
||||
this == "untagged" -> NoteFilter.Untagged
|
||||
this == "trash" -> NoteFilter.Trash
|
||||
startsWith("tag:") -> NoteFilter.ByTag(this.removePrefix("tag:"))
|
||||
else -> NoteFilter.Home
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ object BackupCodec {
|
||||
appVersion: String,
|
||||
): BackupFile {
|
||||
// The repository exposes Flows; we materialise a one-shot
|
||||
// snapshot via `.first()`. Notes come from `observeAll`, tags
|
||||
// from `observeAllHashtags`.
|
||||
val noteList: List<Note> = repository.observeAll().first()
|
||||
// snapshot via `.first()`. Notes come from `observeAllIncludingTrashed`,
|
||||
// tags from `observeAllHashtags`.
|
||||
// Backup includes active and trashed notes so a soft-deleted note
|
||||
// can be restored after a device migration as well.
|
||||
val noteList: List<Note> = repository.observeAllIncludingTrashed().first()
|
||||
val tagList: List<String> = repository.observeAllHashtags().first()
|
||||
|
||||
// NoteAttachment.bytes is loaded on demand via
|
||||
@@ -121,6 +123,8 @@ data class BackupNote(
|
||||
val color: String,
|
||||
val hashtags: List<String> = emptyList(),
|
||||
val attachments: List<BackupAttachment> = emptyList(),
|
||||
/** Preserve soft-delete state; defaults to false for older backups. */
|
||||
val isTrashed: Boolean = false,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@@ -151,6 +155,7 @@ private suspend fun Note.toBackup(repository: NoteRepository): BackupNote {
|
||||
updatedAt = updatedAt,
|
||||
isFavorite = isFavorite,
|
||||
color = color.name,
|
||||
isTrashed = isTrashed,
|
||||
hashtags = hashtags,
|
||||
attachments = backups,
|
||||
)
|
||||
@@ -166,6 +171,7 @@ private fun Note.toBackup(): BackupNote = BackupNote(
|
||||
updatedAt = updatedAt,
|
||||
isFavorite = isFavorite,
|
||||
color = color.name,
|
||||
isTrashed = isTrashed,
|
||||
hashtags = hashtags,
|
||||
attachments = emptyList(),
|
||||
)
|
||||
@@ -177,6 +183,7 @@ private fun BackupNote.toDomain(): Note = Note(
|
||||
updatedAt = updatedAt,
|
||||
isFavorite = isFavorite,
|
||||
color = runCatching { NoteColor.valueOf(color) }.getOrDefault(NoteColor.NONE),
|
||||
isTrashed = isTrashed,
|
||||
hashtags = hashtags,
|
||||
// Attachments are inserted separately by importSnapshot so they
|
||||
// get assigned to the freshly-created note id.
|
||||
|
||||
@@ -25,6 +25,19 @@ object ReleaseNotes {
|
||||
* Append a new entry on top each release.
|
||||
*/
|
||||
val RECENT: List<ReleaseNote> = listOf(
|
||||
ReleaseNote(
|
||||
version = "0.3.7.0",
|
||||
date = "2026-08-20",
|
||||
bullets = listOf(
|
||||
"Trash / soft delete. Deleting a note now moves it to a new " +
|
||||
"Trash section in the navigation drawer instead of " +
|
||||
"destroying it immediately \u2014 it disappears from Home, " +
|
||||
"Favorites, Untagged, tag views, and ordinary search.",
|
||||
"Inside Trash, each note's menu offers Restore (puts it back " +
|
||||
"where it was) or Delete permanently (destroys it for " +
|
||||
"good, including attachments).",
|
||||
),
|
||||
),
|
||||
ReleaseNote(
|
||||
version = "0.3.6.0",
|
||||
date = "2026-08-19",
|
||||
@@ -91,16 +104,6 @@ object ReleaseNotes {
|
||||
"attachment survive the trip to the file manager.",
|
||||
),
|
||||
),
|
||||
ReleaseNote(
|
||||
version = "0.3.3.8",
|
||||
date = "2026-08-17",
|
||||
bullets = listOf(
|
||||
"The designed Incido artwork — the glass shield with the " +
|
||||
"fountain-pen nib — is now the app icon, replacing the " +
|
||||
"placeholder glyph on the home screen, in the app " +
|
||||
"drawer, and in the adaptive-icon layers.",
|
||||
),
|
||||
),
|
||||
// v0.3.6.0 push drops v0.3.3.7 off the "5 most recent" tail.
|
||||
// v0.3.7.0 push drops v0.3.3.8 off the "5 most recent" tail.
|
||||
)
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Home
|
||||
import androidx.compose.material.icons.filled.LabelOff
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material.icons.filled.Star
|
||||
import androidx.compose.material.icons.filled.Tag
|
||||
@@ -34,8 +35,8 @@ import org.incido.domain.model.HashtagUsage
|
||||
import org.incido.domain.model.NoteFilter
|
||||
|
||||
/**
|
||||
* Left-side navigation drawer. Top section has four fixed entries
|
||||
* (Home / Favorites / Untagged / Settings); a `HorizontalDivider`; then
|
||||
* Left-side navigation drawer. Top section has five fixed entries
|
||||
* (Home / Favorites / Untagged / Trash / Settings); a `HorizontalDivider`; then
|
||||
* a live scrollable list of the user's most-recently-used hashtags.
|
||||
*
|
||||
* Tapping a filter entry calls [onSelectFilter]; tapping Settings
|
||||
@@ -88,6 +89,12 @@ fun IncidoDrawer(
|
||||
onClick = { onSelectFilter(NoteFilter.Untagged) },
|
||||
icon = { Icon(Icons.Filled.LabelOff, contentDescription = null) },
|
||||
)
|
||||
NavigationDrawerItem(
|
||||
label = { Text("Trash") },
|
||||
selected = currentFilter == NoteFilter.Trash,
|
||||
onClick = { onSelectFilter(NoteFilter.Trash) },
|
||||
icon = { Icon(Icons.Filled.Delete, contentDescription = null) },
|
||||
)
|
||||
|
||||
HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ fun NoteEditorScreen(
|
||||
onDismissRequest = { menuExpanded = false },
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
text = { Text("Delete") },
|
||||
text = { Text("Move to Trash") },
|
||||
onClick = {
|
||||
menuExpanded = false
|
||||
viewModel.delete(onClose)
|
||||
|
||||
@@ -456,7 +456,7 @@ class NoteEditorViewModel(
|
||||
val id = _state.value.existing?.id ?: return
|
||||
_state.update { it.copy(isSaving = true) }
|
||||
viewModelScope.launch {
|
||||
repository.delete(id)
|
||||
repository.softDelete(id)
|
||||
_state.update { it.copy(isSaving = false, isDeleted = true) }
|
||||
onDone()
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.compose.material.icons.filled.Lock
|
||||
import androidx.compose.material.icons.filled.Menu
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material.icons.filled.PhotoCamera
|
||||
import androidx.compose.material.icons.filled.Restore
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material.icons.filled.Star
|
||||
import androidx.compose.material.icons.outlined.StarOutline
|
||||
@@ -135,7 +136,7 @@ fun NoteListScreen(
|
||||
},
|
||||
actions = {
|
||||
// v0.3.1.0: search is now context-aware on Home,
|
||||
// Favorites, and Untagged. ByTag filters already
|
||||
// Favorites, Untagged, and Trash. ByTag filters already
|
||||
// narrow by a single tag so the additional text
|
||||
// query would be ambiguous.
|
||||
if (filterMode !is NoteFilter.ByTag) {
|
||||
@@ -166,7 +167,9 @@ fun NoteListScreen(
|
||||
localQuery = it
|
||||
viewModel.onQueryChange(it)
|
||||
},
|
||||
placeholder = { Text("Search notes…") },
|
||||
placeholder = {
|
||||
Text(if (filterMode == NoteFilter.Trash) "Search trash…" else "Search notes…")
|
||||
},
|
||||
leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
|
||||
singleLine = true,
|
||||
modifier = Modifier
|
||||
@@ -182,7 +185,15 @@ fun NoteListScreen(
|
||||
else -> NoteList(
|
||||
notes = state.notes,
|
||||
onClick = { onOpenEditor(it.id) },
|
||||
onDelete = viewModel::delete,
|
||||
onDelete = {
|
||||
if (filterMode == NoteFilter.Trash) {
|
||||
viewModel.permanentlyDelete(it)
|
||||
} else {
|
||||
viewModel.softDelete(it)
|
||||
}
|
||||
},
|
||||
onRestore = viewModel::restore,
|
||||
isTrash = filterMode == NoteFilter.Trash,
|
||||
onToggleFavorite = viewModel::toggleFavorite,
|
||||
repository = repository,
|
||||
// v0.3.5.0: ONLY notes whose ciphertext passed the
|
||||
@@ -198,6 +209,7 @@ private fun screenTitle(filter: NoteFilter): String = when (filter) {
|
||||
NoteFilter.Home -> "Incido"
|
||||
NoteFilter.Favorites -> "Favorites"
|
||||
NoteFilter.Untagged -> "Untagged"
|
||||
NoteFilter.Trash -> "Trash"
|
||||
is NoteFilter.ByTag -> "#${filter.hashtag}"
|
||||
}
|
||||
|
||||
@@ -207,6 +219,7 @@ private fun EmptyState(filterMode: NoteFilter) {
|
||||
NoteFilter.Home -> "No notes yet. Tap + to start."
|
||||
NoteFilter.Favorites -> "No favourites yet. Tap ⭐ on a card to add one."
|
||||
NoteFilter.Untagged -> "All notes are tagged. 🎉"
|
||||
NoteFilter.Trash -> "Trash is empty."
|
||||
is NoteFilter.ByTag -> "No notes tagged #${filterMode.hashtag} yet."
|
||||
}
|
||||
Box(
|
||||
@@ -227,6 +240,7 @@ private fun EmptyState(filterMode: NoteFilter) {
|
||||
private fun NoResultsState(filterMode: NoteFilter) {
|
||||
val message = when (filterMode) {
|
||||
NoteFilter.Home -> "No matching notes."
|
||||
NoteFilter.Trash -> "No notes in Trash match your search."
|
||||
else -> "Nothing here."
|
||||
}
|
||||
Box(
|
||||
@@ -248,6 +262,8 @@ private fun NoteList(
|
||||
notes: List<Note>,
|
||||
onClick: (Note) -> Unit,
|
||||
onDelete: (Long) -> Unit,
|
||||
onRestore: (Long) -> Unit,
|
||||
isTrash: Boolean,
|
||||
onToggleFavorite: (Long, Boolean) -> Unit,
|
||||
/** v0.3.1.0 — threaded through to [NoteCard] for thumbnail loading. */
|
||||
repository: NoteRepository?,
|
||||
@@ -271,8 +287,10 @@ private fun NoteList(
|
||||
items(items = notes, key = { it.id }) { note ->
|
||||
NoteCard(
|
||||
note = note,
|
||||
onClick = { onClick(note) },
|
||||
onClick = { if (!isTrash) onClick(note) },
|
||||
onDelete = { onDelete(note.id) },
|
||||
onRestore = { onRestore(note.id) },
|
||||
isTrash = isTrash,
|
||||
onToggleFavorite = { onToggleFavorite(note.id, !note.isFavorite) },
|
||||
repository = repository,
|
||||
showEncryptionBadge = note.id in verifiedEncryptedIds,
|
||||
@@ -293,10 +311,9 @@ private fun NoteList(
|
||||
*
|
||||
* v0.3.3.0:
|
||||
* - The bottom-right delete `IconButton` is gone.
|
||||
* - A long-press anywhere on the card opens a `DropdownMenu`
|
||||
* anchored on the card itself, with a "Delete" entry as the first
|
||||
* item. The menu is designed to grow (Share, etc.) — additional
|
||||
* entries are added as `DropdownMenuItem`s.
|
||||
* - A long-press anywhere on the card opens a `DropdownMenu` anchored on
|
||||
* the card itself. Active cards offer "Delete"; Trash cards offer
|
||||
* "Restore" and permanent "Delete" without opening the editor.
|
||||
* - Card now uses `Modifier.combinedClickable` for click + long-click.
|
||||
*
|
||||
* v0.3.3.5:
|
||||
@@ -330,6 +347,8 @@ private fun NoteCard(
|
||||
note: Note,
|
||||
onClick: () -> Unit,
|
||||
onDelete: () -> Unit,
|
||||
onRestore: () -> Unit,
|
||||
isTrash: Boolean,
|
||||
onToggleFavorite: () -> Unit,
|
||||
/** v0.3.1.0 — used to load the first image attachment as a
|
||||
* thumbnail background. Null disables the feature (still works). */
|
||||
@@ -569,8 +588,23 @@ private fun NoteCard(
|
||||
expanded = showMenu,
|
||||
onDismissRequest = { showMenu = false },
|
||||
) {
|
||||
if (isTrash) {
|
||||
DropdownMenuItem(
|
||||
text = { Text("Restore") },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
Icons.Filled.Restore,
|
||||
contentDescription = null,
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
showMenu = false
|
||||
onRestore()
|
||||
},
|
||||
)
|
||||
}
|
||||
DropdownMenuItem(
|
||||
text = { Text("Delete") },
|
||||
text = { Text(if (isTrash) "Delete permanently" else "Delete") },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
Icons.Filled.Delete,
|
||||
@@ -599,14 +633,16 @@ private fun NoteCard(
|
||||
// Hotfix: favorite star moved from the title row to the
|
||||
// bottom-right corner, vertically aligned with the
|
||||
// three-dot overflow button above.
|
||||
Box(modifier = Modifier.align(Alignment.BottomEnd).padding(end = 4.dp, bottom = 4.dp)) {
|
||||
IconButton(onClick = onToggleFavorite) {
|
||||
Icon(
|
||||
imageVector = if (note.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline,
|
||||
contentDescription = if (note.isFavorite) "Unfavorite" else "Favorite",
|
||||
tint = if (note.isFavorite) favoriteActiveColor
|
||||
else secondaryColor,
|
||||
)
|
||||
if (!isTrash) {
|
||||
Box(modifier = Modifier.align(Alignment.BottomEnd).padding(end = 4.dp, bottom = 4.dp)) {
|
||||
IconButton(onClick = onToggleFavorite) {
|
||||
Icon(
|
||||
imageVector = if (note.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline,
|
||||
contentDescription = if (note.isFavorite) "Unfavorite" else "Favorite",
|
||||
tint = if (note.isFavorite) favoriteActiveColor
|
||||
else secondaryColor,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,9 @@ data class NoteListUiState(
|
||||
/** Encrypted rows that FAILED verification (corrupted / wrong key). */
|
||||
val unverifiedEncryptedNoteCount: Int = 0,
|
||||
) {
|
||||
val isEmpty: Boolean get() = !isLoading && notes.isEmpty() && !isSearchActive && filter == NoteFilter.Home
|
||||
val isEmpty: Boolean
|
||||
get() = !isLoading && notes.isEmpty() && !isSearchActive &&
|
||||
(filter == NoteFilter.Home || filter == NoteFilter.Trash)
|
||||
val noResults: Boolean get() = !isLoading && notes.isEmpty() && !isEmpty
|
||||
}
|
||||
|
||||
@@ -60,17 +62,18 @@ class NoteListViewModel(
|
||||
/** Notes stream — switches on (filter, query) so the same ViewModel
|
||||
* instance handles Home, Favorites, Untagged, ByTag, and search.
|
||||
*
|
||||
* v0.3.1.0: search is now **context-aware** — on Favorites or
|
||||
* Untagged, the typed query is intersected with the active filter
|
||||
* (only favourites / only untagged) rather than ignored. On Home,
|
||||
* search spans everything. ByTag keeps the same behaviour (the
|
||||
* tag itself is already the filter). */
|
||||
* v0.3.1.0: search is now **context-aware** — on Favorites,
|
||||
* Untagged, and Trash, the typed query is intersected with the
|
||||
* active filter rather than ignored. On Home, search spans all
|
||||
* active notes. ByTag keeps the same behaviour (the tag itself is
|
||||
* already the filter). */
|
||||
private val notesFlow = combine(filterMode, rawQuery) { f, q -> f to q }
|
||||
.flatMapLatest { (f, q) ->
|
||||
when (f) {
|
||||
NoteFilter.Home -> if (q.isBlank()) repository.observeAll() else repository.search(q)
|
||||
NoteFilter.Favorites -> if (q.isBlank()) repository.observeFavorites() else repository.searchFavorites(q)
|
||||
NoteFilter.Untagged -> if (q.isBlank()) repository.observeUntagged() else repository.searchUntagged(q)
|
||||
NoteFilter.Trash -> if (q.isBlank()) repository.observeTrashed() else repository.searchTrashed(q)
|
||||
is NoteFilter.ByTag -> repository.observeNotesForHashtag(f.hashtag)
|
||||
}
|
||||
}
|
||||
@@ -143,10 +146,21 @@ class NoteListViewModel(
|
||||
rawQuery.value = ""
|
||||
}
|
||||
|
||||
fun delete(id: Long) {
|
||||
/** Move an active note to Trash. */
|
||||
fun softDelete(id: Long) {
|
||||
viewModelScope.launch { repository.softDelete(id) }
|
||||
}
|
||||
|
||||
/** Permanently destroy a note from the Trash view. */
|
||||
fun permanentlyDelete(id: Long) {
|
||||
viewModelScope.launch { repository.delete(id) }
|
||||
}
|
||||
|
||||
/** Restore a note from Trash. */
|
||||
fun restore(id: Long) {
|
||||
viewModelScope.launch { repository.restore(id) }
|
||||
}
|
||||
|
||||
fun toggleFavorite(id: Long, isFavorite: Boolean) {
|
||||
viewModelScope.launch { repository.setFavorite(id, isFavorite) }
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ class SettingsViewModel(
|
||||
/** The version string baked into backup payloads and shown on
|
||||
* the About card. Mirrors `app/build.gradle.kts` `versionName`
|
||||
* — if you bump one, bump both. */
|
||||
const val APP_VERSION = "0.3.6.3"
|
||||
const val APP_VERSION = "0.3.7.0"
|
||||
|
||||
val Factory: ViewModelProvider.Factory = viewModelFactory {
|
||||
initializer {
|
||||
|
||||
Reference in new issue
Block a user