27 Commits
Author SHA1 Message Date
Incido Developer 4b41b0dedb chore: increase Gradle heap from 1536m to 4g (more RAM available)
dev / Build debug APK (push) Successful in 24s
release / Build & attach release APK (push) Successful in 4m8s
2026-08-21 02:33:59 +12:00
Incido Developer 9f390a4047 fix(release): use external web address for API, remove LAN IP workaround
dev / Build debug APK (push) Successful in 20s
2026-08-21 01:43:34 +12:00
Incido Developer fa7e50b0db fix(release): use name= query param and attachment field for multipart upload
dev / Build debug APK (push) Successful in 32s
release / Build & attach release APK (push) Failing after 11m1s
2026-08-20 14:56:07 +12:00
Incido Developer 92e4a99e11 fix(release): use LAN IP (192.168.8.17) to bypass Cloudflare proxy for API calls
dev / Build debug APK (push) Successful in 25s
release / Build & attach release APK (push) Failing after 1m2s
2026-08-20 14:39:08 +12:00
Incido Developer c7c82ec68a fix(release): Gitea assets API returns a list, not {assets:[]}
dev / Build debug APK (push) Successful in 29s
release / Build & attach release APK (push) Failing after 2m41s
2026-08-20 14:25:37 +12:00
Incido Developer 639f66f08c fix(release): use base64-encoded Python script to avoid heredoc-in-block-scalar YAML parsing errors
dev / Build debug APK (push) Successful in 33s
release / Build & attach release APK (push) Failing after 33s
2026-08-20 14:22:52 +12:00
Incido Developer 57b6cf99d2 fix(release): rewrite with verbose upload diagnostics
dev / Build debug APK (push) Successful in 29s
release / Build & attach release APK (push) Failing after 33s
2026-08-20 13:59:04 +12:00
Incido Developer a9b90aab9e fix(release): remove unsupported --retry-connrefuse flag
dev / Build debug APK (push) Successful in 24s
release / Build & attach release APK (push) Failing after 2m11s
2026-08-20 13:54:56 +12:00
Incido Developer ed9d8d0ce2 fix(release): generate keystore on-the-fly, no KEYSTORE_BASE64 secret needed
dev / Build debug APK (push) Successful in 30s
release / Build & attach release APK (push) Failing after 2m3s
2026-08-20 13:47:22 +12:00
Incido Developer 486e2d01cf fix(release): remove duplicate chmod/ls and duplicate APK check
dev / Build debug APK (push) Successful in 35s
release / Build & attach release APK (push) Failing after 2m1s
2026-08-20 13:39:44 +12:00
Incido Developer a0be9f8123 fix(release): align SDK setup with working dev.yml
dev / Build debug APK (push) Successful in 21s
release / Build & attach release APK (push) Failing after 52s
2026-08-20 13:35:21 +12:00
Incido Developer 04f9cda95a fix(release): verbose build output + set JAVA_HOME before sdkmanager
dev / Build debug APK (push) Successful in 33s
release / Build & attach release APK (push) Failing after 1m7s
2026-08-20 13:31:03 +12:00
Incido Developer 594525ed10 fix(release): use correct APK filenames (app-debug.apk, app-release.apk)
dev / Build debug APK (push) Successful in 32s
release / Build & attach release APK (push) Failing after 33s
2026-08-20 13:27:56 +12:00
Incido Developer 3c8d01cca9 fix(release): fix checkout step, remove duplicate git checkout
dev / Build debug APK (push) Successful in 30s
release / Build & attach release APK (push) Failing after 43s
2026-08-20 13:24:33 +12:00
Incido Developer c4c8ef365f debug(release): add verbose build output
dev / Build debug APK (push) Successful in 37s
release / Build & attach release APK (push) Failing after 1s
2026-08-20 13:21:06 +12:00
Incido Developer 3911bd07f2 fix(release): correct APK path structure
dev / Build debug APK (push) Successful in 33s
release / Build & attach release APK (push) Failing after 1s
2026-08-20 13:18:54 +12:00
Incido Developer 28a8a4e6cc fix(release): quote 'on' key, ensure heredoc indentation
dev / Build debug APK (push) Successful in 36s
release / Build & attach release APK (push) Failing after 2s
2026-08-20 13:15:49 +12:00
Incido Developer 5b1d7cbaf0 test tag trigger
dev / Build debug APK (push) Successful in 28s
2026-08-20 13:09:09 +12:00
Incido Developer 7b298aa6e7 chore: trigger release workflow with new code
dev / Build debug APK (push) Successful in 47s
2026-08-20 13:04:58 +12:00
Incido Developer 7a808c37d5 ci(release): rewrite release workflow — json via python, get-or-create, asset replace
dev / Build debug APK (push) Successful in 28s
2026-08-20 13:02:47 +12:00
Incido Developer 8651a4020f ci(release): write JSON payload via python -c to avoid shell quoting errors
dev / Build debug APK (push) Successful in 37s
2026-08-20 12:54:43 +12:00
Incido Developer 06b4c208a6 ci(release): robust release creation — get-or-create + delete stale assets before re-upload
dev / Build debug APK (push) Successful in 23s
release / Build & attach release APK (push) Failing after 34s
2026-08-20 12:44:06 +12:00
Incido Developer 734f9aecca ci(release): add --max-time 300 --retry 3 to APK asset uploads
dev / Build debug APK (push) Successful in 51s
2026-08-20 12:23:00 +12:00
Incido Developer a39c52cf89 feat(trash): v0.3.7.0 — Trash / soft delete + release docs backfill
dev / Build debug APK (push) Successful in 1m7s
release / Build & attach release APK (push) Failing after 28s
- 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.
2026-08-20 11:52:43 +12:00
Incido Developer 4bbe29851a fix: use doFirst instead of onlyIf for keystore validation task
dev / Build debug APK (push) Failing after 18s
2026-08-20 08:10:06 +12:00
Incido Developer 06d647cf72 fix: defer keystore existence check to assembleRelease execution time, not config time
dev / Build debug APK (push) Failing after 18s
2026-08-20 08:07:29 +12:00
Incido Developer f153ad8702 fix(release): inline keystore gen into build step so gradle can see it
dev / Build debug APK (push) Failing after 23s
2026-08-20 08:04:39 +12:00
19 changed files with 496 additions and 243 deletions

No files matched your search

+80 -55
View File
@@ -13,8 +13,10 @@ jobs:
steps:
- name: Checkout
run: |
git clone https://git.trevena.info/nick/incido.git repo
git clone --depth=1 https://git.trevena.info/nick/incido.git repo
cd repo
git fetch --tags origin
git checkout ${{ github.ref_name }}
- name: Set up JDK 17
run: |
@@ -39,6 +41,8 @@ jobs:
mkdir -p "$SDK/cmdline-tools"
mv /tmp/cmdline-tools-extract/cmdline-tools "$SDK/cmdline-tools/latest"
rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools-extract
export JAVA_HOME=$WORKDIR/jdk
export PATH=$JAVA_HOME/bin:$PATH
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null 2>&1 || true
"$SDK/cmdline-tools/latest/bin/sdkmanager" --install \
"platform-tools" \
@@ -49,75 +53,96 @@ jobs:
echo "ANDROID_SDK_ROOT=$SDK" >> $GITHUB_ENV
echo "PATH=$SDK/cmdline-tools/latest/bin:$SDK/platform-tools:$PATH" >> $GITHUB_ENV
# The release signing config in app/build.gradle.kts only attaches a
# storeFile when keystore/release.jks exists, and that .jks is
# gitignored -- so the CI runner must mint its own. We use the exact
# dev keystore documented in keystore/README.md (alias "incido",
# both passwords "incido_dev_keystore"). Move to a Gitea Actions
# secret + production keystore before publishing to Play / F-Droid.
- name: Generate dev release keystore
run: |
cd repo
mkdir -p keystore
keytool -genkey -noprompt -v \
-keystore keystore/release.jks \
-keyalg RSA -keysize 2048 -validity 10000 \
-alias incido \
-storepass incido_dev_keystore \
-keypass incido_dev_keystore \
-dname "CN=Incido Dev, OU=Local, O=Incido, L=Local, ST=Local, C=NZ"
- name: Build debug + release APKs
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
timeout-minutes: 25
run: |
set -e
cd repo
chmod +x gradlew
git checkout ${{ github.ref_name }}
mkdir -p keystore
if [ ! -f keystore/release.jks ]; then
keytool -genkey -noprompt -v \
-keystore keystore/release.jks \
-keyalg RSA -keysize 2048 -validity 10000 \
-alias incido \
-storepass incido_dev_keystore \
-keypass incido_dev_keystore \
-dname "CN=Incido Dev, OU=Local, O=Incido, L=Local, ST=Local, C=NZ"
fi
export JAVA_HOME=/tmp/gitea-runner-work/jdk
export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH
# Build both variants; copyReleaseApks finalizes assembleRelease and
# drops version-stamped APKs at the repo root:
# Incido-<version>-debug.apk
# Incido-<version>-release.apk
./gradlew assembleDebug assembleRelease --no-daemon
# Verify both files exist before proceeding
TAG="${GITHUB_REF##*/}"
chmod +x ./gradlew
./gradlew --stop 2>/dev/null || true
./gradlew assembleDebug assembleRelease --no-daemon --stacktrace 2>&1 | tee /tmp/build.log
BUILD_STATUS=${PIPESTATUS[0]}
echo "Gradle exit status: $BUILD_STATUS"
if [ $BUILD_STATUS -ne 0 ]; then
echo "Build failed"
tail -100 /tmp/build.log
exit 1
fi
ls -la app/build/outputs/apk/debug/ app/build/outputs/apk/release/
- name: Create release + attach both APKs
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GH_TOKEN: ${{ secrets.TOKEN }}
run: |
set -e
cd repo
TAG="${GITHUB_REF##*/}"
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"
API="https://git.trevena.info/api/v1/repos/nick/incido"
APK_DEBUG="Incido-$VERSION-debug.apk"
APK_RELEASE="Incido-$VERSION-release.apk"
echo "Creating release for tag: $TAG"
RELEASE_ID=$(curl -s -X POST "https://git.trevena.info/api/v1/repos/nick/incido/releases" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"$TAG\",
\"name\": \"$TAG\",
\"draft\": false,
\"prerelease\": false
}" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
echo "Release ID: $RELEASE_ID"
echo "Tag: $TAG Version: $VERSION"
echo "--- Check for existing release ---"
RELEASE_ID=$(curl -s "$API/releases/tags/$TAG" \
-H "Authorization: token $GH_TOKEN" \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
if [ -z "$RELEASE_ID" ]; then
echo "ERROR: Failed to create release"
exit 1
echo "--- Create release ---"
python3 -c "import sys,json; sys.stdout.write(json.dumps({'tag_name': '$TAG', 'name': '$TAG', 'body': 'Release $TAG', 'draft': False, 'prerelease': False}))" \
> /tmp/release_payload.json
RELEASE_ID=$(curl -s -X POST "$API/releases" \
-H "Authorization: token $GH_TOKEN" \
-H "Content-Type: application/json" \
-d @/tmp/release_payload.json \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
else
echo "--- Reusing existing release $RELEASE_ID ---"
fi
for APK in "Incido-${VERSION}-debug.apk" "Incido-${VERSION}-release.apk"; do
echo "Attaching $APK to release $RELEASE_ID"
RESPONSE=$(curl -s -X POST \
"https://git.trevena.info/api/v1/repos/nick/incido/releases/$RELEASE_ID/assets?name=$APK" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$APK")
echo "Attach response: $RESPONSE"
echo "Release ID: $RELEASE_ID"
if [ -z "$RELEASE_ID" ]; then echo "ERROR: no release ID"; exit 1; fi
echo "aW1wb3J0IHN5cywganNvbiwgdXJsbGliLnJlcXVlc3QKYXBpID0gc3lzLmFyZ3ZbMV0KcmVsZWFzZV9pZCA9IHN5cy5hcmd2WzJdCmFwayA9IHN5cy5hcmd2WzNdCnRva2VuID0gc3lzLmFyZ3ZbNF0KcmVxID0gdXJsbGliLnJlcXVlc3QuUmVxdWVzdCgKICAgIGYie2FwaX0vcmVsZWFzZXMve3JlbGVhc2VfaWR9L2Fzc2V0cyIsCiAgICBoZWFkZXJzPXsiQXV0aG9yaXphdGlvbiI6IGYidG9rZW4ge3Rva2VufSJ9CikKcmVzcCA9IHVybGxpYi5yZXF1ZXN0LnVybG9wZW4ocmVxKQpmb3IgYSBpbiBqc29uLmxvYWRzKHJlc3AucmVhZCgpKToKICAgIGlmIGFbIm5hbWUiXSA9PSBhcGs6CiAgICAgICAgZGVsZXRlX3JlcSA9IHVybGxpYi5yZXF1ZXN0LlJlcXVlc3QoCiAgICAgICAgICAgIGYie2FwaX0vcmVsZWFzZXMve3JlbGVhc2VfaWR9L2Fzc2V0cy97YVsnaWQnXX0iLAogICAgICAgICAgICBtZXRob2Q9IkRFTEVURSIsCiAgICAgICAgICAgIGhlYWRlcnM9eyJBdXRob3JpemF0aW9uIjogZiJ0b2tlbiB7dG9rZW59In0KICAgICAgICApCiAgICAgICAgdXJsbGliLnJlcXVlc3QudXJsb3BlbihkZWxldGVfcmVxKQogICAgICAgIHByaW50KGYiRGVsZXRlZCB7YVsnaWQnXX0iLCBmbHVzaD1UcnVlKQo=" | base64 -d > /tmp/delete_asset.py
for APK in "$APK_DEBUG" "$APK_RELEASE"; do
if echo "$APK" | grep -q "debug"; then
APK_PATH="app/build/outputs/apk/debug/app-debug.apk"
else
APK_PATH="app/build/outputs/apk/release/app-release.apk"
fi
if [ ! -f "$APK_PATH" ]; then
echo "ERROR: APK not found: $APK_PATH"
exit 1
fi
echo "--- Deleting stale assets for $APK ---"
python3 /tmp/delete_asset.py "$API" "$RELEASE_ID" "$APK" "$GH_TOKEN"
echo "--- Uploading $APK ---"
ls -la "$APK_PATH"
UPLOAD=$(curl -s -X POST "$API/releases/$RELEASE_ID/assets?name=$APK" \
-H "Authorization: token $GH_TOKEN" \
-F "attachment=@$APK_PATH" \
--max-time 600 --retry 3 --retry-delay 10)
echo "Upload response: $UPLOAD"
echo "$UPLOAD" | python3 -c "import sys,json; d=json.loads(sys.stdin.read()); print('Asset uploaded:', d.get('name','?'), d.get('id','?'))"
done
echo "--- Final release state ---"
curl -s "$API/releases/$RELEASE_ID" -H "Authorization: token $GH_TOKEN" | python3 -c "import sys,json; d=json.load(sys.stdin); print('Release ' + d['tag_name'] + ' has ' + str(len(d['assets'])) + ' assets')"
+16 -7
View File
@@ -135,7 +135,7 @@ incido/
| F1 | **List of currently saved notes** | On app launch (and at all times when on the home screen), the user sees a scrollable list of all notes currently stored in the database. Each note is represented as a card showing a preview of its content and its last-updated timestamp. |
| F2 | Create a new note | Tapping "+" opens an empty editor; saving adds the note to the list and database. |
| F3 | Edit an existing note | Tapping a note card opens the editor pre-filled with its content; saving updates the note in place and reflects the change on the list. |
| F4 | Delete a note | A delete action on a note card (or in the editor) removes the note from both the list and the database. |
| F4 | Delete a note | A delete action on a note card (or in the editor) moves the note to the Trash filter. Notes in Trash are excluded from Home, Favorites, Untagged, tag, and ordinary search views; deleting a note from Trash destroys it permanently. |
| F5 | Data persists across restarts | Notes created in one session are visible in the list after force-closing and reopening the app. |
| F6 | Empty state | When the list is empty (no notes saved), show a friendly empty-state message instead of an empty list. |
| F7 | List refreshes automatically | The list of saved notes updates immediately after creating, editing, or deleting a note — no manual reload required. |
@@ -168,7 +168,7 @@ All features listed in §6.
- Displays the note content (first ~3 lines, truncated)
- Shows relative timestamp ("2 min ago", "Yesterday", etc.)
- Whole card is tappable → opens editor for that note
- Long-press or swipe reveals delete action
- Long-press or swipe reveals move-to-Trash action; Trash cards expose Restore and permanent Delete
### 5.2 Screen 2 — Note Editor
- **Top bar:** Back arrow + Save action
@@ -176,7 +176,7 @@ All features listed in §6.
- **Behavior:**
- Back arrow without save = discard (no confirmation in v0.1; v0.2 should confirm if content changed)
- Save action persists and returns to the list; the updated/created note is visible immediately on the list
- Delete button (only when editing existing note) at bottom or in top bar overflow
- Delete button (only when editing existing note) at bottom or in top bar overflow; it moves the note to Trash
### 5.3 Theming
- **Material 3** (Material You) design system
@@ -196,7 +196,6 @@ This list is the canonical backlog. Items can be promoted into future versions a
- Color-coded notes and labels
- Pinning notes to top
- Archive (vs. delete) with archive view
- Trash with soft-delete and recovery window
- Full-text search across note content
- Tag / hashtag system
- Search by tag or content
@@ -204,6 +203,11 @@ This list is the canonical backlog. Items can be promoted into future versions a
- Image attachments from camera and gallery
- Audio attachments / voice notes
> **Trash status:** Soft-delete, Trash filtering, Restore, and permanent
> deletion are implemented in the current Android app. There is no
> automatic purge window yet; a note is destroyed immediately when it is
> permanently deleted from Trash.
### 6.2 On-Device Machine Learning
- **OCR (Optical Character Recognition):**
- Extract text from images attached to notes
@@ -297,8 +301,9 @@ v0.1 is considered complete when **all** of the following are true:
[ ] Tap "Test note 2" card — editor opens with existing content
[ ] Change to "Test note 2 (edited)" — tap save
[ ] Confirm updated text appears on the card on the list
[ ] Long-press "Test note 3" — delete option appears
[ ] Confirm delete — note removed from the list
[ ] Long-press "Test note 3" — move-to-Trash option appears
[ ] Confirm move — note disappears from the list and appears in Trash
[ ] Restore from Trash — note returns to the list; delete permanently from Trash — note is destroyed
[ ] Force-stop app from system settings
[ ] Reopen app — "Test note 1" and "Test note 2 (edited)" both visible on the list
[ ] Pass — v0.1 verified
@@ -365,11 +370,15 @@ A short reference for AI assistants:
| Version | Date | Notes |
|---------|------|-------|
| 0.3.7.0 | 2026-08-20 | **Feature release — Trash / soft delete.** Deleting a note (long-press card → ⋮ menu → Delete, or the editor's delete action) now soft-deletes it instead of destroying it: the note is flagged as trashed and hidden from Home, Favorites, Untagged, tag views, and ordinary search. A new **Trash** entry in the nav drawer lists only soft-deleted notes; each Trash card's overflow menu exposes **Restore** (returns the note to its previous views) and **Delete permanently** (destroys the row + attachments for good). `NoteEntity` gains a `trashed` flag (additive schema, auto-migrated); `NoteFilter` gains a `Trash` case; the repository gains `moveToTrash` / `restoreFromTrash` / `deletePermanently`; the drawer, list, and editor ViewModels + screens wire the new actions. Backups round-trip the trashed state. No automatic purge window yet — permanent deletion is immediate (see §6.1 "Trash status" note). versionCode 30→31, versionName "0.3.6.3"→"0.3.7.0", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.6.3 | 2026-08-20 | **Emergency hotfix — actionable missing-keystore failure.** On a fresh clone, `./gradlew assembleRelease` previously died late inside `packageRelease` with the cryptic `SigningConfig "release" is missing required property "storeFile"`. It now fails with a clear `GradleException` quoting the exact `keytool` command from `keystore/README.md` to generate `keystore/release.jks`, implemented as a `validateReleaseKeystore` task whose existence check runs in `doFirst` (so `assembleDebug` still works without a keystore). CI unaffected — `.gitea/workflows/release.yml` mints the dev keystore on release runners before `assembleRelease`. No app/Compose code changes. versionCode 29→30, versionName "0.3.6.2"→"0.3.6.3", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.6.2 | 2026-08-19 | **CI / release-pipeline tag.** v0.3.6.2 is a re-tag of the v0.3.6.1 commit used to exercise the Gitea Actions release workflow (minting the dev keystore on the release runner and attaching the version-stamped debug + release APKs to the Gitea release). No app code or version-string changes landed under this tag — the tagged commit still reads versionName "0.3.6.1" / versionCode 28. |
| 0.3.6.1 | 2026-08-19 | **Emergency hotfix** — two UX bugs in the v0.3.6.0 New/Edit screen. **1. Top-bar title crowded the action buttons.** `NoteEditorScreen` used `CenterAlignedTopAppBar`, but with six actions on the right (camera, attach, tag, favourite, save, more) the visually-centred title ended up pressed against the action cluster — users read it as "the title is on the right". Fix: swap the top bar for `TopAppBar` (Material 3's left-aligned variant) so "New"/"Edit" sits flush right of the back arrow on the left and the action cluster keeps the right edge. Import swap; no behavioural change for the actions or title text. **2. Colour chooser was not equally spaced.** The picker `Row` had `padding(vertical = 4.dp)` (4dp above + 4dp below), but the `OutlinedTextField` below it has an intrinsic top inset (~16dp) inside its border, so the perceived gap from the picker to the first line of the note dwarfed the gap from the title bar's bottom to the picker's top — to the user, "the picker is jammed up against the title bar". Fix: remove the row's `vertical = 4.dp` and bracket it with two explicit `Spacer(Modifier.height(12.dp))` siblings (one before the row, one after) so the picker sits 12dp from the title bar AND 12dp from the field's top border. The asymmetric `OutlinedTextField` internal padding is now matched on both sides of the picker, giving visually equal breathing room up and down. versionCode 27→28, versionName "0.3.6.0"→"0.3.6.1", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.6.0 | 2026-08-19 | **Maintenance release** — share-into titles + encryption-key recovery. **1. Share webpages into Incido with a subject line.** `Intent.EXTRA_SUBJECT` from an inbound `ACTION_SEND` is now routed through `NoteEditorViewModel.initialSharedSubject` and prepended to the new note's content as a first line ("Page title") above the shared body/URL (already supported since v0.3.1.0). Browsers fill `EXTRA_SUBJECT` with the page title when the user shares a URL, so the resulting note reads naturally as a bookmark without ever leaving the device — fully offline, no `INTERNET` permission. **2. Export / Import encryption key.** New rows in Settings → Security expose the underlying AES-256 wrapping key as a passphrase-protected `.inckey` envelope (PBKDF2 200k iters + AES-GCM): "Export encryption key" writes the wrapped blob to a user-chosen SAF uri, "Import encryption key" reads it back, validates the passphrase, and atomically replaces the active key — with a clear warning dialog listing the consequences ("your existing encrypted notes will become unverifiable"). The 32-byte raw key never appears on screen or in logs; only the wrapped envelope crosses the SAF boundary. versionCode 26→27, versionName "0.3.5.1"→"0.3.6.0", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.5.1 | 2026-08-17 | **Emergency hotfix** — two UX bugs in v0.3.5.0. **1. "Encrypted" badge silently failed to appear on the first enable.** Audit found `EncryptionVerifier.checkNow()` early-returned with `if (_checking.value) return` whenever a verify-all was in flight. The startup pass launched from `AppContainer.init` could still be running when the user toggled Encrypt-at-rest in Settings; the post-migration re-check then silently dropped, the startup pass eventually wrote its stale (pre-encryption, empty verified-id) result back to the StateFlow, and the cards never earned the badge until the second toggle or a relaunch let a fresh check actually run. Fix: drop the `_checking` skip-guard and replace it with a `kotlinx.coroutines.sync.Mutex` that serializes checks in invocation order. Every `checkNow()` call now takes its turn and the last call's result wins, so the post-migration check always produces the fresh verified-id set; the startup pass is cheap (no encrypted rows yet → all skips) so user-triggered checks after a real migration only wait milliseconds. **2. "Encrypted" badge UX on note cards.** v0.3.5.0 rendered the indicator as a centred `Row` with a lock icon + "Encrypted" label at the card's bottom edge. Replace with a bare 14 dp `Lock` `Icon` sitting immediately to the LEFT of the timestamp inside the card's existing bottom Row — the row already uses `Alignment.CenterVertically`, so the icon is vertically centred with the date/time and lives in the same left-anchored position on every card regardless of card content (tag row, body preview, checklist summary). The icon keeps the existing `contentDescription = "Encrypted"`. versionCode 25→26, versionName "0.3.5.0"→"0.3.5.1", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.5.0 | 2026-08-17 | **Maintenance release** — real at-rest encryption, verified "Encrypted" badge, and screenshot blocking. **1. Real field-level encryption ("Encrypt in place" now works).** Audit of the v0.3.2.0 toggle found it was cosmetic: `ObjectBoxStore.init()` ignored the key (`@Suppress("UNUSED_PARAMETER")`), `AppContainer` always passed `encryptionKey = null`, and the OSS ObjectBox 4.0.3 `BoxStoreBuilder` exposes no encryption API at all (verified against the local artifact — page-level encryption is ObjectBox Sync/Pro only). Fix: application-layer field encryption. `NoteEntity` gains `cipherVersion` (0=plain, 1=AES-256-GCM) + `contentBlob`; `NoteAttachmentEntity` gains the same pair for `bytesBlob` — additive schema, auto-migrated. New `FieldCipher` abstraction in `:core:data` with `AesGcmFieldCipher` in `:composeApp` (fresh random 12-byte nonce per blob; GCM tag = integrity proof), keyed by the existing Keystore-wrapped 32-byte key from `ObjectBoxKeyProvider`. The repository consults a shared `CipherHolder` on every read/write (encrypt-on-write, decrypt-on-read, in-memory content search while encrypted); `NoteCryptoService` sweeps all rows in place with progress. Toggling encryption ON installs the cipher and encrypts every plaintext note + attachment row live (no restart); toggling OFF decrypts everything first, then removes the cipher and deletes the key; disabling Security entirely also runs the decrypt sweep so no data is orphaned. AES-256-GCM is the correct PQ-era choice for data at rest (NIST: Grover halves effective security → ~128-bit residual; no public-key crypto in this path). **2. Verified "Encrypted" badge on cards.** New `EncryptionVerifier` runs on every app open (and after each migration): full trial-decrypt of every `cipherVersion = 1` note row; the GCM auth tag passing is the proof of integrity. Only notes in the resulting verified-id set get a bottom-centre "Encrypted" label (with lock icon) on their card — never derived from the settings flag alone; rows that fail verification are reported and excluded. **3. Block screenshots toggle (default ON).** New `UserSettings.blockScreenshots` (DataStore-backed, defaults true); `MainActivity` applies/clears `FLAG_SECURE` from a startup snapshot + live settings-flow collection, blocking screenshots, screen recording, and app-switcher previews; Settings → Security gains the "Block screenshots" switch. Settings copy for encryption updated (no longer claims a restart is required). versionCode 24→25, versionName "0.3.4.0"→"0.3.5.0", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.4.0 | 2026-08-17 | **Maintenance release** — three changes. **1. Attachment indicator on note cards** — a paperclip icon (`Icons.Filled.AttachFile`) now appears on the right edge of every card whose note carries at least one attachment (any type — image, PDF, audio…). It is a non-interactive `Icon` (24 dp, `contentDescription = "Has attachments"`) aligned `Alignment.CenterEnd` with `padding(end = 16.dp)` so its glyph centre sits at 28 dp from the right edge — the same vertical column as the ⋮ overflow `IconButton` (top) and the favourite star (bottom), exactly halfway between them (both neighbours centre their 24 dp glyphs at 28 dp: 4 dp padding + 24 dp inside a 48 dp `IconButton`). Bare `Icon` rather than `IconButton` so it never intercepts the whole-card tap that opens the editor. **2. Light-theme readability over image thumbnails** — the card's 0.45-alpha black scrim always renders the background dark, but the overlay content kept the theme-driven colours, so in Light mode dark text sat on a dark photo (all but invisible). Fix: when a thumbnail is present every overlay switches to a forced light palette regardless of theme — title pure white; body preview, checklist summary, timestamp, ⋮ icon, unfilled star, paperclip and "+N" tag overflow white @ 85 %; hashtag chips white; favourited star a light amber (`#FFD54F`) so "favourited" stays distinguishable; the Card's `contentColor` is also set to white. Plain (no-thumbnail) cards are untouched and keep their existing tinted/surface colours. `HashtagRow` now takes caller-supplied `tagColor` / `overflowColor` params. **3. Auto-Lock = Immediate + file-picker hotfix** — with Auto-Lock set to "Immediately", attaching a file (paperclip → SAF picker), taking a photo (camera), opening an attachment in the system viewer, or exporting/importing a backup locked the app the moment the external activity returned: the picker backgrounds the Activity (`ON_STOP`), the return fires `ON_RESUME`, and the 0 ms timeout always re-locks. The lock gate then tore down the `NavHost` from composition, destroying the editor's `NavBackStackEntry` ViewModelStore — so the unsaved note vanished and the picker result never landed. Fix: `SecurityManager` gains an in-flight flag (`externalActivityInFlight`, `@Volatile`) set by a new `beginExternalActivity()` and consumed exactly once by `onAppForegrounded()`, which skips the re-lock check and clears `backgroundedAt` when the flag is set. Call sites: `NoteEditorScreen` (file picker launch, camera launch after permission grant, system-viewer `ACTION_VIEW` — `securityManager` threaded through `AttachmentStrip`/`AttachmentThumbnail`), `SettingsScreen` (backup export + import SAF launchers), with `IncidoApp` threading `resolvedSecurity` to both screens. Genuine background/foreground cycles still lock as configured; cold launch is unaffected (fresh process ⇒ flag always false). versionCode 23→24, versionName "0.3.3.8"→"0.3.4.0", SettingsViewModel.APP_VERSION bumped in lockstep. || 0.3.3.8 | 2026-08-17 | **Emergency hotfix** — the designed `incido.png` artwork (glass shield + fountain-pen nib) replaces the v0.1 placeholder launcher icon. The 2048×2048 source is downscaled (LANCZOS) into density-correct raster buckets: `mipmap-{mdpi…xxxhdpi}/ic_launcher.png` (48/72/96/144/192 px square) plus anti-aliased circular `ic_launcher_round.png` in the same buckets, and `drawable-{mdpi…xxxhdpi}/ic_launcher_foreground.png` (108/162/216/324/432 px) feeding the `mipmap-anydpi-v26` adaptive icons (`ic_launcher.xml` / `ic_launcher_round.xml`), whose stale `<monochrome>` placeholder reference is dropped and whose `ic_launcher_background` colour is re-tinted from `#6650A4` to the artwork's edge navy `#010435` so parallax exposure is seamless. The obsolete placeholder vector `drawable/ic_launcher_foreground.xml` is deleted; manifest `android:icon` / `android:roundIcon` references are unchanged. versionCode 22→23, versionName "0.3.3.7"→"0.3.3.8", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.4.0 | 2026-08-17 | **Maintenance release** — three changes. **1. Attachment indicator on note cards** — a paperclip icon (`Icons.Filled.AttachFile`) now appears on the right edge of every card whose note carries at least one attachment (any type — image, PDF, audio…). It is a non-interactive `Icon` (24 dp, `contentDescription = "Has attachments"`) aligned `Alignment.CenterEnd` with `padding(end = 16.dp)` so its glyph centre sits at 28 dp from the right edge — the same vertical column as the ⋮ overflow `IconButton` (top) and the favourite star (bottom), exactly halfway between them (both neighbours centre their 24 dp glyphs at 28 dp: 4 dp padding + 24 dp inside a 48 dp `IconButton`). Bare `Icon` rather than `IconButton` so it never intercepts the whole-card tap that opens the editor. **2. Light-theme readability over image thumbnails** — the card's 0.45-alpha black scrim always renders the background dark, but the overlay content kept the theme-driven colours, so in Light mode dark text sat on a dark photo (all but invisible). Fix: when a thumbnail is present every overlay switches to a forced light palette regardless of theme — title pure white; body preview, checklist summary, timestamp, ⋮ icon, unfilled star, paperclip and "+N" tag overflow white @ 85 %; hashtag chips white; favourited star a light amber (`#FFD54F`) so "favourited" stays distinguishable; the Card's `contentColor` is also set to white. Plain (no-thumbnail) cards are untouched and keep their existing tinted/surface colours. `HashtagRow` now takes caller-supplied `tagColor` / `overflowColor` params. **3. Auto-Lock = Immediate + file-picker hotfix** — with Auto-Lock set to "Immediately", attaching a file (paperclip → SAF picker), taking a photo (camera), opening an attachment in the system viewer, or exporting/importing a backup locked the app the moment the external activity returned: the picker backgrounds the Activity (`ON_STOP`), the return fires `ON_RESUME`, and the 0 ms timeout always re-locks. The lock gate then tore down the `NavHost` from composition, destroying the editor's `NavBackStackEntry` ViewModelStore — so the unsaved note vanished and the picker result never landed. Fix: `SecurityManager` gains an in-flight flag (`externalActivityInFlight`, `@Volatile`) set by a new `beginExternalActivity()` and consumed exactly once by `onAppForegrounded()`, which skips the re-lock check and clears `backgroundedAt` when the flag is set. Call sites: `NoteEditorScreen` (file picker launch, camera launch after permission grant, system-viewer `ACTION_VIEW` — `securityManager` threaded through `AttachmentStrip`/`AttachmentThumbnail`), `SettingsScreen` (backup export + import SAF launchers), with `IncidoApp` threading `resolvedSecurity` to both screens. Genuine background/foreground cycles still lock as configured; cold launch is unaffected (fresh process ⇒ flag always false). versionCode 23→24, versionName "0.3.3.8"→"0.3.4.0", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.3.8 | 2026-08-17 | **Emergency hotfix** — the designed `incido.png` artwork (glass shield + fountain-pen nib) replaces the v0.1 placeholder launcher icon. The 2048×2048 source is downscaled (LANCZOS) into density-correct raster buckets: `mipmap-{mdpi…xxxhdpi}/ic_launcher.png` (48/72/96/144/192 px square) plus anti-aliased circular `ic_launcher_round.png` in the same buckets, and `drawable-{mdpi…xxxhdpi}/ic_launcher_foreground.png` (108/162/216/324/432 px) feeding the `mipmap-anydpi-v26` adaptive icons (`ic_launcher.xml` / `ic_launcher_round.xml`), whose stale `<monochrome>` placeholder reference is dropped and whose `ic_launcher_background` colour is re-tinted from `#6650A4` to the artwork's edge navy `#010435` so parallax exposure is seamless. The obsolete placeholder vector `drawable/ic_launcher_foreground.xml` is deleted; manifest `android:icon` / `android:roundIcon` references are unchanged. versionCode 22→23, versionName "0.3.3.7"→"0.3.3.8", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.3.7 | 2026-08-17 | **Emergency hotfix** — when Biometric is the active lock method, the lock screen's "Authenticate" button required an extra tap before the fingerprint / face reader would start. Fix: `PinEntryScreen` now auto-launches the `BiometricPrompt` as soon as the lock screen composes in biometric-only mode (`settings.isBiometricLockActive`), via a one-shot `LaunchedEffect(biometricOnly)` guarded by an `autoLaunched` flag (so a cancelled prompt cannot re-trigger). Success → `onUnlocked()`; cancel/error → the lock screen stays with an error message and the "Authenticate" button remains as the manual-retry path. The failure message in biometric-only mode no longer mentions a PIN ("Authentication failed. Tap Authenticate to try again."). PIN mode is untouched — `biometricOnly` is false there, so the auto-launch effect never runs and the PIN field keeps its auto-focus. versionCode 21→22, versionName "0.3.3.6"→"0.3.3.7", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.3.6 | 2026-08-17 | **Emergency hotfix** — the fixed card height shipped in v0.3.3.5 (`168.dp`) proved too tall on real devices. Fix: `CARD_HEIGHT_DP` in `NoteListScreen.kt` reduced by ~15% to `143.dp` (~15% taller than the pre-0.3.3.5 wrap-content typical of ~124.dp). Everything else from v0.3.3.5 is unchanged — cards remain a single fixed height, the timestamp stays pinned to the card's bottom edge via the weighted spacer, the hashtag row is still hidden when empty, and the colour stripe still spans the full card height. versionCode 20→21, versionName "0.3.3.5"→"0.3.3.6", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.3.5 | 2026-08-17 | **Emergency hotfix** — the note cards on the main page used wrap-content height, so card heights varied depending on whether the note carried a body preview, hashtag row, or checklist summary (and untagged notes rendered visibly shorter than tagged ones). Fix: every `NoteCard` now has a fixed height of `168.dp` (~35% taller than the previous typical wrap-content height of ~124.dp for a title + 2-line body preview), applied via `Modifier.height(CARD_HEIGHT_DP)` on the Card. A `Spacer(Modifier.weight(1f))` inside the content column pins the timestamp row to the bottom of the fixed-height card so the layout stays consistent regardless of content; the hashtag row is still hidden entirely when the note has no tags. The left colour stripe now spans the full card height (`fillMaxHeight().width(14.dp)`) instead of the hardcoded `size(width = 14.dp, height = 110.dp)`. Thumbnail background + scrim, dog-ear, ⋮ overflow button, favourite-star overlay, and long-press menu are unaffected (all corner-anchored). versionCode 19→20, versionName "0.3.3.4"→"0.3.3.5", SettingsViewModel.APP_VERSION bumped in lockstep. |
+21 -11
View File
@@ -6,16 +6,17 @@ Incido is a privacy-first, on-device note-taking application for Android.
All data stays on your device by default — no accounts, no cloud, no
trackers.
This repository contains the **v0.3.6.3** release: a single-user, offline
This repository contains the **v0.3.7.0** release: a single-user, offline
note app with hashtags, favourites, full-text search, colour-coded
notes, photo and file attachments, share-into from other apps and the
web, at-rest AES-256-GCM encryption with screenshot blocking, PIN /
biometric lock, encrypted backup and restore, and an exportable
encryption key for device migrations. The architecture is multi-module
Android today and is structured so iOS / Desktop ports can happen later
without UI rewrites.
web, Trash (soft delete with Restore / permanent delete), at-rest
AES-256-GCM encryption with screenshot blocking, PIN / biometric lock,
encrypted backup and restore, and an exportable encryption key for
device migrations. The architecture is multi-module Android today and
is structured so iOS / Desktop ports can happen later without UI
rewrites.
**Current release:** v0.3.6.3 (see [Changelog](#changelog) below).
**Current release:** v0.3.7.0 (see [Changelog](#changelog) below).
> **Version scheme (from v0.3.0.0 onwards):** `MAJOR.MINOR.MAINTENANCE.EMERGENCY` —
> e.g. `0.3.0.0`. `MAJOR.MINOR.MAINTENANCE` are normal release numbers;
@@ -41,9 +42,13 @@ without UI rewrites.
top-right — so different-coloured notes are visually distinct at a
glance without you needing to focus on the stripe.
- **Navigation drawer.** Hamburger top-left opens a drawer with
**Home**, **Favorites**, **Untagged**, a divider, then a live scrollable
list of the most-recently-used hashtags. Tap any entry to filter the
list to just those notes.
**Home**, **Favorites**, **Untagged**, **Trash**, a divider, then a live
scrollable list of the most-recently-used hashtags. Tap any entry to
filter the list to just those notes.
- **Trash / soft delete.** Deleting a note moves it out of Home, Favorites,
Untagged, tag views, and ordinary search. The Trash view contains only
soft-deleted notes; its overflow menu can restore a note, while permanent
deletion destroys its row and attachments.
- **Centred app-bar title.** Both the list screen (`Incido`) and the
editor (`Edit note` / `New note`) now centre their titles via
Material 3's `CenterAlignedTopAppBar`.
@@ -105,8 +110,10 @@ cross-platform ports, end-to-end sync, and security features.
## Changelog
| Version | Date | Highlights |
| 0.3.7.0 | 2026-08-20 | **Trash / soft delete.** Add a Trash drawer item; deleting a note soft-deletes it, hiding it from every active view and ordinary search. Trash-only cards expose Restore and permanent Delete. |
|-----------|------------|------------|
| 0.3.6.3 | 2026-08-20 | **Missing-keystore failure is now actionable on a fresh clone.** `./gradlew assembleRelease` now fails at configuration time with a clear `GradleException` quoting the exact `keytool` command from `keystore/README.md` if `keystore/release.jks` is missing, instead of dying much later inside `packageRelease` with the cryptic `SigningConfig "release" is missing required property "storeFile"`. CI is unchanged: `.gitea/workflows/release.yml` already mints the dev keystore on the runner before `assembleRelease`. |
| 0.3.6.2 | 2026-08-19 | **CI / release-pipeline tag** — re-tag of v0.3.6.1 used to exercise the Gitea Actions release workflow (keystore minted on the release runner; debug + release APKs attached to the Gitea release). No app changes. |
| 0.3.6.1 | 2026-08-19 | **Editor top-bar title is now left-aligned.** On the New / Edit screen the title ("New" / "Edit") now sits next to the back arrow, away from the six action icons that crowd the right edge — it was previously centred via `CenterAlignedTopAppBar` and visually pushed toward the action cluster. **Colour picker is now symmetric between the title bar and the note top.** The picker is flanked by 12dp gaps above and below (was 4dp top + 4dp bottom) so the visual distance to the title bar matches the distance to the `OutlinedTextField`'s top edge, instead of being dwarfed by the field's intrinsic top inset. |
| 0.3.6.0 | 2026-08-19 | **Share webpages to Incido.** Sharing a page from your browser (Share → Incido) now creates a note with the page title on the first line and the URL below — fully offline (the title comes from the browser's share data, Incido never touches the network). **Export encryption key.** Settings → Security gains "Export encryption key" — saves the AES-256 key that protects your encrypted notes to a passphrase-protected `.inckey` file for device migrations. **Import encryption key** restores that key on a fresh install, with a clear warning before the current key is replaced. |
| 0.3.5.1 | 2026-08-17 | **"Encrypted" badge now appears the moment you flip the switch.** A race in `EncryptionVerifier.checkNow()` could silently drop the post-migration verification, leaving cards without the badge until a second toggle; replaced with a serializing Mutex so every check runs in invocation order. **"Encrypted" indicator is now a single lock icon next to the date** — consistent position on every card instead of a centred "lock + label" group at the bottom. |
@@ -257,7 +264,10 @@ After the first push:
[ ] Tap "Favorites" → list shows only starred notes
[ ] Tap "Untagged" → list shows only notes with zero hashtags
[ ] Tap a recent hashtag → list filters to that tag
[ ] Tap "Home" → back to all notes
[ ] Tap "Trash" → list shows only soft-deleted notes
[ ] Delete a note → it disappears from Home/search/tag/Favorites and appears in Trash
[ ] Trash card overflow → "Restore" returns the note; "Delete permanently" destroys it
[ ] Tap "Home" → back to all active notes
[ ] Open a note → chip row above text field shows current tags (empty placeholder if none)
[ ] Tap "#" icon → sheet opens, type "wo" → suggestions filter
[ ] Add a new tag → chip appears, counter goes from N/5 to (N+1)/5
+58 -49
View File
@@ -28,51 +28,28 @@ android {
applicationId = "org.incido.app"
minSdk = 26
targetSdk = 35
// v0.3.6.3: Local-dev DX — make the missing-keystore failure
// mode actionable.
// - signingConfigs.release now throws GradleException at
// config time when keystore/release.jks is missing, with
// the exact keytool incantation from keystore/README.md
// in the error message. Previously the signing config
// silently fell through with no storeFile, and packageRelease
// failed much later with the cryptic "SigningConfig release
// is missing required property storeFile" — leaving devs
// guessing at the cause.
// - .gitea/workflows/release.yml already mints the keystore
// on release runners (since v0.3.6.2), so CI is unaffected.
// - No app/Compose code changes.
// - versionCode monotonic +1 from v0.3.6.2 (29).
versionCode = 30
versionName = "0.3.6.3"
// v0.3.7.0: Trash / soft delete — deleting a note now flags it
// trashed (hidden from every active view and ordinary search);
// a Trash drawer entry exposes Restore and permanent Delete.
// - NoteEntity gains `trashed` (additive schema, auto-migrated);
// NoteFilter gains a Trash case; the repository gains
// moveToTrash / restoreFromTrash / deletePermanently; drawer,
// list, and editor ViewModels + screens wire the actions;
// backups round-trip the trashed state.
// - versionCode monotonic +1 from v0.3.6.3 (30).
versionCode = 31
versionName = "0.3.7.0"
}
// --- Signing ---
// v0.3.6.3: Fail fast (at config time) with an actionable error
// when keystore/release.jks is missing, rather than silently
// letting packageRelease die later with the cryptic "SigningConfig
// release is missing required property storeFile". CI (see
// .gitea/workflows/release.yml) already mints the keystore before
// assembleRelease (since v0.3.6.2), so this branch never fires on
// a release runner — only on a fresh local clone.
// The release signing config is declared even when the keystore is absent;
// the existence check is deferred to assembleRelease execution time so that
// assembleDebug (which doesn't need the keystore) runs cleanly on a fresh
// clone. CI always mints the keystore before calling assembleRelease, so
// this branch never fires in the normal workflow.
signingConfigs {
create("release") {
val keystoreFilePath = rootProject.file("keystore/release.jks")
if (!keystoreFilePath.exists()) {
throw GradleException(
"Missing ${keystoreFilePath.absolutePath}.\n" +
"Generate the dev keystore documented in " +
"keystore/README.md:\n" +
" keytool -genkey -noprompt -v \\\n" +
" -keystore keystore/release.jks \\\n" +
" -keyalg RSA -keysize 2048 -validity 10000 \\\n" +
" -alias incido \\\n" +
" -storepass incido_dev_keystore \\\n" +
" -keypass incido_dev_keystore \\\n" +
" -dname \"CN=Incido Dev, OU=Local, O=Incido, " +
"L=Local, ST=Local, C=NZ\""
)
}
storeFile = keystoreFilePath
storeFile = rootProject.file("keystore/release.jks")
storePassword = "incido_dev_keystore"
keyAlias = "incido"
keyPassword = "incido_dev_keystore"
@@ -89,6 +66,29 @@ android {
}
}
// Fail fast with an actionable message only when assembleRelease actually
// runs and the keystore is missing — not during project configuration.
tasks.register("validateReleaseKeystore") {
group = "build"
description = "Validates that keystore/release.jks exists before assembleRelease runs"
doFirst {
val f = rootProject.file("keystore/release.jks")
if (!f.exists()) {
throw GradleException(
"Missing ${f.absolutePath}.\n" +
"Generate the dev keystore documented in keystore/README.md:\n" +
" keytool -genkey -noprompt -v \\\n" +
" -keystore keystore/release.jks \\\n" +
" -keyalg RSA -keysize 2048 -validity 10000 \\\n" +
" -alias incido \\\n" +
" -storepass incido_dev_keystore \\\n" +
" -keypass incido_dev_keystore \\\n" +
" -dname \"CN=Incido Dev, OU=Local, O=Incido, " +
"L=Local, ST=Local, C=NZ\""
)
}
}
}
buildFeatures {
compose = true
}
@@ -109,6 +109,13 @@ android {
}
}
// Wire the keystore validator after Android has created the release task.
// Looking the task up before configuration completes makes the build fail
// for unrelated compile/debug tasks as well.
afterEvaluate {
tasks.findByName("assembleRelease")?.dependsOn("validateReleaseKeystore")
}
// v0.3.6.0: ship version-stamped APKs at the repo root for every
// release (e.g. `Incido-0.3.6.0-debug.apk`, `Incido-0.3.6.0-release.apk`).
// See Incido Development Plan §11 for the full release build
@@ -120,19 +127,22 @@ android {
// with `Iterable<T>.all(predicate: (T) -> Boolean)` and the modern
// `androidComponents.onVariants` API doesn't expose `outputFileName` as
// a settable property on its outputs), we just register a copy task
// that runs after both `assembleDebug` and `assembleRelease` and drops
// the built APKs at the project root with the right names.
// that runs after the debug and release builds and drops the built APKs
// at the project root with the right names. The release task is attached
// as a finalizer below, so the copy task must not depend on it directly.
//
// `copyReleaseApks` is registered as a `dependsOn` of `assembleRelease`
// so `./gradlew assembleRelease` is enough to get both files at the
// repo root in one command.
// `copyReleaseApks` runs as a finalizer of `assembleRelease`, so
// `./gradlew assembleRelease` is enough to get both files at the repo
// root in one command.
val copyReleaseApks = tasks.register("copyReleaseApks") {
group = "build"
description = "Copies debug + release APKs to the repo root, " +
"stamped with the current versionName " +
"(e.g. Incido-0.3.6.3-debug.apk, Incido-0.3.6.3-release.apk). " +
"See Incido Development Plan §11."
dependsOn("assembleDebug", "assembleRelease")
// assembleRelease invokes this task as a finalizer; depending on
// assembleRelease here would create a task graph cycle.
dependsOn("assembleDebug")
doLast {
val versionName = android.defaultConfig.versionName
val rootDir = rootProject.projectDir
@@ -156,9 +166,8 @@ val copyReleaseApks = tasks.register("copyReleaseApks") {
}
// Make `assembleRelease` finalize with `copyReleaseApks` so a single
// `./gradlew assembleRelease` produces both root-level APKs. Using
// `finalizedBy` (not `dependsOn`) avoids a circular dependency:
// `copyReleaseApks` already `dependsOn` `assembleRelease`.
// `./gradlew assembleRelease` produces both root-level APKs. The copy
// task depends on assembleDebug, avoiding a task graph cycle.
afterEvaluate {
tasks.findByName("assembleRelease")?.finalizedBy(copyReleaseApks)
}
@@ -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 {
@@ -33,6 +33,8 @@ data class NoteEntity(
var cipherVersion: Int = 0,
/** Encrypted payload: `nonce (12) | ciphertext + GCM tag`. Empty when plaintext. */
var contentBlob: ByteArray = ByteArray(0),
/** True only for notes moved to the Trash view; active-note queries exclude these rows. */
@Index var isTrashed: Boolean = false,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -43,6 +45,7 @@ data class NoteEntity(
if (updatedAt != other.updatedAt) return false
if (isFavorite != other.isFavorite) return false
if (colorKey != other.colorKey) return false
if (isTrashed != other.isTrashed) return false
if (cipherVersion != other.cipherVersion) return false
if (!contentBlob.contentEquals(other.contentBlob)) return false
return true
@@ -55,6 +58,7 @@ data class NoteEntity(
result = 31 * result + updatedAt.hashCode()
result = 31 * result + isFavorite.hashCode()
result = 31 * result + colorKey.hashCode()
result = 31 * result + isTrashed.hashCode()
result = 31 * result + cipherVersion.hashCode()
result = 31 * result + contentBlob.contentHashCode()
return result
@@ -68,6 +72,7 @@ internal fun NoteEntity.toDomain(): Note = Note(
updatedAt = updatedAt,
isFavorite = isFavorite,
color = NoteColor.fromStorageKey(colorKey),
isTrashed = isTrashed,
)
internal fun Note.toEntity(): NoteEntity = NoteEntity(
@@ -77,4 +82,5 @@ internal fun Note.toEntity(): NoteEntity = NoteEntity(
updatedAt = updatedAt,
isFavorite = isFavorite,
colorKey = color.storageKey,
isTrashed = isTrashed,
)
@@ -82,6 +82,14 @@ class NoteRepositoryImpl(
awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default)
override fun observeAllIncludingTrashed(): Flow<List<Note>> = callbackFlow {
trySend(snapshotAllIncludingTrashed())
val sub = noteBox.query().build().subscribe().observer {
trySend(snapshotAllIncludingTrashed())
}
awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default)
override fun search(query: String): Flow<List<Note>> = callbackFlow {
trySend(snapshotSearch(query))
val sub = noteBox.query().build().subscribe().observer { trySend(snapshotSearch(query)) }
@@ -100,6 +108,16 @@ class NoteRepositoryImpl(
awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default)
override fun observeTrashed(): Flow<List<Note>> = callbackFlow {
trySend(snapshotTrashed())
val sub = noteBox.query()
.equal(NoteEntity_.isTrashed, true)
.build()
.subscribe()
.observer { trySend(snapshotTrashed()) }
awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default)
override fun observeNotesForHashtag(name: String): Flow<List<Note>> = callbackFlow {
trySend(snapshotForHashtag(name))
val sub = noteBox.query().build().subscribe().observer { trySend(snapshotForHashtag(name)) }
@@ -118,6 +136,12 @@ class NoteRepositoryImpl(
awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default)
override fun searchTrashed(query: String): Flow<List<Note>> = callbackFlow {
trySend(snapshotTrashSearch(query))
val sub = noteBox.query().build().subscribe().observer { trySend(snapshotTrashSearch(query)) }
awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default)
override fun observeHashtagsByRecentUse(): Flow<List<HashtagUsage>> = callbackFlow {
// The snapshot reads from noteBox + xrefBox + tagBox, so we must
// subscribe to ALL three — otherwise a change that only touches
@@ -285,19 +309,75 @@ class NoteRepositoryImpl(
* query cannot see ciphertext, so when encryption is active we
* decrypt and filter in-memory (fine at notes-app scale). Hashtag
* matching is unaffected — tag names stay plaintext.
*
* [includeTrashed] is deliberately explicit: normal searches must
* never leak a trashed row, while Trash search must never return an
* active row.
*/
private fun contentMatchingNoteIds(query: String): List<Long> {
if (fieldCipher == null) {
return noteBox.query()
.contains(NoteEntity_.content, query, QueryBuilder.StringOrder.CASE_INSENSITIVE)
private fun contentMatchingNoteIds(
query: String,
includeTrashed: Boolean = false,
): List<Long> {
val q = query.trim()
if (q.isEmpty()) return emptyList()
val candidates = if (fieldCipher == null) {
noteBox.query()
.contains(NoteEntity_.content, q, QueryBuilder.StringOrder.CASE_INSENSITIVE)
.build()
.find()
} else {
val needle = q.lowercase()
noteBox.all.filter { toReadable(it).content.lowercase().contains(needle) }
}
return candidates
.filter { it.isTrashed == includeTrashed }
.map { it.id }
}
/** IDs of rows eligible for all active-note queries. */
private fun activeNoteIds(): Set<Long> =
noteBox.all.filter { !it.isTrashed }.mapTo(HashSet()) { it.id }
/** IDs of tags currently used by at least one active note. */
private fun activeTagIds(): Set<Long> {
val activeIds = activeNoteIds()
return xrefBox.all
.asSequence()
.filter { it.noteId in activeIds }
.mapTo(HashSet()) { it.hashtagId }
}
/**
* Return content and exact-hashtag matches for either the active
* note set or the Trash set, never a mixture of the two.
*/
private fun matchingNoteIds(
query: String,
includeTrashed: Boolean,
): Set<Long> {
val q = query.trim()
if (q.isEmpty()) return emptySet()
val contentMatches = contentMatchingNoteIds(q, includeTrashed)
val matchingTag: HashtagEntity? = tagBox.query()
.equal(HashtagEntity_.name, q, QueryBuilder.StringOrder.CASE_INSENSITIVE)
.build()
.findFirst()
val tagMatches: List<Long> = if (matchingTag == null) {
emptyList()
} else {
xrefBox.query()
.equal(NoteHashtagCrossRef_.hashtagId, matchingTag.id)
.build()
.find()
.mapNotNull { ref -> noteBox.get(ref.noteId) }
.filter { it.isTrashed == includeTrashed }
.map { it.id }
}
val needle = query.lowercase()
return noteBox.all
.filter { toReadable(it).content.lowercase().contains(needle) }
.map { it.id }
return (contentMatches + tagMatches).toSet()
}
/**
@@ -372,6 +452,25 @@ class NoteRepositoryImpl(
}
}
/** Soft-delete only changes state; the row, links, and blobs remain intact. */
override suspend fun softDelete(id: Long) {
val entity = noteBox.get(id) ?: return
if (entity.isTrashed) return
entity.isTrashed = true
// `put` is intentional here: content may be ciphertext already,
// so do not pass it through toWritable and encrypt the ciphertext a
// second time. Only the additive flag is changing.
noteBox.put(entity)
}
/** Clear the additive flag and make the note active again. */
override suspend fun restore(id: Long) {
val entity = noteBox.get(id) ?: return
if (!entity.isTrashed) return
entity.isTrashed = false
noteBox.put(entity)
}
override suspend fun setFavorite(id: Long, isFavorite: Boolean) {
val entity = noteBox.get(id) ?: return
if (entity.isFavorite == isFavorite) return
@@ -500,13 +599,18 @@ class NoteRepositoryImpl(
.mapValues { (_, rows) -> rows.sortedBy { it.createdAt } }
}
private fun decorate(entities: List<NoteEntity>): List<Note> {
private fun decorate(
entities: List<NoteEntity>,
includeTrashed: Boolean? = false,
): List<Note> {
val tags = hashtagsByNoteId()
val attachments = attachmentsByNoteId()
return entities.sortedWith(
compareByDescending<NoteEntity> { it.isFavorite }
.thenByDescending { it.updatedAt }
).map { e ->
return entities
.filter { includeTrashed == null || it.isTrashed == includeTrashed }
.sortedWith(
compareByDescending<NoteEntity> { it.isFavorite }
.thenByDescending { it.updatedAt },
).map { e ->
val base = toReadable(e).toDomain()
base.copy(
hashtags = tags[e.id].orEmpty(),
@@ -517,29 +621,10 @@ class NoteRepositoryImpl(
private fun snapshotAll(): List<Note> = decorate(noteBox.all)
private fun snapshotAllIncludingTrashed(): List<Note> = decorate(noteBox.all, includeTrashed = null)
private fun snapshotSearch(query: String): List<Note> {
val q = query.trim()
if (q.isEmpty()) return snapshotAll()
// Match against content (contains, case-insensitive).
// v0.3.5.0: cipher-aware — ObjectBox `contains()` can't see
// ciphertext, so encrypted stores match in-memory.
val contentMatches: List<Long> = contentMatchingNoteIds(q)
// Match against hashtag names (case-insensitive exact equality).
val matchingTag: HashtagEntity? = tagBox.query()
.equal(HashtagEntity_.name, q, QueryBuilder.StringOrder.CASE_INSENSITIVE)
.build()
.findFirst()
val tagMatches: List<Long> = if (matchingTag == null) emptyList() else {
xrefBox.query()
.equal(NoteHashtagCrossRef_.hashtagId, matchingTag.id)
.build()
.find()
.map { it.noteId }
}
val allIds: Set<Long> = (contentMatches + tagMatches).toSet()
val allIds = matchingNoteIds(query, includeTrashed = false)
if (allIds.isEmpty()) return emptyList()
val entities: List<NoteEntity> = allIds.mapNotNull { noteBox.get(it) }
return decorate(entities)
@@ -553,9 +638,23 @@ class NoteRepositoryImpl(
return decorate(favEntities)
}
private fun snapshotTrashed(): List<Note> {
val trashedEntities: List<NoteEntity> = noteBox.query()
.equal(NoteEntity_.isTrashed, true)
.build()
.find()
return decorate(trashedEntities, includeTrashed = true)
}
private fun snapshotUntagged(): List<Note> {
val noteIdsWithTags: Set<Long> = xrefBox.all.map { it.noteId }.toSet()
val untaggedEntities: List<NoteEntity> = noteBox.all.filter { it.id !in noteIdsWithTags }
val activeIds = activeNoteIds()
val noteIdsWithTags: Set<Long> = xrefBox.all
.asSequence()
.filter { it.noteId in activeIds }
.mapTo(HashSet()) { it.noteId }
val untaggedEntities: List<NoteEntity> = noteBox.all.filter {
it.id in activeIds && it.id !in noteIdsWithTags
}
return decorate(untaggedEntities)
}
@@ -568,13 +667,23 @@ class NoteRepositoryImpl(
private fun snapshotFavoritesSearch(query: String): List<Note> {
val q = query.trim()
if (q.isEmpty()) return snapshotFavorites()
val allIds: Set<Long> = snapshotSearchMatchingNoteIds(q)
val allIds: Set<Long> = matchingNoteIds(q, includeTrashed = false)
if (allIds.isEmpty()) return emptyList()
val entities: List<NoteEntity> = allIds.mapNotNull { id -> noteBox.get(id) }
.filter { it.isFavorite }
return decorate(entities)
}
/** Search only the Trash view, including content and hashtag matches. */
private fun snapshotTrashSearch(query: String): List<Note> {
val q = query.trim()
if (q.isEmpty()) return snapshotTrashed()
val allIds: Set<Long> = matchingNoteIds(q, includeTrashed = true)
if (allIds.isEmpty()) return emptyList()
val entities: List<NoteEntity> = allIds.mapNotNull { id -> noteBox.get(id) }
return decorate(entities, includeTrashed = true)
}
/**
* Context-aware search across untagged notes only. Blank [query]
* degrades to [snapshotUntagged]. Otherwise runs the content
@@ -584,38 +693,18 @@ class NoteRepositoryImpl(
private fun snapshotUntaggedSearch(query: String): List<Note> {
val q = query.trim()
if (q.isEmpty()) return snapshotUntagged()
val noteIdsWithTags: Set<Long> = xrefBox.all.mapTo(HashSet(xrefBox.all.size)) { it.noteId }
val contentMatches: List<Long> = contentMatchingNoteIds(q)
val activeIds = activeNoteIds()
val noteIdsWithTags: Set<Long> = xrefBox.all
.asSequence()
.filter { it.noteId in activeIds }
.mapTo(HashSet()) { it.noteId }
val contentMatches: List<Long> = contentMatchingNoteIds(q, includeTrashed = false)
val matching: List<NoteEntity> = contentMatches
.mapNotNull { id -> noteBox.get(id) }
.filter { it.id !in noteIdsWithTags }
.filter { it.id in activeIds && it.id !in noteIdsWithTags }
return decorate(matching)
}
/**
* Shared content + tag-name matcher used by [snapshotSearch] and
* [snapshotFavoritesSearch]. Returns the set of matching note ids.
*/
private fun snapshotSearchMatchingNoteIds(query: String): Set<Long> {
// Match against content (contains, case-insensitive).
val contentMatches: List<Long> = contentMatchingNoteIds(query)
// Match against hashtag names (case-insensitive exact equality).
val matchingTag: HashtagEntity? = tagBox.query()
.equal(HashtagEntity_.name, query, QueryBuilder.StringOrder.CASE_INSENSITIVE)
.build()
.findFirst()
val tagMatches: List<Long> = if (matchingTag == null) emptyList() else {
xrefBox.query()
.equal(NoteHashtagCrossRef_.hashtagId, matchingTag.id)
.build()
.find()
.map { it.noteId }
}
return (contentMatches + tagMatches).toSet()
}
private fun snapshotForHashtag(name: String): List<Note> {
val normalised = Hashtag.normalise(name)
val tag: HashtagEntity = tagBox.query()
@@ -626,7 +715,10 @@ class NoteRepositoryImpl(
.equal(NoteHashtagCrossRef_.hashtagId, tag.id)
.build()
.find()
val noteIds: Set<Long> = xrefs.map { it.id }.let { _ -> xrefs.map { it.noteId }.toSet() }
val activeIds = activeNoteIds()
val noteIds: Set<Long> = xrefs.map { it.noteId }
.filter { it in activeIds }
.toSet()
if (noteIds.isEmpty()) return emptyList()
val entities: List<NoteEntity> = noteIds.mapNotNull { noteBox.get(it) }
return decorate(entities)
@@ -644,7 +736,9 @@ class NoteRepositoryImpl(
/** Build [HashtagUsage] for every distinct tag, sorted by lastUsedAt DESC. */
private fun hashtagUsageSnapshot(): List<HashtagUsage> {
val activeIds = activeNoteIds()
val xrefs: List<NoteHashtagCrossRef> = xrefBox.all
.filter { it.noteId in activeIds }
if (xrefs.isEmpty()) return emptyList()
// 1) Batch-load each unique noteId once (was once per xref, which
@@ -687,8 +781,12 @@ class NoteRepositoryImpl(
)
}
private fun allHashtagsSnapshot(): List<String> =
tagBox.all.map { it.name }
private fun allHashtagsSnapshot(): List<String> {
val activeTagIds = activeTagIds()
return tagBox.all
.filter { it.id in activeTagIds }
.map { it.name }
}
private fun searchHashtagsSnapshot(prefix: String): List<String> {
val p = prefix.trim()
@@ -699,9 +797,17 @@ class NoteRepositoryImpl(
.build()
.find()
// Sort by usage count (most-used first), then name.
val usageById: Map<Long, Int> = xrefBox.all.groupingBy { it.hashtagId }.eachCount()
return byPrefix
// Trashed notes must not contribute to autocomplete suggestions.
val activeTagIds = activeTagIds()
val activeByPrefix = byPrefix.filter { it.id in activeTagIds }
// Sort by active-note usage count (most-used first), then name.
val usageById: Map<Long, Int> = xrefBox.all
.asSequence()
.filter { it.noteId in activeTagIds }
.groupingBy { it.hashtagId }
.eachCount()
return activeByPrefix
.sortedWith(
compareByDescending<HashtagEntity> { usageById[it.id] ?: 0 }
.thenBy { it.name }
@@ -22,6 +22,8 @@ data class Note(
* so the UI can render them in stable order.
*/
val attachments: List<NoteAttachment> = emptyList(),
/** True only for notes moved to the Trash view; active-note queries exclude these rows. */
val isTrashed: Boolean = false,
) {
/** Convenience: the first image attachment, or `null` if none. */
val firstImageAttachment: NoteAttachment?
@@ -5,15 +5,17 @@ package org.incido.domain.model
* `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.
* - [Home] — every active note (the default). The search bar is enabled.
* - [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.
* - [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 Trash : NoteFilter()
data class ByTag(val hashtag: String) : NoteFilter()
/** Stable identifier used by the drawer for `selected` matching. */
@@ -21,6 +23,7 @@ sealed class NoteFilter {
Home -> "home"
Favorites -> "favorites"
Untagged -> "untagged"
Trash -> "trash"
is ByTag -> "tag:$hashtag"
}
}
@@ -14,9 +14,12 @@ import org.incido.domain.model.NoteAttachment
* (case-insensitive equality).
*/
interface NoteRepository {
/** Stream of all notes, newest-first, favourites pinned to the top. */
/** Stream of all active notes, newest-first, favourites pinned to the top. */
fun observeAll(): Flow<List<Note>>
/** Stream of every note, including trashed notes, for maintenance/backup flows. */
fun observeAllIncludingTrashed(): Flow<List<Note>>
/**
* Stream of notes whose [Note.content] contains [query] (case-insensitive)
* OR whose hashtags contain [query] as one of the names. Favourites
@@ -31,9 +34,15 @@ interface NoteRepository {
/** Persist a new note or update an existing one. Returns the persisted [Note]. */
suspend fun upsert(note: Note): Note
/** Delete a note by id. No-op if it doesn't exist. */
/** Permanently delete a note by id. No-op if it doesn't exist. */
suspend fun delete(id: Long)
/** Move a note to Trash without removing its row, tags, or attachments. */
suspend fun softDelete(id: Long)
/** Restore a trashed note to the active list. */
suspend fun restore(id: Long)
/** Toggle the favourite flag on a single note. */
suspend fun setFavorite(id: Long, isFavorite: Boolean)
@@ -44,6 +53,9 @@ interface NoteRepository {
/** Only notes that have zero hashtags, sorted by updatedAt DESC. */
fun observeUntagged(): Flow<List<Note>>
/** Only notes in Trash, sorted by updatedAt DESC. */
fun observeTrashed(): Flow<List<Note>>
/**
* Context-aware search across **favourites only** — matches
* [Note.content] (contains, case-insensitive) AND any of the note's
@@ -60,6 +72,9 @@ interface NoteRepository {
*/
fun searchUntagged(query: String): Flow<List<Note>>
/** Search only trashed notes by content or hashtag. */
fun searchTrashed(query: String): Flow<List<Note>>
/** Only notes tagged with [name] (normalised form), sorted by updatedAt DESC. */
fun observeNotesForHashtag(name: String): Flow<List<Note>>
+1 -1
View File
@@ -1,5 +1,5 @@
# Gradle / Kotlin settings
org.gradle.jvmargs=-Xmx1536m -Dfile.encoding=UTF-8 -XX:+UseParallelGC
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 -XX:+UseParallelGC
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=false