33 Commits
Author SHA1 Message Date
Incido Developer a5b5d334c1 ci: move runner toolchain cache from /tmp to /var/lib/gitea-runner/work
dev / Build debug APK (push) Successful in 2m18s
release / Build & attach release APK (push) Canceled after 7m28s
/tmp is wiped on every reboot, forcing re-download of the JDK and
Android SDK (~700 MB) and, worse, re-minting the release signing
keystore. Persist the cache under /var/lib/gitea-runner/work so it
survives reboots. Genuine per-run scratch files stay in /tmp.
2026-09-17 16:40:31 +12:00
Incido Developer 32166a3100 feat(lists): task and shopping-list note types with running total
dev / Build debug APK (push) Canceled after 15m52s
NoteType (TEXT / TASK_LIST / SHOPPING_LIST) persists in an additive
NoteEntity.typeKey column (ObjectBox auto-migrates; old rows = TEXT).
List bodies stay GitHub-flavoured '- [ ]' lines so search, field
encryption, backups (defaulted noteType) and Trash keep working.

Editor: checklist + basket buttons convert any note; rows are uniform
underlined line fields (13sp) - product, 'Quan.' quantity (defaults to
1 on blur), and POS-style price showing raw cents while focused and
$1.23 on focus loss. Sticky total bar sums qty x price of checked
rows in integer cents via an explicit {q.. p..} end-of-line marker so
product text is never scanned for numbers.

Fixes found in device testing: cards rendered raw markdown for list
notes stranded as TEXT by partial builds - read-time Note.inferListType
now heals them; quantity field was clipped invisible (64dp vs the 48dp
icon target) - replaced by the free-text line; the serializer emitted
a bare 'q' slot (broken '{q p1.23}' markers, stray ' x' folds) - now
null-when-default. Add-tag suggestions rebuilt on flatMapLatest so the
autocomplete re-queries per keystroke.

versionCode 32->33, versionName 0.3.8.0, APP_VERSION in lockstep.
2026-09-17 15:43:43 +12:00
Incido Developer 7b6187f99a ci(release): attach per-version notes from PREVIOUS_HISTORY.md to releases
Per-version user-facing changelog moved out of the README table into
PREVIOUS_HISTORY.md (newest-first sections, Development Plan §11.1).
On tag push the workflow now harvests the matching section via
scripts/ci/release-notes.py and uses it as the release description,
uploading an Incido-<version>-changes.md beside the APKs; a missing
section falls back to the plain default description. CONTRIBUTING §5
documents the new release-notes maintenance step.
2026-09-17 15:43:20 +12:00
Incido Developer 576080c8b5 ci(release): persist signing keystore in runner cache for stable signatures
dev / Build debug APK (push) Successful in 36s
release / Build & attach release APK (push) Successful in 6m50s
The build step minted a fresh keystore inside the checkout on every
run, so each CI release was signed with a different key. Upgrading
from any previous release then failed with a signature conflict
(INSTALL_FAILED_UPDATE_INCOMPATIBLE) — and with allowBackup=false,
the only workaround was uninstalling, which destroys the user's
notes.

The keystore is now minted once in /tmp/gitea-runner-work (the same
persistent cache that already holds the JDK and Android SDK) and
copied into the checkout before building. Every release from now on
shares one signing key, so in-place upgrades work. Only a runner-host
rebuild would mint a new key (breaking exactly one upgrade).

Note: v0.3.7.0 was signed with an ephemeral key that no longer
exists, so the v0.3.7.0 -> v0.3.7.1 upgrade still requires a one-time
uninstall (export a backup first).
2026-08-30 11:02:50 +12:00
Incido Developer 4a28f4f52b ci(release): tolerate Cloudflare 524 timeouts on APK uploads
dev / Build debug APK (push) Successful in 36s
The v0.3.7.1 release run failed in the attach step: the 28.7 MB debug
APK upload took ~126s through the Cloudflare proxy, which returned
"error code: 524" (origin timeout, ~100s limit). The step then crashed
parsing the non-JSON error page as JSON, and the release APK was never
attempted — leaving release 36 with zero assets.

upload_asset() now:
- retries with --retry-all-errors so HTTP error responses (524) are
  retried, not just connection failures;
- verifies success server-side by listing the release assets after
  each attempt (a 524 often means the origin saved the file before
  Cloudflare gave up, so the response body is not trusted);
- only fails after 5 attempts with the asset still missing.
2026-08-30 10:41:04 +12:00
Incido Developer 37e9c14d1e release: v0.3.7.1 — UI polish, image-viewer fix, new flat icon
dev / Build debug APK (push) Successful in 1m52s
release / Build & attach release APK (push) Failing after 6m30s
Maintenance release.

UI polish:
- Editor top bar decluttered: camera / attach-file / add-tag moved out of
  the title bar into a Keep-style bottom action row, so the title and
  remaining buttons (favourite, save, overflow) always fit, even on
  narrow screens. Title is now "New note" / "Edit note" with ellipsis.
- Search auto-focuses when opened and shows a clear button while typing.
- Long tag lists in the navigation drawer now scroll within the sheet
  instead of overflowing the bottom (weight(1f) on the scroll column).
- Add-tag sheet opens with the keyboard already up.

Bug fix:
- Image viewer no longer flashes a false "couldn't decode" error on
  every persisted image open (the old LaunchedEffect checked the bitmap
  before the async load finished); genuine failures now show
  "Couldn't load image" in place of "Loading…".

New flat app icon:
- incido_flat_icon.png replaces the v0.3.3.8 artwork: adaptive
  foregrounds (108-432px) + legacy mipmaps (48-192px) regenerated;
  ic_launcher_background re-tinted #010435 -> #352999 to match.

Hygiene:
- Unused persistedBytes param dropped from AttachmentStrip; redundant
  repoForViewer alias and dead _ignored val removed; fully-qualified
  Spacer/Image/Column/Dispatchers references replaced with imports.

versionCode 31->32, versionName "0.3.7.0"->"0.3.7.1",
SettingsViewModel.APP_VERSION bumped in lockstep.
2026-08-30 10:19:49 +12:00
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
46 changed files with 2062 additions and 508 deletions

No files matched your search

+4 -4
View File
@@ -19,7 +19,7 @@ jobs:
- name: Set up JDK 17 - name: Set up JDK 17
run: | run: |
WORKDIR=/tmp/gitea-runner-work WORKDIR=/var/lib/gitea-runner/work
if [ ! -d "$WORKDIR/jdk" ]; then if [ ! -d "$WORKDIR/jdk" ]; then
wget -q 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz' -O /tmp/jdk.tar.gz wget -q 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz' -O /tmp/jdk.tar.gz
mkdir -p "$WORKDIR/jdk" mkdir -p "$WORKDIR/jdk"
@@ -31,7 +31,7 @@ jobs:
- name: Set up Android SDK - name: Set up Android SDK
run: | run: |
WORKDIR=/tmp/gitea-runner-work WORKDIR=/var/lib/gitea-runner/work
SDK=$WORKDIR/android-sdk SDK=$WORKDIR/android-sdk
if [ ! -d "$SDK/cmdline-tools/latest" ]; then if [ ! -d "$SDK/cmdline-tools/latest" ]; then
mkdir -p "$SDK" mkdir -p "$SDK"
@@ -55,7 +55,7 @@ jobs:
run: | run: |
cd repo cd repo
chmod +x gradlew chmod +x gradlew
export JAVA_HOME=/tmp/gitea-runner-work/jdk export JAVA_HOME=/var/lib/gitea-runner/work/jdk
export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk export ANDROID_HOME=/var/lib/gitea-runner/work/android-sdk
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH
./gradlew assembleDebug --no-daemon ./gradlew assembleDebug --no-daemon
+157 -60
View File
@@ -13,12 +13,14 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
run: | 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 cd repo
git fetch --tags origin
git checkout ${{ github.ref_name }}
- name: Set up JDK 17 - name: Set up JDK 17
run: | run: |
WORKDIR=/tmp/gitea-runner-work WORKDIR=/var/lib/gitea-runner/work
if [ ! -d "$WORKDIR/jdk" ]; then if [ ! -d "$WORKDIR/jdk" ]; then
wget -q 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz' -O /tmp/jdk.tar.gz wget -q 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz' -O /tmp/jdk.tar.gz
mkdir -p "$WORKDIR/jdk" mkdir -p "$WORKDIR/jdk"
@@ -30,7 +32,7 @@ jobs:
- name: Set up Android SDK - name: Set up Android SDK
run: | run: |
WORKDIR=/tmp/gitea-runner-work WORKDIR=/var/lib/gitea-runner/work
SDK=$WORKDIR/android-sdk SDK=$WORKDIR/android-sdk
if [ ! -d "$SDK/cmdline-tools/latest" ]; then if [ ! -d "$SDK/cmdline-tools/latest" ]; then
mkdir -p "$SDK" mkdir -p "$SDK"
@@ -39,6 +41,8 @@ jobs:
mkdir -p "$SDK/cmdline-tools" mkdir -p "$SDK/cmdline-tools"
mv /tmp/cmdline-tools-extract/cmdline-tools "$SDK/cmdline-tools/latest" mv /tmp/cmdline-tools-extract/cmdline-tools "$SDK/cmdline-tools/latest"
rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools-extract 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 yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null 2>&1 || true
"$SDK/cmdline-tools/latest/bin/sdkmanager" --install \ "$SDK/cmdline-tools/latest/bin/sdkmanager" --install \
"platform-tools" \ "platform-tools" \
@@ -49,75 +53,168 @@ jobs:
echo "ANDROID_SDK_ROOT=$SDK" >> $GITHUB_ENV echo "ANDROID_SDK_ROOT=$SDK" >> $GITHUB_ENV
echo "PATH=$SDK/cmdline-tools/latest/bin:$SDK/platform-tools:$PATH" >> $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 - name: Build debug + release APKs
env: timeout-minutes: 25
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: | run: |
set -e
cd repo cd repo
chmod +x gradlew git checkout ${{ github.ref_name }}
export JAVA_HOME=/tmp/gitea-runner-work/jdk # Persistent signing keystore: minted ONCE in the runner's
export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk # cache dir (which survives across runs, same place the JDK
# and SDK live) and copied into the checkout. Every release
# is therefore signed with the SAME key, so users can
# upgrade in place instead of hitting a signature conflict
# (and, with allowBackup=false, losing their notes).
# A runner-host rebuild would mint a fresh key — the only
# scenario that breaks one upgrade.
mkdir -p keystore
if [ ! -f /var/lib/gitea-runner/work/release.jks ]; then
echo "Minting new persistent CI keystore"
keytool -genkey -noprompt -v \
-keystore /var/lib/gitea-runner/work/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"
else
echo "Reusing persistent CI keystore from runner cache"
fi
cp /var/lib/gitea-runner/work/release.jks keystore/release.jks
export JAVA_HOME=/var/lib/gitea-runner/work/jdk
export ANDROID_HOME=/var/lib/gitea-runner/work/android-sdk
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH
chmod +x ./gradlew
# Build both variants; copyReleaseApks finalizes assembleRelease and ./gradlew --stop 2>/dev/null || true
# drops version-stamped APKs at the repo root: ./gradlew assembleDebug assembleRelease --no-daemon --stacktrace 2>&1 | tee /tmp/build.log
# Incido-<version>-debug.apk BUILD_STATUS=${PIPESTATUS[0]}
# Incido-<version>-release.apk echo "Gradle exit status: $BUILD_STATUS"
./gradlew assembleDebug assembleRelease --no-daemon if [ $BUILD_STATUS -ne 0 ]; then
echo "Build failed"
# Verify both files exist before proceeding tail -100 /tmp/build.log
TAG="${GITHUB_REF##*/}" exit 1
fi
ls -la app/build/outputs/apk/debug/ app/build/outputs/apk/release/
- name: Create release + attach both APKs - name: Create release + attach both APKs
env: env:
GITHUB_TOKEN: ${{ secrets.TOKEN }} GH_TOKEN: ${{ secrets.TOKEN }}
run: | run: |
set -e
cd repo cd repo
TAG="${GITHUB_REF##*/}" TAG="${{ github.ref_name }}"
VERSION="${TAG#v}" 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" echo "Tag: $TAG Version: $VERSION"
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"
if [ -z "$RELEASE_ID" ]; then # User-facing release notes: harvest this version's section from
echo "ERROR: Failed to create release" # PREVIOUS_HISTORY.md (maintained per Development Plan §11.1).
exit 1 # Used as the release description and uploaded beside the APKs.
NOTES_FILE="/tmp/Incido-$VERSION-changes.md"
if python3 scripts/ci/release-notes.py "$VERSION" --out "$NOTES_FILE"; then
HAS_NOTES=1
echo "--- Release notes preview (v$VERSION) ---"
head -12 "$NOTES_FILE"
echo "---"
else
HAS_NOTES=0
echo "No PREVIOUS_HISTORY.md section for v$VERSION - falling back to the default description."
fi fi
for APK in "Incido-${VERSION}-debug.apk" "Incido-${VERSION}-release.apk"; do echo "--- Check for existing release ---"
echo "Attaching $APK to release $RELEASE_ID" RELEASE_ID=$(curl -s "$API/releases/tags/$TAG" \
RESPONSE=$(curl -s -X POST \ -H "Authorization: token $GH_TOKEN" \
"https://git.trevena.info/api/v1/repos/nick/incido/releases/$RELEASE_ID/assets?name=$APK" \ | python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \ if [ -z "$RELEASE_ID" ]; then
--data-binary "@$APK") echo "--- Create release ---"
echo "Attach response: $RESPONSE" REL_TAG="$TAG" REL_NOTES_FILE="$NOTES_FILE" python3 -c "import json,os; nf=os.environ.get('REL_NOTES_FILE',''); body=(open(nf,encoding='utf-8').read() if nf and os.path.exists(nf) else 'Release '+os.environ['REL_TAG']); print(json.dumps({'tag_name':os.environ['REL_TAG'],'name':os.environ['REL_TAG'],'body':body,'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 ---"
# Refresh the description even on a rerun, so backfills and
# retried asset uploads always match PREVIOUS_HISTORY.md.
if [ "$HAS_NOTES" = "1" ]; then
echo "--- Patching release description from PREVIOUS_HISTORY.md ---"
REL_NOTES_FILE="$NOTES_FILE" python3 -c "import json,os; print(json.dumps({'body': open(os.environ['REL_NOTES_FILE'],encoding='utf-8').read()}))" \
> /tmp/body_patch.json
curl -s -X PATCH "$API/releases/$RELEASE_ID" \
-H "Authorization: token $GH_TOKEN" \
-H "Content-Type: application/json" \
-d @/tmp/body_patch.json > /dev/null
fi
fi
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
# Upload one asset with retries, then verify server-side.
# Cloudflare sits in front of the origin and returns
# "error code: 524" (origin timeout, ~100s) on large/slow
# uploads — the file frequently lands on the origin anyway,
# so success is decided by listing the release's assets
# rather than trusting the upload response body (which may
# be a non-JSON Cloudflare error page).
upload_asset() {
local apk_name="$1" apk_path="$2"
local attempt
for attempt in 1 2 3 4 5; do
echo "--- Uploading $apk_name (attempt $attempt/5) ---"
ls -la "$apk_path"
UPLOAD=$(curl -s -f -X POST "$API/releases/$RELEASE_ID/assets?name=$apk_name" \
-H "Authorization: token $GH_TOKEN" \
-F "attachment=@$apk_path" \
--max-time 600 --retry 2 --retry-all-errors --retry-delay 15 || true)
echo "Upload response: ${UPLOAD:0:200}"
if curl -s "$API/releases/$RELEASE_ID" \
-H "Authorization: token $GH_TOKEN" \
| python3 -c "import sys,json; d=json.load(sys.stdin); sys.exit(0 if any(a['name']=='$apk_name' for a in d['assets']) else 1)"; then
echo "Verified: $apk_name is attached to the release."
return 0
fi
echo "Asset not on the server yet — retrying in 15s..."
sleep 15
done
echo "ERROR: $apk_name failed to attach after 5 attempts."
return 1
}
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"
upload_asset "$APK" "$APK_PATH" || exit 1
done done
# Ship the changelog beside the binaries: people skimming the
# downloads get the notes for exactly this version as a file,
# generated from PREVIOUS_HISTORY.md at the top of this run.
if [ "$HAS_NOTES" = "1" ]; then
NOTES_ASSET="Incido-$VERSION-changes.md"
echo "--- Deleting stale asset for $NOTES_ASSET ---"
python3 /tmp/delete_asset.py "$API" "$RELEASE_ID" "$NOTES_ASSET" "$GH_TOKEN"
cp "$NOTES_FILE" "/tmp/$NOTES_ASSET"
upload_asset "$NOTES_ASSET" "/tmp/$NOTES_ASSET" || exit 1
fi
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')"
+4 -2
View File
@@ -63,8 +63,10 @@ adb install -r app/build/outputs/apk/debug/app-debug.apk
or your feature's manual verification steps. or your feature's manual verification steps.
### 5. Commit ### 5. Commit
We use [Conventional Commits](https://www.conventionalcommits.org/) so We use [Conventional Commits](https://www.conventionalcommits.org/).
the changelog can be generated automatically later: Per-version user-facing notes live in `PREVIOUS_HISTORY.md`
(Development Plan §11.1) — the release CI attaches the matching section
to each Gitea release automatically:
| Type | Use for | | Type | Use for |
|------|---------| |------|---------|
+28 -10
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. | | 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. | | 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. | | 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. | | 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. | | 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. | | 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) - Displays the note content (first ~3 lines, truncated)
- Shows relative timestamp ("2 min ago", "Yesterday", etc.) - Shows relative timestamp ("2 min ago", "Yesterday", etc.)
- Whole card is tappable → opens editor for that note - 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 ### 5.2 Screen 2 — Note Editor
- **Top bar:** Back arrow + Save action - **Top bar:** Back arrow + Save action
@@ -176,7 +176,7 @@ All features listed in §6.
- **Behavior:** - **Behavior:**
- Back arrow without save = discard (no confirmation in v0.1; v0.2 should confirm if content changed) - 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 - 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 ### 5.3 Theming
- **Material 3** (Material You) design system - **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 - Color-coded notes and labels
- Pinning notes to top - Pinning notes to top
- Archive (vs. delete) with archive view - Archive (vs. delete) with archive view
- Trash with soft-delete and recovery window
- Full-text search across note content - Full-text search across note content
- Tag / hashtag system - Tag / hashtag system
- Search by tag or content - 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 - Image attachments from camera and gallery
- Audio attachments / voice notes - 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 ### 6.2 On-Device Machine Learning
- **OCR (Optical Character Recognition):** - **OCR (Optical Character Recognition):**
- Extract text from images attached to notes - 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 [ ] Tap "Test note 2" card — editor opens with existing content
[ ] Change to "Test note 2 (edited)" — tap save [ ] Change to "Test note 2 (edited)" — tap save
[ ] Confirm updated text appears on the card on the list [ ] Confirm updated text appears on the card on the list
[ ] Long-press "Test note 3" — delete option appears [ ] Long-press "Test note 3" — move-to-Trash option appears
[ ] Confirm delete — note removed from the list [ ] 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 [ ] Force-stop app from system settings
[ ] Reopen app — "Test note 1" and "Test note 2 (edited)" both visible on the list [ ] Reopen app — "Test note 1" and "Test note 2 (edited)" both visible on the list
[ ] Pass — v0.1 verified [ ] Pass — v0.1 verified
@@ -365,11 +370,17 @@ A short reference for AI assistants:
| Version | Date | Notes | | Version | Date | Notes |
|---------|------|-------| |---------|------|-------|
| 0.3.8.0 | 2026-09-16 | **Feature release — task lists, shopping lists, hashtag-autocomplete fix** (closes §6.1 "Checklists / to-do items within notes" + "Grocery list with running price total"). **1. Note types.** New `NoteType` enum in `:core/domain` (TEXT / TASK_LIST / SHOPPING_LIST) carried by `Note.type` and an additive `NoteEntity.typeKey` Short column (ObjectBox auto-migrates; old rows = TEXT). List bodies persist as GitHub-flavoured `- [ ] item` lines (`Note.splitListContent` / `serializeListContent`), so content stays the single source of truth: full-text search, AES-GCM field encryption, share-into, the v0.2 inline checklist card summaries, and Trash all keep working untouched. **2. Task-list editor.** Checklist button next to the # tag button in the editor's bottom action row converts the note into editable rows (Checkbox + item text + remove, "+ Add item", first non-checkbox line kept as the title field); tapping the active button reverts to plain text. Active mode tints primary. Cards already showed "- [ ]" open/done counts; shopping cards now show a basket icon instead of the checkbox glyph. **3. Shopping list + running total.** Same mechanism with two structured fields per row: a read-only **quantity picker (1–9)** (`ExposedDropdownMenuBox` — no keyboard ever opens) and a **POS-style price field** (`KeyboardType.Number`; every digit typed is a cent — the field stores the RAW digits verbatim (e.g. `199` = $1.99) so mid-field cursor placement behaves like a normal text field and can never scramble the amount, with a non-editable `$` prefix; the total bar renders dollars). A sticky `ShoppingTotalBar` stays pinned above the rows — always visible, updated live — summing `qty × price` of CHECKED (= in-basket) items in **integer cents** (no binary-float drift). Storage puts both values in an explicit end-of-line marker `- [x] Eggs {q12 p2.40}`, so the PRODUCT TEXT IS NEVER SCANNED FOR NUMBERS ("Battery AA 3", "Poster 50 x 60" stay pure product names); hand-typed §6.1 shapes (`Milk 3.50`, `Eggs 12 x 2.40`) still import once into the structured fields on conversion (decimals required on the legacy forms to avoid exactly that ambiguity). Converting to a task list folds values back into plain text tokens (`Eggs 12 x 2.40`) so nothing is lost across mode switches. **4. Add-tag suggestions repaired.** The autocomplete collector in `NoteEditorViewModel.init` was `tagInputFlow.collect { pool.collect { … } }` over infinite ObjectBox callbackFlows — the outer lambda suspended in the inner collect forever, keystrokes never re-queried, and `openAddTagSheet()` zeroed the list, so the sheet only ever offered "+ Create". Rebuilt on `flatMapLatest` over `tagInputFlow` (sheet opens showing every existing tag most-used-first, filters live per keystroke). **5. Backups** round-trip the new type via defaulted `BackupNote.noteType` ("TEXT") — pre-v0.3.8.0 files import unchanged, `ignoreUnknownKeys` covers older readers; encrypted backups reuse the same shape. ViewModel: `isDirty` gains the type axis; list edits keep `content` synchronised with the row serialisation so save/preview/canSave gates need no changes. versionCode 32→33, versionName "0.3.7.1"→"0.3.8.0", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 0.3.7.1 | 2026-08-30 | **Maintenance release — UI polish + one bug fix.** **1. Editor top bar decluttered.** The Add/Edit `TopAppBar` carried six right-side actions (camera, attach, tag, favourite, save, overflow), which crowded the title on narrow screens. Camera / Attach file / Add tag move to a Keep-style bottom action row (hairline `HorizontalDivider` above it; rides above the nav bar / keyboard via the existing IME insets). The top bar is now back + "New note" / "Edit note" title (`maxLines = 1`, ellipsis) + favourite + save + overflow (Move to Trash when editing) — always fits, and matches the §5.2 spec. **2. Image-viewer false failure fixed.** `ImageViewerScreen` checked `bitmap == null` in a `LaunchedEffect` before the async load finished, so a "Couldn't decode image attachment" toast fired on every persisted image open. Replaced with a `loadFailed` state set only after the byte load / decode genuinely fails; the placeholder switches from "Loading…" to "Couldn't load image" (toast removed). **3. Search QoL.** The list search field auto-focuses on open (`FocusRequester` + `LaunchedEffect(state.isSearchActive)`) and gains a trailing clear (✕) button while the query is non-empty. **4. Drawer tag-list overflow fixed.** The scrollable "Recent tags" column in `IncidoDrawer` had no height cap, so long tag lists could overflow the sheet bottom; it now takes `weight(1f)` and scrolls within the remaining height. Dead `_ignored` workaround val removed. **5. Add-tag sheet autofocus.** The sheet's input field is focused on open so the keyboard is already up. Also small hygiene: unused `persistedBytes` param dropped from `AttachmentStrip`; fully-qualified `Spacer` / `Image` / `Column` / `Dispatchers` references replaced with imports. **6. New flat app icon.** `incido_flat_icon.png` (1024×1024, squircle + shield + pen nib, transparent corners) replaces the v0.3.3.8 artwork: LANCZOS-downscaled into `drawable-{mdpi…xxxhdpi}/ic_launcher_foreground.png` (108/162/216/324/432 px, full 108dp canvas — the artwork's fill colour matches the background layer so the squircle edges blend seamlessly) and legacy `mipmap-{mdpi…xxxhdpi}/ic_launcher{,_round}.png` (48/72/96/144/192 px); `ic_launcher_background` re-tinted `#010435` → `#352999`. versionCode 31→32, versionName "0.3.7.0"→"0.3.7.1", SettingsViewModel.APP_VERSION bumped in lockstep. |
| 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.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.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.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.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.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.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. | | 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. |
@@ -420,9 +431,16 @@ A small Gradle task called `copyReleaseApks` (registered in
Settings displays the new version and the in-app release-notes Settings displays the new version and the in-app release-notes
dialog recognises it. dialog recognises it.
3. **`README.md`** — bump the intro paragraph and "Current release" 3. **`README.md`** — bump the intro paragraph and "Current release"
line, and add a new row at the top of the Changelog table (the table line. **`PREVIOUS_HISTORY.md`** — append a new
is the user-facing changelog — §10 keeps the historical release `## v<NEW_VERSION> — <DATE>` section at the top: friendly user-facing
notes). bullets, newest first (this file replaced the old README Changelog
table). On tag push the release workflow runs
`scripts/ci/release-notes.py` and attaches that section to the Gitea
release as its description **and** as an `Incido-<version>-changes.md`
asset beside the APKs — so keep one section per released version and
never reorder or delete old ones (§10 stays the developer-facing
history). For pre-existing releases created before this pipeline,
`scripts/ci/backfill-release-notes.sh` patches them retroactively.
### 11.2 Build both APKs (and stamp them) ### 11.2 Build both APKs (and stamp them)
+174
View File
@@ -0,0 +1,174 @@
# Incido — Previous Release History
Reference archive of Incido's user-facing release history (formerly the
README changelog table).
Current downloads ship **with their own notes**: every release on the
[Releases page](https://git.trevena.info/nick/incido/releases) carries its
version's changelog — rendered in the release description and also
attached beside the APKs as `Incido-<version>-changes.md`. The CI generates
both from the matching section below via `scripts/ci/release-notes.py`
at tag-build time.
**Adding a release:** append a `## v<VERSION> — <DATE>` section at the
top of this file (see Development Plan §11.1). Newest first; never delete
or reorder older sections — the CI must find a section for whatever tag it
builds, and hotfix retags can target any version. If a tag has no section,
the release falls back to a plain "Release <tag>" description.
---
## v0.3.8.0 — 2026-09-16
- **Task lists + shopping lists (Development Plan §6.1).** New checklist button in the editor's bottom action row (next to the `#` tag button) converts any note into an editable task list — real checkboxes, add / remove item rows; tap the button again to return to plain text (`NoteType`, additive `typeKey` column, auto-migrated). New shopping-basket button works the same way but gives every row a tap-to-pick **quantity (1–9) dropdown** and a supermarket-style price field where the number pad types cents — enter `199` and it counts as **$1.99** in the maths (the price box keeps exactly the digits you typed, so cursor placement can never scramble them, while the total bar speaks real dollars). An always-visible running total sits above the list, adding quantity × price for everything checked (= in the basket). The three values are strictly separate fields saved with an explicit end-of-line marker (`- [x] Eggs {q12 p2.40}`), so numbers inside a product name (like "Battery AA 3") can never leak into the money maths; hand-typed classic lines (`Milk 3.50`, `Eggs 12 x 2.40`) are still recognised when converting older notes. Lists persist as GitHub-flavoured `- [ ]` lines, so search, encryption, backups (new defaulted `noteType` field — old files still import), and card "N open · M done" summaries keep working; shopping cards show a basket icon.
- **Add-tag sheet suggestions fixed** — the nested-collect autocomplete pipeline never resumed past the first keystroke, so only "+ Create…" ever showed; rebuilt on `flatMapLatest`, existing tags now list immediately when the sheet opens and filter live per keystroke.
## v0.3.7.1 — 2026-08-30
- **UI polish.** Add/Edit screen tidied up: camera, attach-file, and add-tag moved out of the top bar into a bottom action row, so the title and remaining buttons always fit. Fixed a false "couldn't load image" error that flashed whenever you opened a saved image. Search auto-focuses on open and shows a clear (✕) button. Long tag lists in the drawer now scroll instead of being cut off. The add-tag sheet opens with the keyboard ready. New flat app icon (same shield + pen-nib motif, cleaner squircle design).
## v0.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.
## v0.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`.
## v0.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.
## v0.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.
## v0.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.
## v0.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.
## v0.3.5.0 — 2026-08-17
- **Real at-rest encryption.** Note text and attachment bytes are now AES-256-GCM encrypted in place the moment you toggle "Encrypt notes at rest" — no restart required; keyed by the Keystore-wrapped 32-byte key.
- **Verified "Encrypted" badge.** Every encrypted note is trial-decrypted on app open and after each migration; only verified notes get the lock badge.
- **Block screenshots (default ON).** New toggle in Settings → Security prevents screenshots, screen recording, and app-switcher previews while Incido is open.
## v0.3.4.0 — 2026-08-17
- **Attachment indicator on note cards.** — a paperclip icon now appears on the right edge of every card that carries an attachment.
- **Light-theme readability over image thumbnails.** — cards with a dark photo background now force light text/icon colours over the image so notes stay readable in Light mode.
- **Auto-Lock "Immediately" no longer locks during file pickers.** — attaching a file, taking a photo, viewing an attachment, or exporting/importing a backup no longer destroys your in-progress note.
## v0.3.3.8 — 2026-08-17
- **Designed Incido artwork is now the app icon.** The glass shield + fountain-pen nib replaces the placeholder glyph on the home screen, app drawer, and adaptive-icon layers.
## v0.3.3.7 — 2026-08-17
- **Biometric auto-launch.** When Biometric is your active lock method, the fingerprint / face reader now opens automatically when the lock screen appears — no extra tap on "Authenticate" needed.
## v0.3.3.6 — 2026-08-17
- **Card height tuned for real devices.** The fixed card height from v0.3.3.5 proved too tall on real devices; reduced by ~15% (now 143.dp).
## v0.3.3.5 — 2026-08-17
- **Fixed card height.** All note cards now have a single fixed height (168.dp), so untagged notes no longer look shorter than tagged ones; timestamp pinned to the bottom via a weighted spacer; hashtag row still hidden when empty; left colour stripe spans the full card height.
## v0.3.3.4 — 2026-08-17
- **Favourite star no longer overlaps the overflow button.** Star is now anchored to the card's bottom-right corner (same column as the top-right ⋮), so the two controls no longer collide.
## v0.3.3.3 — 2026-08-17
- **Importing an encrypted backup no longer crashes.** The passphrase was being wiped between the preview step and the confirm dialog's Import button; now retained across the confirmation step, with proper try/catch around preview/import so failures surface a snackbar ("Import failed. Check the file and passphrase." / "Could not read backup file.") instead of crashing.
## v0.3.3.2 — 2026-08-17
- **White-on-white lock screen in dark mode fixed.** `PinEntryScreen` is now wrapped in a themed Surface so it always paints its own theme-aware background.
- **Biometric unlock hang fixed.** Authentication is now fully asynchronous (BiometricPrompt callbacks run on the main executor) instead of busy-waiting on the main thread. Device-credential fallback preserved.
## v0.3.3.1 — 2026-08-17
- **"Encrypt notes at rest" toggle now correctly greyed out.** Until Security is on and you've chosen either PIN or Biometric — with a subtitle explaining the requirement.
- **"Enable Security" no longer requires a PIN first.** The master switch just flips on; PIN / Biometric / Encrypt sub-toggles were already gated.
- **Importing an encrypted backup now opens a dedicated passphrase dialog.** (single field, no policy check) — wrong passphrase surfaces "Incorrect passphrase." via snackbar.
## v0.3.3.0 — 2026-08-17
- **Lock mode as a single choice.** Security now exposes two mutually-exclusive toggles (PIN and Biometric) — either alone is enough to lock; Biometric no longer requires PIN first. New "Reset PIN" row appears when PIN is active; lock screen shows only the biometric button when no Incido PIN is set.
- **Encrypted-import passphrase prompt.** Selecting an encrypted backup opens the passphrase dialog first and surfaces "Incorrect passphrase." on mismatch.
- **Press-and-hold note card menu.** The inline delete button is gone; long-press a card (or tap the ⋮ button) to open a DropdownMenu with Delete — ready for future actions like Share.
## v0.3.2.0 — 2026-08-15
- **New Settings screen.** (Untagged → Settings in the nav drawer) with Appearance, Security, Backup & Restore, and About sections.
- **At-rest encryption.** ObjectBox store is opened with a 32-byte AES-256 key wrapped by the Android Keystore; toggling the switch generates / deletes the key and surfaces a "Re-encrypting notes…" dialog.
- **PIN lock + biometric.** 4–6 digit PIN (PBKDF2-hashed, 100k iters, constant-time compare) with optional fingerprint / face unlock; cold launch + auto-lock timeout gate.
- **Backup / Import / Export.** JSON codec with Base64 attachment bytes; encrypted variant uses AES-256-GCM + PBKDF2(passphrase, 200k iters) with a Generate button + Copy to clipboard. Passphrase policy: 12–32 chars, ≥1 digit, ≥1 special.
- **Release notes dialog.** — tap the version number on the About card. Adds `USE_BIOMETRIC` + `USE_FINGERPRINT` permissions (still no INTERNET).
## v0.3.1.2 — 2026-08-15
- **Three v0.3.1.1 issues fixed.** **card thumbnails are actually visible now** — the v0.3.1.1 layout had the thumbnail Image as a sibling of the Card, so the Card's opaque `containerColor` was drawn on top and the image was completely hidden; the architecture is restructured so the Image + dark scrim live INSIDE the Card, and `containerColor = Color.Transparent` when a thumbnail is present (plain notes still get the existing tinted/surface background).
- **Camera photos honour EXIF orientation** — `NoteRepositoryImpl.normalizeImageOrientation(bytes)` runs at storage time inside `addAttachment` (guarded `if (mimeType.startsWith("image/"))`); reads EXIF `Orientation`, rotates the bitmap, re-encodes as JPEG quality 92, and stores the corrected bytes so every render path (editor thumbnail, card thumbnail, full-screen viewer) sees the photo the right way up.
- **Non-image attachments open in the system viewer** — `AttachmentThumbnail.onClick` now branches on `isImage`: image taps still go to the in-app full-screen viewer; non-image taps write the bytes to a `cacheDir` temp file, get a `FileProvider` URI, and launch `Intent.ACTION_VIEW` with `FLAG_GRANT_READ_URI_PERMISSION` (the previous unconditional viewer path silently failed for PDFs/MP3s/etc. with a stuck "Loading…"). `file_paths.xml` already exposes `cacheDir` via `<cache-path>`, so no manifest change was needed. Attaching arbitrary file types from the paperclip icon was already shipped in v0.3.1.1 (the `*/*` intent filters) — no code change here, just called out so it's clear what was already in place.
## v0.3.1.1 — 2026-08-15
- **Five v0.3.1.0 issues fixed.** Persisted image attachments now render a thumbnail in the editor strip (previously fell through to the file-type placeholder because bytes weren't loaded) — `AttachmentThumbnail` lazy-loads bytes from the DB via `produceState` + `repository.getAttachmentBytes()`. Card thumbnails are more visible — alpha bumped 0.45 → 0.70 and the dark scrim dropped 0.18 → 0.08; also `clipToBounds()` so the image can't bleed past the card's rounded corners. Share-into from webpages now opens a fresh editor — `MainActivity.handleShareIntent()` stashes the share text synchronously before launching the async image-byte I/O, so the Compose tree's `LaunchedEffect(Unit)` always finds a payload on first composition. Share menu now offers Incido for any file type (PDF, MP3, video, archives) — added `<data android:mimeType="*/*" />` to both `ACTION_SEND` and `ACTION_SEND_MULTIPLE` intent filters. Editor top-bar title shortened to "Edit" / "New" so it fits on one line with the new icon row.
## v0.3.1.0 — 2026-08-15
- **Context-aware search.** — on the Favorites and Untagged pages, the search icon is now visible and a typed query intersects with the active filter (search only favourites on Favorites, only untagged notes on Untagged). On Home, search spans everything.
- **Photo / File attachments.** — the editor now has Camera (camera icon) and Attach File (paperclip icon) buttons. Photos are captured via `MediaStore.ACTION_IMAGE_CAPTURE` (with a transient `FileProvider` outbox; bytes live in the database, the temp file is deleted) and files via `ACTION_OPEN_DOCUMENT`. Attachments are stored as `ByteArray` columns inside ObjectBox — no filesystem paths to manage. Each note's attachments show up as a thumbnail strip in the editor with a ✕ in the top-right corner to remove. Tapping a thumbnail opens a full-screen viewer with pinch-to-zoom + pan (`Modifier.transformable`) and a close button.
- **Card thumbnails.** — notes with image attachments show the first image as a (alpha-blended, scrimmed) background on the list card.
- **Share-into.** — the app accepts `ACTION_SEND` (text + image) and `ACTION_SEND_MULTIPLE` (multiple images) from other apps. Inbound bytes are copied into a process-singleton `SharedIntentBuffer` and pre-filled into a new-note editor. Adds the `CAMERA` permission — still no `INTERNET`, still fully offline.
## v0.3.0.5 — 2026-08-15
- **Hashtag reconciliation is now a single transaction.** `NoteEditorViewModel.save()` still did upsert + per-tag `addHashtag` in three separate writes, so the drawer's `hashtagUsageSnapshot()` could read a transient empty `xrefBox` between the `tagBox.put` and the `xrefBox.put` and leave `emptyList()` stuck in the StateFlow (toggling the favourite star worked around it because `setFavorite` re-touches `noteBox`). New `NoteRepository.saveNoteWithHashtags()` wraps upsert + hashtag reconciliation in a single ObjectBox transaction via `boxStore.callInTx { ... }`, so the per-box observers fire **once** at commit time with the final state. New hashtags now appear in the drawer's Recent Tags list the moment a note is saved — no workaround required.
## v0.3.0.4 — 2026-08-14
- **Recent Tags now subscribes to all three boxes.** `observeHashtagsByRecentUse()` now subscribes to **all three** boxes (`noteBox`, `tagBox`, `xrefBox`) — adding a brand-new hashtag only touches `tagBox` + `xrefBox`, so the previous single-`noteBox` subscription missed those updates and the drawer's Recent Tags list only refreshed when something else touched `noteBox` (e.g. toggling the favourite star). Now the new tag is visible immediately after saving the note.
## v0.3.0.3 — 2026-08-14
- **Batched hashtag-usage lookups.** `NoteRepositoryImpl.hashtagUsageSnapshot()` (one `Box.get` per distinct noteId and tagId, not per xref) and dropped the manual `trySend(snapshot())` in `observeHashtagsByRecentUse()` — the ObjectBox observer's first fire is now the sole source. The drawer's Recent Tags list fills in well under a second instead of taking minutes.
## v0.3.0.2 — 2026-08-14
- **AddTagSheet placeholder cleaned up.** Dropped the redundant leading `#` from the AddTagSheet placeholder (was `#tag-name`, now `hashtag-name` — the leading `#` icon in the field already signals the format).
## v0.3.0.1 — 2026-08-14
- **Editor + list-card UI polish.** Editor hashtag row moved to the bottom (and hidden when empty), `+ add` chip removed (use `#` icon in top bar), colour picker centred horizontally, list-card dog-ear colour accent replaces the small circle chip, list cards show a hashtag row (with `+N` abbreviation when capped).
## v0.3.0.0 — 2026-08-14
- **Hashtags + bolder colour accent + nav drawer + new version scheme.** Hashtags (visible chips on editor, 5-tag cap, autocomplete) + bolder colour accent + nav drawer (Home / Favorites / Untagged + recent tags) + centred app-bar title + new version scheme
## v0.2.0.1 — 2026-08-14
- **Search icon now opens the search bar.** Search icon now actually opens the search bar
## v0.2.0.0 — 2026-08-14
- **Polish + favourites, search, colours, checklists, discard dialog, release signing.**
## v0.1.1.0 — 2026-08-14
- **Editor IME fix + title/body on list cards.**
## v0.1.0.0 — 2026-08-14
- **First MVP: list + editor, ObjectBox, Material 3.**
+25 -109
View File
@@ -6,16 +6,19 @@ 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 All data stays on your device by default — no accounts, no cloud, no
trackers. trackers.
This repository contains the **v0.3.6.3** release: a single-user, offline This repository contains the **v0.3.8.0** release: a single-user, offline
note app with hashtags, favourites, full-text search, colour-coded note app with hashtags, favourites, task lists, shopping lists with a
notes, photo and file attachments, share-into from other apps and the running total, colour-coded notes, photo and file attachments,
web, at-rest AES-256-GCM encryption with screenshot blocking, PIN / share-into from other apps and the
biometric lock, encrypted backup and restore, and an exportable web, Trash (soft delete with Restore / permanent delete), at-rest
encryption key for device migrations. The architecture is multi-module AES-256-GCM encryption with screenshot blocking, PIN / biometric lock,
Android today and is structured so iOS / Desktop ports can happen later encrypted backup and restore, and an exportable encryption key for
without UI rewrites. 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.8.0 — full release notes ship **on its entry on
the [Releases page](https://git.trevena.info/nick/incido/releases)**.
> **Version scheme (from v0.3.0.0 onwards):** `MAJOR.MINOR.MAINTENANCE.EMERGENCY` — > **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; > e.g. `0.3.0.0`. `MAJOR.MINOR.MAINTENANCE` are normal release numbers;
@@ -26,74 +29,6 @@ without UI rewrites.
--- ---
## Features
### v0.3.0.0 highlights
- **Hashtags.** Tag any note with up to 5 hashtags. Tags are always
visible as chips above the editor text field; tap ✕ to remove. Tap
`#` (or `+ add`) to open a sheet with autocomplete suggestions from
your existing tags. Hashtags are searchable from the list (typing
`work` finds notes containing the word *and* notes tagged `#work`).
- **Bolder colour accent on list cards.** Each colour-tagged note now
gets a 14 dp vertical gradient stripe on the left, a subtle 12 %
tinted card background, and a 10 dp solid colour chip in the
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.
- **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`.
- **New version scheme.** All version bumps from now on follow the
`MAJOR.MINOR.MAINTENANCE.EMERGENCY` pattern; the build refuses anything
that doesn't match.
### v0.2.0.0
- **Favourites.** Tap the star icon on any card to pin it to the top of
the list.
- **Full-text search.** Tap the search icon in the top app bar; the list
filters live as you type.
- **Color-coded notes.** Pick from six preset accent colours in the
editor; each list card gets a 4 dp vertical stripe.
- **Inline checklists.** Lines beginning with `- [ ]` or `- [x]` show
open/done counts on the card preview.
- **Discard-confirm dialog.** Closing the editor with unsaved changes
prompts `Discard changes?` (works for both Back arrow and hardware
back gesture).
- **Release signing** — dev keystore in `keystore/`, `assembleRelease`
produces a v2-signed APK out of the box.
### v0.2.0.1 (hotfix)
- **Search icon actually opens the search bar.** v0.2.0.0's
search-active flag was on a separate `StateFlow` the composable never
observed; folded into `uiState` so tapping the icon now lights up the
field.
### v0.1.1.0
- **Editor respects the soft keyboard.** `Scaffold` unions
`WindowInsets.systemBars` with `WindowInsets.ime` so the text field
shrinks above the keyboard. `adjustResize` set as pre-Android-15
fallback.
- **List cards now show a title + body preview.** First non-empty line
= title; remainder = body preview (max 2 lines, ellipsised).
Empty notes display as "Untitled".
### v0.1.0.0
- Create, edit, and delete plain-text notes
- ObjectBox-backed persistence ([objectbox.io](https://objectbox.io/))
- Material 3 UI with dynamic color (Android 12+), dark/light follows system
- Fully offline — no `INTERNET` permission
- Multi-module Android project (Android today, iOS/Desktop-ready later)
---
## Roadmap ## Roadmap
See [`Incido Development Plan.txt`](./Incido%20Development%20Plan.txt) at See [`Incido Development Plan.txt`](./Incido%20Development%20Plan.txt) at
@@ -104,37 +39,13 @@ cross-platform ports, end-to-end sync, and security features.
## Changelog ## Changelog
| Version | Date | Highlights | Release notes now live **on the Releases page**: every Incido release entry
|-----------|------------|------------| ships the full changelog for exactly that version — rendered in the
| 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`. | release description and attached beside the APKs as
| 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. | `Incido-<version>-changes.md` (generated from `PREVIOUS_HISTORY.md` by the
| 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. | release workflow).
| 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. | → [Releases](https://git.trevena.info/nick/incido/releases)
| 0.3.5.0 | 2026-08-17 | **Real at-rest encryption.** Note text and attachment bytes are now AES-256-GCM encrypted in place the moment you toggle "Encrypt notes at rest" — no restart required; keyed by the Keystore-wrapped 32-byte key. **Verified "Encrypted" badge.** Every encrypted note is trial-decrypted on app open and after each migration; only verified notes get the lock badge. **Block screenshots (default ON).** New toggle in Settings → Security prevents screenshots, screen recording, and app-switcher previews while Incido is open. | · [Previous release history (archive)](./PREVIOUS_HISTORY.md)
| 0.3.4.0 | 2026-08-17 | **Attachment indicator on note cards** — a paperclip icon now appears on the right edge of every card that carries an attachment. **Light-theme readability over image thumbnails** — cards with a dark photo background now force light text/icon colours over the image so notes stay readable in Light mode. **Auto-Lock "Immediately" no longer locks during file pickers** — attaching a file, taking a photo, viewing an attachment, or exporting/importing a backup no longer destroys your in-progress note. |
| 0.3.3.8 | 2026-08-17 | **Designed Incido artwork is now the app icon.** The glass shield + fountain-pen nib replaces the placeholder glyph on the home screen, app drawer, and adaptive-icon layers. |
| 0.3.3.7 | 2026-08-17 | **Biometric auto-launch.** When Biometric is your active lock method, the fingerprint / face reader now opens automatically when the lock screen appears — no extra tap on "Authenticate" needed. |
| 0.3.3.6 | 2026-08-17 | **Card height tuned for real devices.** The fixed card height from v0.3.3.5 proved too tall on real devices; reduced by ~15% (now 143.dp). |
| 0.3.3.5 | 2026-08-17 | **Fixed card height.** All note cards now have a single fixed height (168.dp), so untagged notes no longer look shorter than tagged ones; timestamp pinned to the bottom via a weighted spacer; hashtag row still hidden when empty; left colour stripe spans the full card height. |
| 0.3.3.4 | 2026-08-17 | **Favourite star no longer overlaps the overflow button.** Star is now anchored to the card's bottom-right corner (same column as the top-right ⋮), so the two controls no longer collide. |
| 0.3.3.3 | 2026-08-17 | **Importing an encrypted backup no longer crashes.** The passphrase was being wiped between the preview step and the confirm dialog's Import button; now retained across the confirmation step, with proper try/catch around preview/import so failures surface a snackbar ("Import failed. Check the file and passphrase." / "Could not read backup file.") instead of crashing. |
| 0.3.3.2 | 2026-08-17 | **White-on-white lock screen in dark mode fixed.** `PinEntryScreen` is now wrapped in a themed Surface so it always paints its own theme-aware background. **Biometric unlock hang fixed.** Authentication is now fully asynchronous (BiometricPrompt callbacks run on the main executor) instead of busy-waiting on the main thread. Device-credential fallback preserved. |
| 0.3.3.1 | 2026-08-17 | **"Encrypt notes at rest" toggle now correctly greyed out** until Security is on and you've chosen either PIN or Biometric — with a subtitle explaining the requirement. **"Enable Security" no longer requires a PIN first.** The master switch just flips on; PIN / Biometric / Encrypt sub-toggles were already gated. **Importing an encrypted backup now opens a dedicated passphrase dialog** (single field, no policy check) — wrong passphrase surfaces "Incorrect passphrase." via snackbar. |
| 0.3.3.0 | 2026-08-17 | **Lock mode as a single choice.** Security now exposes two mutually-exclusive toggles (PIN and Biometric) — either alone is enough to lock; Biometric no longer requires PIN first. New "Reset PIN" row appears when PIN is active; lock screen shows only the biometric button when no Incido PIN is set. **Encrypted-import passphrase prompt.** Selecting an encrypted backup opens the passphrase dialog first and surfaces "Incorrect passphrase." on mismatch. **Press-and-hold note card menu.** The inline delete button is gone; long-press a card (or tap the ⋮ button) to open a DropdownMenu with Delete — ready for future actions like Share. |
| 0.3.2.0 | 2026-08-15 | **New Settings screen** (Untagged → Settings in the nav drawer) with Appearance, Security, Backup & Restore, and About sections. **At-rest encryption.** ObjectBox store is opened with a 32-byte AES-256 key wrapped by the Android Keystore; toggling the switch generates / deletes the key and surfaces a "Re-encrypting notes…" dialog. **PIN lock + biometric.** 4–6 digit PIN (PBKDF2-hashed, 100k iters, constant-time compare) with optional fingerprint / face unlock; cold launch + auto-lock timeout gate. **Backup / Import / Export.** JSON codec with Base64 attachment bytes; encrypted variant uses AES-256-GCM + PBKDF2(passphrase, 200k iters) with a Generate button + Copy to clipboard. Passphrase policy: 12–32 chars, ≥1 digit, ≥1 special. **Release notes dialog** — tap the version number on the About card. Adds `USE_BIOMETRIC` + `USE_FINGERPRINT` permissions (still no INTERNET). |
| 0.3.1.2 | 2026-08-15 | Hotfix for three issues found in v0.3.1.1 testing: **card thumbnails are actually visible now** — the v0.3.1.1 layout had the thumbnail Image as a sibling of the Card, so the Card's opaque `containerColor` was drawn on top and the image was completely hidden; the architecture is restructured so the Image + dark scrim live INSIDE the Card, and `containerColor = Color.Transparent` when a thumbnail is present (plain notes still get the existing tinted/surface background). **Camera photos honour EXIF orientation** — `NoteRepositoryImpl.normalizeImageOrientation(bytes)` runs at storage time inside `addAttachment` (guarded `if (mimeType.startsWith("image/"))`); reads EXIF `Orientation`, rotates the bitmap, re-encodes as JPEG quality 92, and stores the corrected bytes so every render path (editor thumbnail, card thumbnail, full-screen viewer) sees the photo the right way up. **Non-image attachments open in the system viewer** — `AttachmentThumbnail.onClick` now branches on `isImage`: image taps still go to the in-app full-screen viewer; non-image taps write the bytes to a `cacheDir` temp file, get a `FileProvider` URI, and launch `Intent.ACTION_VIEW` with `FLAG_GRANT_READ_URI_PERMISSION` (the previous unconditional viewer path silently failed for PDFs/MP3s/etc. with a stuck "Loading…"). `file_paths.xml` already exposes `cacheDir` via `<cache-path>`, so no manifest change was needed. Attaching arbitrary file types from the paperclip icon was already shipped in v0.3.1.1 (the `*/*` intent filters) — no code change here, just called out so it's clear what was already in place. |
| 0.3.1.1 | 2026-08-15 | Hotfix for five issues found in v0.3.1.0 testing: persisted image attachments now render a thumbnail in the editor strip (previously fell through to the file-type placeholder because bytes weren't loaded) — `AttachmentThumbnail` lazy-loads bytes from the DB via `produceState` + `repository.getAttachmentBytes()`. Card thumbnails are more visible — alpha bumped 0.45 → 0.70 and the dark scrim dropped 0.18 → 0.08; also `clipToBounds()` so the image can't bleed past the card's rounded corners. Share-into from webpages now opens a fresh editor — `MainActivity.handleShareIntent()` stashes the share text synchronously before launching the async image-byte I/O, so the Compose tree's `LaunchedEffect(Unit)` always finds a payload on first composition. Share menu now offers Incido for any file type (PDF, MP3, video, archives) — added `<data android:mimeType="*/*" />` to both `ACTION_SEND` and `ACTION_SEND_MULTIPLE` intent filters. Editor top-bar title shortened to "Edit" / "New" so it fits on one line with the new icon row. |
| 0.3.1.0 | 2026-08-15 | **Context-aware search** — on the Favorites and Untagged pages, the search icon is now visible and a typed query intersects with the active filter (search only favourites on Favorites, only untagged notes on Untagged). On Home, search spans everything. **Photo / File attachments** — the editor now has Camera (camera icon) and Attach File (paperclip icon) buttons. Photos are captured via `MediaStore.ACTION_IMAGE_CAPTURE` (with a transient `FileProvider` outbox; bytes live in the database, the temp file is deleted) and files via `ACTION_OPEN_DOCUMENT`. Attachments are stored as `ByteArray` columns inside ObjectBox — no filesystem paths to manage. Each note's attachments show up as a thumbnail strip in the editor with a in the top-right corner to remove. Tapping a thumbnail opens a full-screen viewer with pinch-to-zoom + pan (`Modifier.transformable`) and a close button. **Card thumbnails** — notes with image attachments show the first image as a (alpha-blended, scrimmed) background on the list card. **Share-into** — the app accepts `ACTION_SEND` (text + image) and `ACTION_SEND_MULTIPLE` (multiple images) from other apps. Inbound bytes are copied into a process-singleton `SharedIntentBuffer` and pre-filled into a new-note editor. Adds the `CAMERA` permission — still no `INTERNET`, still fully offline. |
| 0.3.0.5 | 2026-08-15 | Hotfix: `NoteEditorViewModel.save()` still did upsert + per-tag `addHashtag` in three separate writes, so the drawer's `hashtagUsageSnapshot()` could read a transient empty `xrefBox` between the `tagBox.put` and the `xrefBox.put` and leave `emptyList()` stuck in the StateFlow (toggling the favourite star worked around it because `setFavorite` re-touches `noteBox`). New `NoteRepository.saveNoteWithHashtags()` wraps upsert + hashtag reconciliation in a single ObjectBox transaction via `boxStore.callInTx { ... }`, so the per-box observers fire **once** at commit time with the final state. New hashtags now appear in the drawer's Recent Tags list the moment a note is saved — no workaround required. |
| 0.3.0.4 | 2026-08-14 | Hotfix: `observeHashtagsByRecentUse()` now subscribes to **all three** boxes (`noteBox`, `tagBox`, `xrefBox`) — adding a brand-new hashtag only touches `tagBox` + `xrefBox`, so the previous single-`noteBox` subscription missed those updates and the drawer's Recent Tags list only refreshed when something else touched `noteBox` (e.g. toggling the favourite star). Now the new tag is visible immediately after saving the note. |
| 0.3.0.3 | 2026-08-14 | Hotfix: batched hashtag-usage lookups in `NoteRepositoryImpl.hashtagUsageSnapshot()` (one `Box.get` per distinct noteId and tagId, not per xref) and dropped the manual `trySend(snapshot())` in `observeHashtagsByRecentUse()` — the ObjectBox observer's first fire is now the sole source. The drawer's Recent Tags list fills in well under a second instead of taking minutes. |
| 0.3.0.2 | 2026-08-14 | Hotfix: dropped the redundant leading `#` from the AddTagSheet placeholder (was `#tag-name`, now `hashtag-name` — the leading `#` icon in the field already signals the format). |
| 0.3.0.1 | 2026-08-14 | Urgent UI polish: editor hashtag row moved to the bottom (and hidden when empty), `+ add` chip removed (use `#` icon in top bar), colour picker centred horizontally, list-card dog-ear colour accent replaces the small circle chip, list cards show a hashtag row (with `+N` abbreviation when capped). |
| 0.3.0.0 | 2026-08-14 | Hashtags (visible chips on editor, 5-tag cap, autocomplete) + bolder colour accent + nav drawer (Home / Favorites / Untagged + recent tags) + centred app-bar title + new version scheme |
| 0.2.0.1 | 2026-08-14 | Hotfix: search icon now actually opens the search bar |
| 0.2.0.0 | 2026-08-14 | Polish + favourites, search, colours, checklists, discard dialog, release signing |
| 0.1.1.0 | 2026-08-14 | Editor IME fix + title/body on list cards |
| 0.1.0.0 | 2026-08-14 | First MVP: list + editor, ObjectBox, Material 3 |
--- ---
@@ -157,8 +68,10 @@ incido/
│ └── data/ # ObjectBox-backed repository implementation │ └── data/ # ObjectBox-backed repository implementation
├── gradle/ # Version catalog (libs.versions.toml) + wrapper ├── gradle/ # Version catalog (libs.versions.toml) + wrapper
├── keystore/ # Release signing (gitignored *.jks, README kept) ├── keystore/ # Release signing (gitignored *.jks, README kept)
├── scripts/ci/ # Release tooling (changelog extractor for the CI)
├── .gitea/ # Gitea Actions workflow + issue/PR templates ├── .gitea/ # Gitea Actions workflow + issue/PR templates
├── CONTRIBUTING.md ├── CONTRIBUTING.md
├── PREVIOUS_HISTORY.md # Archived user-facing release history
└── LICENSE └── LICENSE
``` ```
@@ -257,7 +170,10 @@ After the first push:
[ ] Tap "Favorites" → list shows only starred notes [ ] Tap "Favorites" → list shows only starred notes
[ ] Tap "Untagged" → list shows only notes with zero hashtags [ ] Tap "Untagged" → list shows only notes with zero hashtags
[ ] Tap a recent hashtag → list filters to that tag [ ] 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) [ ] Open a note → chip row above text field shows current tags (empty placeholder if none)
[ ] Tap "#" icon → sheet opens, type "wo" → suggestions filter [ ] Tap "#" icon → sheet opens, type "wo" → suggestions filter
[ ] Add a new tag → chip appears, counter goes from N/5 to (N+1)/5 [ ] Add a new tag → chip appears, counter goes from N/5 to (N+1)/5
+60 -49
View File
@@ -28,51 +28,30 @@ android {
applicationId = "org.incido.app" applicationId = "org.incido.app"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
// v0.3.6.3: Local-dev DX — make the missing-keystore failure // v0.3.8.0: feature release — task lists, shopping lists, hashtag fix.
// mode actionable. // - Task-list note type: bottom-bar toggle converts the body into
// - signingConfigs.release now throws GradleException at // an editable checklist (checkbox + text rows, add / remove).
// config time when keystore/release.jks is missing, with // - Shopping-list note type: like the task list plus a number-pad
// the exact keytool incantation from keystore/README.md // Cost field per item and a sticky running total of the checked
// in the error message. Previously the signing config // (= in-basket) items (Development Plan §6.1).
// silently fell through with no storeFile, and packageRelease // - Hashtag sheet now shows live-filtered suggestions again (the
// failed much later with the cryptic "SigningConfig release // nested-collect autocomplete pipeline was stuck; flatMapLatest).
// is missing required property storeFile" — leaving devs // - NoteEntity gains `typeKey` (additive, auto-migrated); backups
// guessing at the cause. // round-trip `noteType` with a "TEXT" default for old files.
// - .gitea/workflows/release.yml already mints the keystore // - versionCode monotonic +1 from v0.3.7.1 (32).
// on release runners (since v0.3.6.2), so CI is unaffected. versionCode = 33
// - No app/Compose code changes. versionName = "0.3.8.0"
// - versionCode monotonic +1 from v0.3.6.2 (29).
versionCode = 30
versionName = "0.3.6.3"
} }
// --- Signing --- // --- Signing ---
// v0.3.6.3: Fail fast (at config time) with an actionable error // The release signing config is declared even when the keystore is absent;
// when keystore/release.jks is missing, rather than silently // the existence check is deferred to assembleRelease execution time so that
// letting packageRelease die later with the cryptic "SigningConfig // assembleDebug (which doesn't need the keystore) runs cleanly on a fresh
// release is missing required property storeFile". CI (see // clone. CI always mints the keystore before calling assembleRelease, so
// .gitea/workflows/release.yml) already mints the keystore before // this branch never fires in the normal workflow.
// assembleRelease (since v0.3.6.2), so this branch never fires on
// a release runner — only on a fresh local clone.
signingConfigs { signingConfigs {
create("release") { create("release") {
val keystoreFilePath = rootProject.file("keystore/release.jks") storeFile = 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
storePassword = "incido_dev_keystore" storePassword = "incido_dev_keystore"
keyAlias = "incido" keyAlias = "incido"
keyPassword = "incido_dev_keystore" keyPassword = "incido_dev_keystore"
@@ -89,6 +68,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 { buildFeatures {
compose = true compose = true
} }
@@ -109,6 +111,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 // 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`). // 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 // See Incido Development Plan §11 for the full release build
@@ -120,19 +129,22 @@ android {
// with `Iterable<T>.all(predicate: (T) -> Boolean)` and the modern // with `Iterable<T>.all(predicate: (T) -> Boolean)` and the modern
// `androidComponents.onVariants` API doesn't expose `outputFileName` as // `androidComponents.onVariants` API doesn't expose `outputFileName` as
// a settable property on its outputs), we just register a copy task // a settable property on its outputs), we just register a copy task
// that runs after both `assembleDebug` and `assembleRelease` and drops // that runs after the debug and release builds and drops the built APKs
// the built APKs at the project root with the right names. // 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` // `copyReleaseApks` runs as a finalizer of `assembleRelease`, so
// so `./gradlew assembleRelease` is enough to get both files at the // `./gradlew assembleRelease` is enough to get both files at the repo
// repo root in one command. // root in one command.
val copyReleaseApks = tasks.register("copyReleaseApks") { val copyReleaseApks = tasks.register("copyReleaseApks") {
group = "build" group = "build"
description = "Copies debug + release APKs to the repo root, " + description = "Copies debug + release APKs to the repo root, " +
"stamped with the current versionName " + "stamped with the current versionName " +
"(e.g. Incido-0.3.6.3-debug.apk, Incido-0.3.6.3-release.apk). " + "(e.g. Incido-0.3.6.3-debug.apk, Incido-0.3.6.3-release.apk). " +
"See Incido Development Plan §11." "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 { doLast {
val versionName = android.defaultConfig.versionName val versionName = android.defaultConfig.versionName
val rootDir = rootProject.projectDir val rootDir = rootProject.projectDir
@@ -156,9 +168,8 @@ val copyReleaseApks = tasks.register("copyReleaseApks") {
} }
// Make `assembleRelease` finalize with `copyReleaseApks` so a single // Make `assembleRelease` finalize with `copyReleaseApks` so a single
// `./gradlew assembleRelease` produces both root-level APKs. Using // `./gradlew assembleRelease` produces both root-level APKs. The copy
// `finalizedBy` (not `dependsOn`) avoids a circular dependency: // task depends on assembleDebug, avoiding a task graph cycle.
// `copyReleaseApks` already `dependsOn` `assembleRelease`.
afterEvaluate { afterEvaluate {
tasks.findByName("assembleRelease")?.finalizedBy(copyReleaseApks) tasks.findByName("assembleRelease")?.finalizedBy(copyReleaseApks)
} }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 139 KiB

@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
v0.3.3.8: designed icon replaces the v0.1 placeholder glyph. v0.3.3.8: designed icon replaces the v0.1 placeholder glyph.
The foreground is the density-bucketed incido.png artwork v0.3.7.1: foreground is now the new flat icon artwork
(drawable-<density>/ic_launcher_foreground.png, sized for the (incido_flat_icon.png, downscaled into drawable-<density>/
108dp adaptive canvas); the background matches the artwork's ic_launcher_foreground.png at the 108dp adaptive canvas sizes);
edge colour so parallax exposure is seamless. the background colour matches the artwork's fill so parallax
exposure is seamless.
--> -->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background" />
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
v0.3.3.8: designed icon replaces the v0.1 placeholder glyph. v0.3.3.8: designed icon replaces the v0.1 placeholder glyph.
v0.3.7.1: new flat icon artwork (see ic_launcher.xml).
Round launcher variant of the adaptive icon; same artwork Round launcher variant of the adaptive icon; same artwork
layers as ic_launcher.xml. layers as ic_launcher.xml.
--> -->
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 38 KiB

+5 -3
View File
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- v0.3.3.8: background for the adaptive launcher icon, matched to <!-- v0.3.3.8: background for the adaptive launcher icon, matched to
the edge colour of the incido.png artwork so parallax exposure the artwork's edge colour so parallax exposure is seamless.
of the background layer is seamless. --> v0.3.7.1: re-tinted from #010435 to the new flat icon's fill
<color name="ic_launcher_background">#010435</color> colour (#352999) so the foreground's squircle edges blend
invisibly into the background layer. -->
<color name="ic_launcher_background">#352999</color>
</resources> </resources>
@@ -61,6 +61,7 @@ private fun String.toNoteFilter(): NoteFilter = when {
this == "home" -> NoteFilter.Home this == "home" -> NoteFilter.Home
this == "favorites" -> NoteFilter.Favorites this == "favorites" -> NoteFilter.Favorites
this == "untagged" -> NoteFilter.Untagged this == "untagged" -> NoteFilter.Untagged
this == "trash" -> NoteFilter.Trash
startsWith("tag:") -> NoteFilter.ByTag(this.removePrefix("tag:")) startsWith("tag:") -> NoteFilter.ByTag(this.removePrefix("tag:"))
else -> NoteFilter.Home else -> NoteFilter.Home
} }
@@ -6,6 +6,7 @@ import kotlinx.serialization.json.Json
import org.incido.domain.model.Note import org.incido.domain.model.Note
import org.incido.domain.model.NoteAttachment import org.incido.domain.model.NoteAttachment
import org.incido.domain.model.NoteColor import org.incido.domain.model.NoteColor
import org.incido.domain.model.NoteType
import org.incido.domain.repository.NoteRepository import org.incido.domain.repository.NoteRepository
/** /**
@@ -37,9 +38,11 @@ object BackupCodec {
appVersion: String, appVersion: String,
): BackupFile { ): BackupFile {
// The repository exposes Flows; we materialise a one-shot // The repository exposes Flows; we materialise a one-shot
// snapshot via `.first()`. Notes come from `observeAll`, tags // snapshot via `.first()`. Notes come from `observeAllIncludingTrashed`,
// from `observeAllHashtags`. // tags from `observeAllHashtags`.
val noteList: List<Note> = repository.observeAll().first() // 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() val tagList: List<String> = repository.observeAllHashtags().first()
// NoteAttachment.bytes is loaded on demand via // NoteAttachment.bytes is loaded on demand via
@@ -121,6 +124,14 @@ data class BackupNote(
val color: String, val color: String,
val hashtags: List<String> = emptyList(), val hashtags: List<String> = emptyList(),
val attachments: List<BackupAttachment> = emptyList(), val attachments: List<BackupAttachment> = emptyList(),
/** Preserve soft-delete state; defaults to false for older backups. */
val isTrashed: Boolean = false,
/**
* v0.3.8.0 — serialised as the [org.incido.domain.model.NoteType]
* enum name ("TEXT" / "TASK_LIST" / "SHOPPING_LIST"). Defaulted so
* pre-v0.3.8.0 backup files import as plain-text notes.
*/
val noteType: String = "TEXT",
) )
@Serializable @Serializable
@@ -151,6 +162,8 @@ private suspend fun Note.toBackup(repository: NoteRepository): BackupNote {
updatedAt = updatedAt, updatedAt = updatedAt,
isFavorite = isFavorite, isFavorite = isFavorite,
color = color.name, color = color.name,
isTrashed = isTrashed,
noteType = type.name,
hashtags = hashtags, hashtags = hashtags,
attachments = backups, attachments = backups,
) )
@@ -166,6 +179,8 @@ private fun Note.toBackup(): BackupNote = BackupNote(
updatedAt = updatedAt, updatedAt = updatedAt,
isFavorite = isFavorite, isFavorite = isFavorite,
color = color.name, color = color.name,
isTrashed = isTrashed,
noteType = type.name,
hashtags = hashtags, hashtags = hashtags,
attachments = emptyList(), attachments = emptyList(),
) )
@@ -177,6 +192,8 @@ private fun BackupNote.toDomain(): Note = Note(
updatedAt = updatedAt, updatedAt = updatedAt,
isFavorite = isFavorite, isFavorite = isFavorite,
color = runCatching { NoteColor.valueOf(color) }.getOrDefault(NoteColor.NONE), color = runCatching { NoteColor.valueOf(color) }.getOrDefault(NoteColor.NONE),
isTrashed = isTrashed,
type = runCatching { NoteType.valueOf(noteType) }.getOrDefault(NoteType.TEXT),
hashtags = hashtags, hashtags = hashtags,
// Attachments are inserted separately by importSnapshot so they // Attachments are inserted separately by importSnapshot so they
// get assigned to the freshly-created note id. // get assigned to the freshly-created note id.
@@ -25,6 +25,65 @@ object ReleaseNotes {
* Append a new entry on top each release. * Append a new entry on top each release.
*/ */
val RECENT: List<ReleaseNote> = listOf( val RECENT: List<ReleaseNote> = listOf(
ReleaseNote(
version = "0.3.8.0",
date = "2026-09-16",
bullets = listOf(
"Task lists: a checklist button next to the # button in the " +
"editor turns any note into an editable task list — add, " +
"remove, and tick off items with real checkboxes.",
"Shopping lists with a running total: each row gets a " +
"quantity dropdown (1\u20139) and a supermarket-style " +
"price field \u2014 every digit you tap on the number pad " +
"is a cent, so entering 199 means $1.99 (the price box " +
"shows your raw entry beside its $ sign; the running " +
"total speaks real dollars). Tick an " +
"item once it's in your basket and the always-visible " +
"total at the top adds quantity \u00d7 price. Product, " +
"quantity, and price are strictly separate fields, so a " +
"product called \"Battery AA 3\" can never mess up your " +
"money maths.",
"Tapping the active list button again returns the note to " +
"plain text — nothing is lost, the items just become " +
"\"- [ ]\" lines you can also edit by hand.",
"Add-tag sheet fixed: existing hashtags now appear as a " +
"selectable suggestion list again, narrowing to matches " +
"live as you type (the suggestion pipeline was frozen, so " +
"only \"+ Create\\u2026\" ever showed).",
),
),
ReleaseNote(
version = "0.3.7.1",
date = "2026-08-30",
bullets = listOf(
"Cleaner Add / Edit screen: camera, attach-file, and " +
"add-tag moved out of the crowded title bar into a " +
"bottom action row — the title and remaining buttons " +
"now fit comfortably on every screen.",
"Fixed a false error message that flashed whenever you " +
"opened a saved image in the full-screen viewer.",
"Search now focuses automatically when opened and shows " +
"a clear (✕) button while you type.",
"Long tag lists in the navigation drawer now scroll " +
"instead of being cut off at the bottom.",
"The add-tag sheet opens with the keyboard already up.",
"New app icon: a flatter, cleaner take on the shield " +
"and pen-nib artwork.",
),
),
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( ReleaseNote(
version = "0.3.6.0", version = "0.3.6.0",
date = "2026-08-19", date = "2026-08-19",
@@ -58,49 +117,6 @@ object ReleaseNotes {
"label\" group at the bottom of the card).", "label\" group at the bottom of the card).",
), ),
), ),
ReleaseNote( // v0.3.8.0 push drops v0.3.5.0 off the "5 most recent" tail.
version = "0.3.5.0",
date = "2026-08-17",
bullets = listOf(
"\"Encrypt notes at rest\" now really works: your note text " +
"and attachment files are AES-256-GCM encrypted in place " +
"the moment you flip the switch (no restart), using the " +
"Android Keystore key.",
"Every time the app opens, each encrypted note is " +
"double-checked by decrypting it — a card only earns the " +
"\"Encrypted\" badge at the bottom of the card if that " +
"check passes.",
"New \"Block screenshots\" toggle (on by default): prevents " +
"screenshots, screen recording, and app-switcher previews " +
"while Incido is open.",
),
),
ReleaseNote(
version = "0.3.4.0",
date = "2026-08-17",
bullets = listOf(
"Note cards now show a paperclip icon on the right edge " +
"whenever a note has an attachment — lined up between " +
"the favourite star and the \u22EE menu.",
"Cards with a dark image background are now readable in " +
"Light theme — the title, preview text, timestamp and " +
"icons switch to light colours over the photo.",
"Auto-Lock set to \"Immediately\" no longer locks the app " +
"while you're picking a file to attach (or exporting / " +
"importing a backup), so your in-progress note and the " +
"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.
) )
} }
@@ -11,6 +11,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.LabelOff 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.Settings
import androidx.compose.material.icons.filled.Star import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.Tag import androidx.compose.material.icons.filled.Tag
@@ -25,7 +26,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -34,8 +34,8 @@ import org.incido.domain.model.HashtagUsage
import org.incido.domain.model.NoteFilter import org.incido.domain.model.NoteFilter
/** /**
* Left-side navigation drawer. Top section has four fixed entries * Left-side navigation drawer. Top section has five fixed entries
* (Home / Favorites / Untagged / Settings); a `HorizontalDivider`; then * (Home / Favorites / Untagged / Trash / Settings); a `HorizontalDivider`; then
* a live scrollable list of the user's most-recently-used hashtags. * a live scrollable list of the user's most-recently-used hashtags.
* *
* Tapping a filter entry calls [onSelectFilter]; tapping Settings * Tapping a filter entry calls [onSelectFilter]; tapping Settings
@@ -88,6 +88,12 @@ fun IncidoDrawer(
onClick = { onSelectFilter(NoteFilter.Untagged) }, onClick = { onSelectFilter(NoteFilter.Untagged) },
icon = { Icon(Icons.Filled.LabelOff, contentDescription = null) }, 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)) HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))
@@ -121,6 +127,10 @@ fun IncidoDrawer(
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
// weight(1f) caps this list at the remaining
// sheet height so long tag lists scroll inside
// the drawer instead of overflowing the bottom.
.weight(1f)
.verticalScroll(rememberScrollState()), .verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(2.dp), verticalArrangement = Arrangement.spacedBy(2.dp),
) { ) {
@@ -158,6 +168,3 @@ private fun DrawerHashtagEntry(
icon = { Icon(Icons.Filled.Tag, contentDescription = null) }, icon = { Icon(Icons.Filled.Tag, contentDescription = null) },
) )
} }
@Suppress("unused")
private val _ignored: Color = Color.Unspecified
@@ -18,7 +18,6 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState import androidx.compose.runtime.produceState
@@ -31,13 +30,11 @@ import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties import androidx.compose.ui.window.DialogProperties
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.widget.Toast
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.incido.domain.repository.NoteRepository import org.incido.domain.repository.NoteRepository
@@ -91,9 +88,11 @@ fun ImageViewerScreen(
offsetY += panChange.y offsetY += panChange.y
} }
// Decode the image (or display an error / "unsupported" // Decode the image (or display an error message when the
// message for non-image attachments). // bytes can't be loaded / decoded).
var loadFailed by remember { mutableStateOf(false) }
val bitmap by produceState<android.graphics.Bitmap?>(initialValue = null, key1 = attachmentId) { val bitmap by produceState<android.graphics.Bitmap?>(initialValue = null, key1 = attachmentId) {
loadFailed = false
val bytes: ByteArray? = when (attachmentId) { val bytes: ByteArray? = when (attachmentId) {
is ViewerAttachmentId.Persisted -> withContext(Dispatchers.IO) { is ViewerAttachmentId.Persisted -> withContext(Dispatchers.IO) {
repository.getAttachmentBytes(attachmentId.id) repository.getAttachmentBytes(attachmentId.id)
@@ -101,22 +100,14 @@ fun ImageViewerScreen(
is ViewerAttachmentId.Pending -> pendingBytes is ViewerAttachmentId.Pending -> pendingBytes
} }
if (bytes == null) { if (bytes == null) {
value = null loadFailed = true
return@produceState return@produceState
} }
value = withContext(Dispatchers.IO) { val decoded = withContext(Dispatchers.IO) {
BitmapFactory.decodeByteArray(bytes, 0, bytes.size) BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
} }
} value = decoded
if (decoded == null) loadFailed = true
val ctx = LocalContext.current
LaunchedEffect(attachmentId) {
if (attachmentId is ViewerAttachmentId.Persisted) {
val mime = "image" // we only open the viewer for images; see editor
if (bitmap == null) {
Toast.makeText(ctx, "Couldn't decode $mime attachment", Toast.LENGTH_SHORT).show()
}
}
} }
if (bitmap != null) { if (bitmap != null) {
@@ -152,7 +143,7 @@ fun ImageViewerScreen(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
) { ) {
Text( Text(
text = "Loading…", text = if (loadFailed) "Couldn't load image" else "Loading…",
color = Color.White, color = Color.White,
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
@@ -8,8 +8,10 @@ import android.net.Uri
import android.widget.Toast import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
@@ -22,33 +24,42 @@ import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.ime import androidx.compose.foundation.layout.ime
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBars import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.union import androidx.compose.foundation.layout.union
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.AttachFile import androidx.compose.material.icons.filled.AttachFile
import androidx.compose.material.icons.filled.CameraAlt import androidx.compose.material.icons.filled.CameraAlt
import androidx.compose.material.icons.filled.Checklist
import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Description import androidx.compose.material.icons.filled.Description
import androidx.compose.material.icons.filled.Done import androidx.compose.material.icons.filled.Done
import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.ShoppingBasket
import androidx.compose.material.icons.filled.Star import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.Tag import androidx.compose.material.icons.filled.Tag
import androidx.compose.material.icons.outlined.StarOutline import androidx.compose.material.icons.outlined.StarOutline
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.AssistChip import androidx.compose.material3.AssistChip
import androidx.compose.material3.Checkbox
import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@@ -58,7 +69,10 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SuggestionChip import androidx.compose.material3.SuggestionChip
import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.material3.rememberModalBottomSheetState
@@ -76,6 +90,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusEvent
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.painter.BitmapPainter import androidx.compose.ui.graphics.painter.BitmapPainter
@@ -83,7 +98,11 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
@@ -94,8 +113,11 @@ import org.incido.compose.data.security.SecurityManager
import org.incido.compose.ui.theme.AllNoteColors import org.incido.compose.ui.theme.AllNoteColors
import org.incido.compose.ui.theme.swatchBorderColor import org.incido.compose.ui.theme.swatchBorderColor
import org.incido.compose.ui.theme.toComposeColor import org.incido.compose.ui.theme.toComposeColor
import org.incido.domain.model.ChecklistItem
import org.incido.domain.model.Hashtag import org.incido.domain.model.Hashtag
import org.incido.domain.model.Note
import org.incido.domain.model.NoteColor import org.incido.domain.model.NoteColor
import org.incido.domain.model.NoteType
import java.io.File import java.io.File
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class) @OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@@ -137,12 +159,6 @@ fun NoteEditorScreen(
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
val ctx = LocalContext.current val ctx = LocalContext.current
// v0.3.1.0: pick up the NoteRepository from the editor's VM (it's not
// on the ViewModel's public surface but we can grab it for the image
// viewer via the app container — see App.kt wiring for the actual
// route through. Fall back to null and disable the viewer.)
val repoForViewer = repository
// v0.3.1.0: camera permission + capture. The camera launcher is // v0.3.1.0: camera permission + capture. The camera launcher is
// declared FIRST so the permission callback (below) can forward to it // declared FIRST so the permission callback (below) can forward to it
// without a Kotlin forward-reference error. // without a Kotlin forward-reference error.
@@ -250,6 +266,7 @@ fun NoteEditorScreen(
initialFavorite = viewModel.initialFavorite, initialFavorite = viewModel.initialFavorite,
initialColor = viewModel.initialColor, initialColor = viewModel.initialColor,
initialTags = viewModel.initialHashtags, initialTags = viewModel.initialHashtags,
initialType = viewModel.initialType,
) )
} }
@@ -284,49 +301,24 @@ fun NoteEditorScreen(
contentWindowInsets = WindowInsets.systemBars.union(WindowInsets.ime), contentWindowInsets = WindowInsets.systemBars.union(WindowInsets.ime),
snackbarHost = { SnackbarHost(hostState = snackbarHost) }, snackbarHost = { SnackbarHost(hostState = snackbarHost) },
topBar = { topBar = {
// v0.3.6.1 Emergency Patch: left-anchored title sits against the back arrow // Left-anchored title (v0.3.6.1). Camera / attach-file / add-tag
// (CenterAlignedTopAppBar was crowded by the six right-side actions). // now live in the bottom action row below, so the remaining
// actions (favourite, save, overflow) always fit beside the
// title, even on narrow screens.
TopAppBar( TopAppBar(
title = { Text(if (state.isEditing) "Edit" else "New") }, title = {
Text(
text = if (state.isEditing) "Edit note" else "New note",
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
},
navigationIcon = { navigationIcon = {
IconButton(onClick = { tryClose() }) { IconButton(onClick = { tryClose() }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
} }
}, },
actions = { actions = {
// v0.3.1.0: Camera (camera icon) + Attach File (paperclip icon).
IconButton(onClick = { launchCamera() }) {
Icon(
Icons.Filled.CameraAlt,
contentDescription = "Take photo",
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
IconButton(onClick = {
// v0.3.4.0 hotfix: the SAF picker backgrounds
// the app; with Auto-Lock = Immediate the return
// used to lock the app and wipe the unsaved note.
securityManager?.beginExternalActivity()
filePickerLauncher.launch(arrayOf("*/*"))
}) {
Icon(
Icons.Filled.AttachFile,
contentDescription = "Attach file",
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
IconButton(
onClick = { viewModel.openAddTagSheet() },
enabled = state.canAddMoreTags,
) {
Icon(
Icons.Filled.Tag,
contentDescription = "Add tag",
tint = if (state.canAddMoreTags)
MaterialTheme.colorScheme.onSurfaceVariant
else MaterialTheme.colorScheme.outlineVariant,
)
}
IconButton(onClick = { viewModel.toggleFavorite() }) { IconButton(onClick = { viewModel.toggleFavorite() }) {
Icon( Icon(
imageVector = if (state.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline, imageVector = if (state.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline,
@@ -350,7 +342,7 @@ fun NoteEditorScreen(
onDismissRequest = { menuExpanded = false }, onDismissRequest = { menuExpanded = false },
) { ) {
DropdownMenuItem( DropdownMenuItem(
text = { Text("Delete") }, text = { Text("Move to Trash") },
onClick = { onClick = {
menuExpanded = false menuExpanded = false
viewModel.delete(onClose) viewModel.delete(onClose)
@@ -376,7 +368,7 @@ fun NoteEditorScreen(
// top edge of the note content (previously the row's // top edge of the note content (previously the row's
// `vertical = 4.dp` padding was dwarfed by the OutlinedTextField's // `vertical = 4.dp` padding was dwarfed by the OutlinedTextField's
// intrinsic top inset, making the lower gap appear far larger). // intrinsic top inset, making the lower gap appear far larger).
androidx.compose.foundation.layout.Spacer(Modifier.height(12.dp)) Spacer(Modifier.height(12.dp))
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -394,22 +386,50 @@ fun NoteEditorScreen(
) )
} }
} }
androidx.compose.foundation.layout.Spacer(Modifier.height(12.dp)) Spacer(Modifier.height(12.dp))
OutlinedTextField( // v0.3.8.0 — structured list editors replace the free-text
value = state.content, // field whenever the note is a task / shopping list; the
onValueChange = viewModel::onContentChange, // rows live in NoteEditorUiState.items and the view-model
modifier = Modifier // keeps `content` synchronised with their serialisation.
.weight(1f) if (state.type == NoteType.TEXT) {
.fillMaxWidth() OutlinedTextField(
.padding(horizontal = 16.dp) value = state.content,
.focusRequester(focusRequester), onValueChange = viewModel::onContentChange,
placeholder = { Text("Write something…") }, modifier = Modifier
keyboardOptions = KeyboardOptions( .weight(1f)
capitalization = KeyboardCapitalization.Sentences, .fillMaxWidth()
imeAction = ImeAction.Default, .padding(horizontal = 16.dp)
), .focusRequester(focusRequester),
) placeholder = { Text("Write something…", style = editorFieldStyle()) },
textStyle = editorFieldStyle(),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.Sentences,
imeAction = ImeAction.Default,
),
)
} else {
// Sticky running total — always visible above the rows
// while shopping (per Development Plan §6.1), summing
// the costs of checked (= in-basket) items.
if (state.type == NoteType.SHOPPING_LIST) {
ShoppingTotalBar(totalCents = Note.shoppingTotalCents(state.items))
}
ChecklistEditorBody(
modifier = Modifier.weight(1f),
header = state.listHeader,
items = state.items,
isShopping = state.type == NoteType.SHOPPING_LIST,
focusRequester = focusRequester,
onHeaderChange = viewModel::onHeaderChange,
onToggleItem = viewModel::setItemChecked,
onItemTextChange = viewModel::setItemText,
onItemQuantityChange = viewModel::setItemQuantity,
onItemCostChange = viewModel::setItemCost,
onRemoveItem = viewModel::removeListItem,
onAddItem = viewModel::addListItem,
)
}
// v0.3.1.0: attachment thumbnail strip. Combines persisted // v0.3.1.0: attachment thumbnail strip. Combines persisted
// attachments (loaded via observeAttachments in the VM) with // attachments (loaded via observeAttachments in the VM) with
@@ -419,7 +439,6 @@ fun NoteEditorScreen(
if (state.attachments.isNotEmpty() || state.pendingAttachments.isNotEmpty()) { if (state.attachments.isNotEmpty() || state.pendingAttachments.isNotEmpty()) {
AttachmentStrip( AttachmentStrip(
persisted = state.attachments, persisted = state.attachments,
persistedBytes = emptyMap(), // resolved lazily in the viewer
persistedViewerIds = state.attachments.associate { it.id to ViewerAttachmentId.Persisted(it.id) }, persistedViewerIds = state.attachments.associate { it.id to ViewerAttachmentId.Persisted(it.id) },
persistedOpen = { id -> viewModel.openFullScreen(id) }, persistedOpen = { id -> viewModel.openFullScreen(id) },
persistedDelete = { id -> viewModel.deletePersistedAttachment(id) }, persistedDelete = { id -> viewModel.deletePersistedAttachment(id) },
@@ -441,6 +460,76 @@ fun NoteEditorScreen(
tags = state.hashtags, tags = state.hashtags,
onRemove = { viewModel.removeTag(it) }, onRemove = { viewModel.removeTag(it) },
) )
// Camera / attach-file / add-tag moved out of the title bar
// into this bottom action row so the top bar always fits
// (the six-action cluster used to crowd the title on narrow
// screens). Keep-style placement, above the nav bar /
// keyboard.
HorizontalDivider()
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
IconButton(onClick = { launchCamera() }) {
Icon(
Icons.Filled.CameraAlt,
contentDescription = "Take photo",
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
IconButton(onClick = {
// v0.3.4.0 hotfix: the SAF picker backgrounds
// the app; with Auto-Lock = Immediate the return
// used to lock the app and wipe the unsaved note.
securityManager?.beginExternalActivity()
filePickerLauncher.launch(arrayOf("*/*"))
}) {
Icon(
Icons.Filled.AttachFile,
contentDescription = "Attach file",
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
IconButton(
onClick = { viewModel.openAddTagSheet() },
enabled = state.canAddMoreTags,
) {
Icon(
Icons.Filled.Tag,
contentDescription = "Add tag",
tint = if (state.canAddMoreTags)
MaterialTheme.colorScheme.onSurfaceVariant
else MaterialTheme.colorScheme.outlineVariant,
)
}
// v0.3.8.0 — task-list toggle next to the # button.
// Converts the body into editable checklist rows (and
// back); the active mode tints with the primary colour.
IconButton(onClick = { viewModel.convertTo(NoteType.TASK_LIST) }) {
Icon(
Icons.Filled.Checklist,
contentDescription = "Task list",
tint = if (state.type == NoteType.TASK_LIST)
MaterialTheme.colorScheme.primary
else MaterialTheme.colorScheme.onSurfaceVariant,
)
}
// v0.3.8.0 — shopping-list toggle: like the task list
// but each row gains a number-pad Cost field and a
// sticky running total of checked items sits on top.
IconButton(onClick = { viewModel.convertTo(NoteType.SHOPPING_LIST) }) {
Icon(
Icons.Filled.ShoppingBasket,
contentDescription = "Shopping list",
tint = if (state.type == NoteType.SHOPPING_LIST)
MaterialTheme.colorScheme.primary
else MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
} }
} }
@@ -466,14 +555,14 @@ fun NoteEditorScreen(
// v0.3.1.0: full-screen image viewer. // v0.3.1.0: full-screen image viewer.
state.fullScreenAttachmentId?.let { viewerId -> state.fullScreenAttachmentId?.let { viewerId ->
if (repoForViewer != null) { if (repository != null) {
val pendingBytes: ByteArray? = when (viewerId) { val pendingBytes: ByteArray? = when (viewerId) {
is ViewerAttachmentId.Pending -> state.pendingAttachmentBytes[viewerId.tempId] is ViewerAttachmentId.Pending -> state.pendingAttachmentBytes[viewerId.tempId]
is ViewerAttachmentId.Persisted -> null // viewer loads from DB is ViewerAttachmentId.Persisted -> null // viewer loads from DB
} }
ImageViewerScreen( ImageViewerScreen(
attachmentId = viewerId, attachmentId = viewerId,
repository = repoForViewer, repository = repository,
pendingBytes = pendingBytes, pendingBytes = pendingBytes,
onClose = { viewModel.closeFullScreen() }, onClose = { viewModel.closeFullScreen() },
) )
@@ -497,7 +586,6 @@ fun NoteEditorScreen(
@Composable @Composable
private fun AttachmentStrip( private fun AttachmentStrip(
persisted: List<org.incido.domain.model.NoteAttachment>, persisted: List<org.incido.domain.model.NoteAttachment>,
persistedBytes: Map<Long, ByteArray>,
persistedViewerIds: Map<Long, ViewerAttachmentId>, persistedViewerIds: Map<Long, ViewerAttachmentId>,
persistedOpen: (ViewerAttachmentId) -> Unit, persistedOpen: (ViewerAttachmentId) -> Unit,
persistedDelete: (Long) -> Unit, persistedDelete: (Long) -> Unit,
@@ -515,7 +603,6 @@ private fun AttachmentStrip(
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 8.dp), .padding(horizontal = 16.dp, vertical = 8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp),
contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 0.dp),
) { ) {
items(persisted, key = { it.id }) { att -> items(persisted, key = { it.id }) { att ->
AttachmentThumbnail( AttachmentThumbnail(
@@ -581,7 +668,7 @@ private fun AttachmentThumbnail(
// handler to bail with a misleading "Loading…" Toast forever. // handler to bail with a misleading "Loading…" Toast forever.
val lazyBytes by produceState<ByteArray?>(initialValue = null, key1 = attachmentId) { val lazyBytes by produceState<ByteArray?>(initialValue = null, key1 = attachmentId) {
if (pendingBytes == null && attachmentId != null && repository != null) { if (pendingBytes == null && attachmentId != null && repository != null) {
value = withContext(kotlinx.coroutines.Dispatchers.IO) { value = withContext(Dispatchers.IO) {
repository.getAttachmentBytes(attachmentId) repository.getAttachmentBytes(attachmentId)
} }
} }
@@ -671,7 +758,7 @@ private fun AttachmentThumbnail(
BitmapFactory.decodeByteArray(effectiveBytes, 0, effectiveBytes.size) BitmapFactory.decodeByteArray(effectiveBytes, 0, effectiveBytes.size)
} }
if (bitmap != null) { if (bitmap != null) {
androidx.compose.foundation.Image( Image(
bitmap = bitmap.asImageBitmap(), bitmap = bitmap.asImageBitmap(),
contentDescription = displayName, contentDescription = displayName,
contentScale = ContentScale.Crop, contentScale = ContentScale.Crop,
@@ -709,7 +796,7 @@ private fun AttachmentThumbnail(
@Composable @Composable
private fun FileTypePlaceholder(mimeType: String, displayName: String) { private fun FileTypePlaceholder(mimeType: String, displayName: String) {
androidx.compose.foundation.layout.Column( Column(
modifier = Modifier.fillMaxSize().padding(6.dp), modifier = Modifier.fillMaxSize().padding(6.dp),
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
@@ -720,7 +807,7 @@ private fun FileTypePlaceholder(mimeType: String, displayName: String) {
tint = MaterialTheme.colorScheme.onSurfaceVariant, tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(28.dp), modifier = Modifier.size(28.dp),
) )
androidx.compose.foundation.layout.Spacer(Modifier.size(4.dp)) Spacer(Modifier.size(4.dp))
Text( Text(
text = displayName.take(14) + if (displayName.length > 14) "…" else "", text = displayName.take(14) + if (displayName.length > 14) "…" else "",
style = MaterialTheme.typography.labelSmall, style = MaterialTheme.typography.labelSmall,
@@ -791,6 +878,12 @@ private fun AddTagSheet(
onDismiss: () -> Unit, onDismiss: () -> Unit,
) { ) {
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
// Auto-focus the field so the keyboard is already up by the time
// the sheet settles — one less tap to add a tag.
val tagFocusRequester = remember { FocusRequester() }
LaunchedEffect(Unit) {
runCatching { tagFocusRequester.requestFocus() }
}
ModalBottomSheet( ModalBottomSheet(
onDismissRequest = onDismiss, onDismissRequest = onDismiss,
sheetState = sheetState, sheetState = sheetState,
@@ -809,7 +902,9 @@ private fun AddTagSheet(
singleLine = true, singleLine = true,
leadingIcon = { Icon(Icons.Filled.Tag, contentDescription = null) }, leadingIcon = { Icon(Icons.Filled.Tag, contentDescription = null) },
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None), keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None),
modifier = Modifier.fillMaxWidth(), modifier = Modifier
.fillMaxWidth()
.focusRequester(tagFocusRequester),
) )
if (suggestions.isNotEmpty()) { if (suggestions.isNotEmpty()) {
Text( Text(
@@ -840,6 +935,266 @@ private fun AddTagSheet(
} }
} }
// ---------------------------------------------------------------------
// v0.3.8.0: task / shopping list editor body
// ---------------------------------------------------------------------
/**
* Sticky running total for shopping lists — pinned above the rows so
* it stays visible at all times (Development Plan §6.1: "renders a
* sticky running total … updated live as prices are added/edited
* while shopping"). Sums the costs of CHECKED (= in-basket) items.
*/
@Composable
private fun ShoppingTotalBar(totalCents: Long) {
Row(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.surfaceVariant)
.padding(horizontal = 16.dp, vertical = 6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
Icons.Filled.ShoppingBasket,
contentDescription = null,
modifier = Modifier.size(18.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.size(8.dp))
Text(
"Running total (qty × price, checked items)",
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.weight(1f))
Text(
text = Note.formatMoney(totalCents.toString()),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.primary,
)
}
HorizontalDivider()
}
/**
* Structured body for task / shopping list notes: the title/preamble
* field, one [ChecklistItemRow] per item, and an "+ Add item" button.
* All mutations route through the view-model, which re-serialises the
* rows back into [NoteEditorUiState.content].
*/
@Composable
private fun ChecklistEditorBody(
modifier: Modifier = Modifier,
header: String,
items: List<ChecklistItem>,
isShopping: Boolean,
focusRequester: FocusRequester,
onHeaderChange: (String) -> Unit,
onToggleItem: (Int, Boolean) -> Unit,
onItemTextChange: (Int, String) -> Unit,
onItemQuantityChange: (Int, String) -> Unit,
onItemCostChange: (Int, String) -> Unit,
onRemoveItem: (Int) -> Unit,
onAddItem: () -> Unit,
) {
LazyColumn(modifier = modifier.fillMaxWidth()) {
item {
// Title / preamble. Kept as plain lines above the checkbox
// rows so the list cards' title+body split keeps working.
EditorLineField(
value = header,
onValueChange = onHeaderChange,
placeholder = "Title",
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.Sentences,
imeAction = ImeAction.Next,
),
fieldModifier = Modifier.focusRequester(focusRequester),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 4.dp),
)
}
itemsIndexed(items) { index, item ->
ChecklistItemRow(
item = item,
isShopping = isShopping,
onToggle = { checked -> onToggleItem(index, checked) },
onTextChange = { text -> onItemTextChange(index, text) },
onQuantityChange = { qty -> onItemQuantityChange(index, qty) },
onCostChange = { cost -> onItemCostChange(index, cost) },
onRemove = { onRemoveItem(index) },
)
}
item {
TextButton(onClick = onAddItem) {
Icon(
Icons.Filled.Add,
contentDescription = null,
modifier = Modifier.size(18.dp),
)
Spacer(Modifier.size(6.dp))
Text("+ Add item")
}
}
}
}
/** One row: `[ ]` · Product · Qty picker · per-item price · remove. */
@Composable
private fun ChecklistItemRow(
item: ChecklistItem,
isShopping: Boolean,
onToggle: (Boolean) -> Unit,
onTextChange: (String) -> Unit,
onQuantityChange: (String) -> Unit,
onCostChange: (String) -> Unit,
onRemove: () -> Unit,
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Checkbox(checked = item.checked, onCheckedChange = onToggle)
// The product field holds ANY text — numbers included. Quantity /
// price live in their own controls and an explicit `{q… p…}`
// storage marker, so a product called "Battery AA 3" can never
// bleed into the money fields.
EditorLineField(
value = item.text,
onValueChange = onTextChange,
placeholder = if (isShopping) "Product" else "Task",
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.Sentences,
imeAction = ImeAction.Next,
),
modifier = Modifier.weight(1f),
)
if (isShopping) {
Spacer(Modifier.size(6.dp))
// Free-text quantity line (replaced the 1–9 dropdown, whose
// digit never fit its box). Blank means quantity 1: while
// focused an empty line shows the "Quan." hint; on focus
// loss it settles on "1" — display-only, storage keeps the
// blank default so {q1} never enters the saved text.
EditorLineField(
value = item.quantity,
onValueChange = onQuantityChange,
placeholder = "Quan.",
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Number,
imeAction = ImeAction.Next,
),
formatUnfocused = { digits ->
if (digits.isEmpty()) "1" else digits
},
modifier = Modifier.width(72.dp),
)
Spacer(Modifier.size(6.dp))
// Supermarket-style cents entry: while focused the line shows
// the RAW digits typed ("123"); on focus loss it switches to
// the parsed money form ("$1.23"). Storage always keeps the
// raw cent digits, so totals / serialisation are unaffected.
EditorLineField(
value = item.cost,
onValueChange = onCostChange,
placeholder = "Price",
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Number,
imeAction = ImeAction.Next,
),
formatUnfocused = { digits ->
if (digits.isEmpty()) "" else "$" + Note.amountFromPriceDigits(digits)
},
modifier = Modifier.width(110.dp),
)
}
IconButton(onClick = onRemove) {
Icon(
Icons.Filled.Close,
contentDescription = "Remove item",
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
}
/**
* v0.3.8.0 — the ~20 % smaller text style every editor surface uses
* (plain body, list header, task/product/quantity/price lines). The 16sp
* bodyLarge default made rows look squashed inside their fields.
*/
@Composable
private fun editorFieldStyle(): TextStyle =
MaterialTheme.typography.bodyMedium.copy(fontSize = 13.sp, lineHeight = 18.sp)
/**
* v0.3.8.0 — one plain underlined editing line, shared by every editable
* field in the editor (title, task/product, quantity, price). Replaces
* the mismatched outlined boxes with a single visual rhythm: same
* minimum height, same 13sp text, and a 2 dp bottom rule that brightens
* while the field has focus.
*
* [formatUnfocused] swaps in a parsed display ("$1.23") while the field
* has no focus — editing always shows the raw stored value ("123").
* [fieldModifier] targets the inner text field itself (focus requester).
*/
@Composable
private fun EditorLineField(
value: String,
onValueChange: (String) -> Unit,
placeholder: String = "",
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
formatUnfocused: ((String) -> String)? = null,
fieldModifier: Modifier = Modifier,
modifier: Modifier = Modifier,
) {
val fieldStyle = editorFieldStyle()
val hintColor = MaterialTheme.colorScheme.onSurfaceVariant
var focused by remember { mutableStateOf(false) }
val displayed =
if (focused || formatUnfocused == null) value else formatUnfocused(value)
Row(
modifier = modifier.heightIn(min = 44.dp),
verticalAlignment = Alignment.CenterVertically,
) {
// Material 3 filled TextField with fully transparent containers:
// what remains visible is just the text line and the 2 dp bottom
// indicator — exactly the "one line per field" look, for free.
TextField(
value = displayed,
onValueChange = onValueChange,
singleLine = true,
placeholder = {
Text(
text = placeholder,
style = fieldStyle,
color = hintColor,
maxLines = 1,
)
},
textStyle = fieldStyle.copy(
color = MaterialTheme.colorScheme.onSurface,
),
keyboardOptions = keyboardOptions,
colors = TextFieldDefaults.colors(
focusedContainerColor = Color.Transparent,
unfocusedContainerColor = Color.Transparent,
disabledContainerColor = Color.Transparent,
errorContainerColor = Color.Transparent,
focusedIndicatorColor = MaterialTheme.colorScheme.primary,
unfocusedIndicatorColor = MaterialTheme.colorScheme.outlineVariant,
cursorColor = MaterialTheme.colorScheme.primary,
),
modifier = fieldModifier
.weight(1f)
.onFocusEvent { focused = it.isFocused },
)
}
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// v0.3.1.0: helpers (camera URI + SAF display-name query) // v0.3.1.0: helpers (camera URI + SAF display-name query)
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
@@ -7,20 +7,24 @@ import androidx.lifecycle.viewModelScope
import androidx.lifecycle.viewmodel.initializer import androidx.lifecycle.viewmodel.initializer
import androidx.lifecycle.viewmodel.viewModelFactory import androidx.lifecycle.viewmodel.viewModelFactory
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.incido.compose.IncidoApplication import org.incido.compose.IncidoApplication
import org.incido.compose.share.LinkedShareComposer import org.incido.compose.share.LinkedShareComposer
import org.incido.domain.model.ChecklistItem
import org.incido.domain.model.Hashtag import org.incido.domain.model.Hashtag
import org.incido.domain.model.Note import org.incido.domain.model.Note
import org.incido.domain.model.NoteAttachment import org.incido.domain.model.NoteAttachment
import org.incido.domain.model.NoteColor import org.incido.domain.model.NoteColor
import org.incido.domain.model.NoteType
import org.incido.domain.repository.NoteRepository import org.incido.domain.repository.NoteRepository
/** /**
@@ -33,6 +37,16 @@ data class NoteEditorUiState(
val color: NoteColor = NoteColor.NONE, val color: NoteColor = NoteColor.NONE,
/** Normalised, sorted ascending. */ /** Normalised, sorted ascending. */
val hashtags: List<String> = emptyList(), val hashtags: List<String> = emptyList(),
/** v0.3.8.0 — which editor surface the body uses (see [NoteType]). */
val type: NoteType = NoteType.TEXT,
/** v0.3.8.0 — title / preamble kept above the rows in list modes. */
val listHeader: String = "",
/** v0.3.8.0 — parsed checklist rows; always empty for [NoteType.TEXT]. */
val items: List<ChecklistItem> = emptyList(),
/** True while the add-tag sheet is open. */ /** True while the add-tag sheet is open. */
val isAddingTag: Boolean = false, val isAddingTag: Boolean = false,
/** Latest typing in the add-tag sheet (raw, before normalisation). */ /** Latest typing in the add-tag sheet (raw, before normalisation). */
@@ -90,10 +104,12 @@ data class NoteEditorUiState(
initialFavorite: Boolean, initialFavorite: Boolean,
initialColor: NoteColor, initialColor: NoteColor,
initialTags: List<String>, initialTags: List<String>,
initialType: NoteType,
): Boolean = content != initialContent || ): Boolean = content != initialContent ||
isFavorite != initialFavorite || isFavorite != initialFavorite ||
color != initialColor || color != initialColor ||
hashtags != initialTags hashtags != initialTags ||
type != initialType
companion object { companion object {
/** Hard cap on tags per note (matches Development Plan §6.1). */ /** Hard cap on tags per note (matches Development Plan §6.1). */
@@ -129,6 +145,7 @@ data class PendingAttachment(
val isImage: Boolean get() = mimeType.startsWith("image/") val isImage: Boolean get() = mimeType.startsWith("image/")
} }
@OptIn(ExperimentalCoroutinesApi::class)
class NoteEditorViewModel( class NoteEditorViewModel(
private val repository: NoteRepository, private val repository: NoteRepository,
private val noteId: Long?, private val noteId: Long?,
@@ -178,6 +195,8 @@ class NoteEditorViewModel(
private set private set
var initialHashtags: List<String> = emptyList() var initialHashtags: List<String> = emptyList()
private set private set
var initialType: NoteType = NoteType.TEXT
private set
/** Internal: re-emits suggestions whenever the tag input changes. */ /** Internal: re-emits suggestions whenever the tag input changes. */
private val tagInputFlow = MutableStateFlow("") private val tagInputFlow = MutableStateFlow("")
@@ -193,18 +212,27 @@ class NoteEditorViewModel(
init { init {
// Tag autocomplete — re-query on every keystroke (debounced upstream // Tag autocomplete — re-query on every keystroke (debounced upstream
// would be nice but ObjectBox is plenty fast for this size). // would be nice but ObjectBox is plenty fast for this size).
// Tag autocomplete. v0.3.8.0 FIX: the previous nested
// `tagInputFlow.collect { pool.collect { … } }` never resumed
// past the first keystroke — observeAllHashtags()/searchHashtags()
// are infinite callbackFlows, so the outer lambda suspended in
// the inner collect forever and typing never re-queried (the
// sheet only ever showed "+ Create"). flatMapLatest cancels the
// previous subscription per keystroke, and each fresh flow
// try-sends its snapshot immediately ⇒ live filtering.
viewModelScope.launch { viewModelScope.launch {
tagInputFlow.collect { raw -> tagInputFlow
val prefix = Hashtag.normalise(raw) .flatMapLatest { raw ->
val pool = if (prefix.isEmpty()) { val prefix = Hashtag.normalise(raw)
repository.observeAllHashtags() if (prefix.isEmpty()) {
} else { repository.observeAllHashtags()
repository.searchHashtags(prefix) } else {
repository.searchHashtags(prefix)
}
} }
pool.collect { suggestions -> .collect { suggestions ->
_state.update { it.copy(tagSuggestions = suggestions) } _state.update { it.copy(tagSuggestions = suggestions) }
} }
}
} }
// Live attachments: pump persisted rows into state.attachments. // Live attachments: pump persisted rows into state.attachments.
@@ -258,12 +286,25 @@ class NoteEditorViewModel(
} else { } else {
viewModelScope.launch { viewModelScope.launch {
repository.observeById(noteId).collect { note -> repository.observeById(noteId).collect { note ->
if (note != null && _state.value.isLoading) { val firstLoad = _state.value.isLoading
if (note != null && firstLoad) {
initialContent = note.content initialContent = note.content
initialFavorite = note.isFavorite initialFavorite = note.isFavorite
initialColor = note.color initialColor = note.color
initialHashtags = note.hashtags initialHashtags = note.hashtags
initialType = note.type
} }
// Parse list rows once on first load; later DB
// emissions must not clobber in-progress edits.
val listSeed: Pair<String, List<ChecklistItem>>? =
if (note != null && firstLoad && note.type != NoteType.TEXT) {
Note.splitListContent(
note.content,
interpretCosts = note.type == NoteType.SHOPPING_LIST,
)
} else {
null
}
_state.update { _state.update {
it.copy( it.copy(
existing = note, existing = note,
@@ -271,6 +312,9 @@ class NoteEditorViewModel(
isFavorite = note?.isFavorite ?: it.isFavorite, isFavorite = note?.isFavorite ?: it.isFavorite,
color = note?.color ?: it.color, color = note?.color ?: it.color,
hashtags = note?.hashtags ?: it.hashtags, hashtags = note?.hashtags ?: it.hashtags,
type = note?.type ?: it.type,
listHeader = listSeed?.first ?: it.listHeader,
items = listSeed?.second ?: it.items,
isLoading = false, isLoading = false,
) )
} }
@@ -292,17 +336,18 @@ class NoteEditorViewModel(
} }
fun openAddTagSheet() { fun openAddTagSheet() {
_state.update { // v0.3.8.0 FIX: push the empty query through the suggestion
it.copy( // pipeline FIRST so the flatMapLatest collector re-emits every
isAddingTag = true, // existing tag (most-used first) while the sheet opens — the
tagInput = "", // old code just cleared the list to emptyList() here and the
tagSuggestions = emptyList(), // stuck collector never refilled it.
) tagInputFlow.value = ""
} _state.update { it.copy(isAddingTag = true, tagInput = "") }
} }
fun closeAddTagSheet() { fun closeAddTagSheet() {
_state.update { it.copy(isAddingTag = false, tagInput = "", tagSuggestions = emptyList()) } tagInputFlow.value = ""
_state.update { it.copy(isAddingTag = false, tagInput = "") }
} }
fun onTagInputChange(raw: String) { fun onTagInputChange(raw: String) {
@@ -330,6 +375,139 @@ class NoteEditorViewModel(
_state.update { it.copy(hashtags = it.hashtags.filterNot { tag -> tag == normalised }) } _state.update { it.copy(hashtags = it.hashtags.filterNot { tag -> tag == normalised }) }
} }
// ---- v0.3.8.0 task / shopping list editing ----
/**
* Keep the [NoteEditorUiState.items] / [NoteEditorUiState.listHeader]
* rows and the derived [NoteEditorUiState.content] in step, so the
* save path, dirty-check, search preview, and `canSave` gate all
* keep working off the single content string.
*/
private fun NoteEditorUiState.withListEdits(
header: String = this.listHeader,
items: List<ChecklistItem>,
): NoteEditorUiState = copy(
listHeader = header,
items = items,
content = Note.serializeListContent(header, items, type),
)
private fun List<ChecklistItem>.patched(
index: Int,
transform: (ChecklistItem) -> ChecklistItem,
): List<ChecklistItem> = mapIndexed { i, item ->
if (i == index) transform(item) else item
}
/**
* Convert the body to [target]; tapping the already-active mode
* converts back to [NoteType.TEXT]. Text moves losslessly between
* the plain editor and the checkbox serialisation — costs are only
* stored while the note is a shopping list (converting to a task
* list folds each cost back into the item text).
*/
fun convertTo(target: NoteType) {
_state.update { s ->
val next = if (s.type == target) NoteType.TEXT else target
if (next == NoteType.TEXT) {
// Content already holds the serialised `- [ ]` rows;
// just drop out of the structured editor (the inline
// GFM checklist rendering from v0.2.0.0 still applies).
s.copy(type = NoteType.TEXT, listHeader = "", items = emptyList())
} else {
val source = if (s.type == NoteType.TEXT) {
s.content
} else {
// Serialise through the FOLDED legacy form (plain
// "Milk 2 x 3.90" lines, never `{q…p…}` markers) so
// structured values survive the trip and re-parse
// cleanly under the target mode's rules.
Note.serializeListContent(s.listHeader, s.items, NoteType.TEXT)
}
val (header, parsedRaw) = Note.splitListContent(
source,
interpretCosts = next == NoteType.SHOPPING_LIST,
)
val parsed = if (parsedRaw.isEmpty()) listOf(ChecklistItem("")) else parsedRaw
s.copy(
type = next,
listHeader = header,
items = parsed,
content = Note.serializeListContent(header, parsed, next),
)
}
}
_state.update {
it.copy(
snackbar = when (it.type) {
NoteType.TASK_LIST -> "Task list mode — first line stays the title."
NoteType.SHOPPING_LIST -> "Shopping list mode — check an item once it's in your basket."
else -> "Back to plain text."
},
)
}
}
fun onHeaderChange(value: String) {
_state.update { it.withListEdits(header = value, items = it.items) }
}
fun addListItem() {
_state.update { s ->
if (s.type == NoteType.TEXT) return@update s
s.withListEdits(items = s.items + ChecklistItem(""))
}
}
fun removeListItem(index: Int) {
_state.update { s ->
if (index !in s.items.indices) return@update s
s.withListEdits(items = s.items.filterIndexed { i, _ -> i != index })
}
}
fun setItemChecked(index: Int, checked: Boolean) {
_state.update { s ->
if (index !in s.items.indices) return@update s
s.withListEdits(items = s.items.patched(index) { it.copy(checked = checked) })
}
}
fun setItemText(index: Int, text: String) {
_state.update { s ->
if (index !in s.items.indices) return@update s
s.withListEdits(items = s.items.patched(index) { it.copy(text = text) })
}
}
/**
* Price field input — POS style: everything is reduced to cents
* digits ("199" ⇒ $1.99, separators typed or pasted are stripped).
*/
fun setItemCost(index: Int, rawCost: String) {
val sanitized = Note.normalisePriceInput(rawCost)
_state.update { s ->
if (index !in s.items.indices) return@update s
s.withListEdits(items = s.items.patched(index) { it.copy(cost = sanitized) })
}
}
/**
* Quantity line input (free-text digits); blank means the default 1.
*
* v0.3.8.0: "1" now stays stored as "1" — the field is free text, so
* the typed digit must remain visible. The serialiser already omits
* `{q1}` and cards only show "×qty" when the quantity is > 1, so this
* is storage-neutral. "0" / blank normalise to "" (meaning 1).
*/
fun setItemQuantity(index: Int, rawQty: String) {
val stored = Note.normaliseQuantity(rawQty)
_state.update { s ->
if (index !in s.items.indices) return@update s
s.withListEdits(items = s.items.patched(index) { it.copy(quantity = stored) })
}
}
fun consumeSnackbar() { fun consumeSnackbar() {
_state.update { it.copy(snackbar = null) } _state.update { it.copy(snackbar = null) }
} }
@@ -419,12 +597,14 @@ class NoteEditorViewModel(
content = current.content, content = current.content,
isFavorite = current.isFavorite, isFavorite = current.isFavorite,
color = current.color, color = current.color,
type = current.type,
) ?: Note( ) ?: Note(
content = current.content, content = current.content,
createdAt = System.currentTimeMillis(), createdAt = System.currentTimeMillis(),
updatedAt = System.currentTimeMillis(), updatedAt = System.currentTimeMillis(),
isFavorite = current.isFavorite, isFavorite = current.isFavorite,
color = current.color, color = current.color,
type = current.type,
) )
val previous = baseNote?.hashtags.orEmpty().toSet() val previous = baseNote?.hashtags.orEmpty().toSet()
val currentSet = current.hashtags.toSet() val currentSet = current.hashtags.toSet()
@@ -456,7 +636,7 @@ class NoteEditorViewModel(
val id = _state.value.existing?.id ?: return val id = _state.value.existing?.id ?: return
_state.update { it.copy(isSaving = true) } _state.update { it.copy(isSaving = true) }
viewModelScope.launch { viewModelScope.launch {
repository.delete(id) repository.softDelete(id)
_state.update { it.copy(isSaving = false, isDeleted = true) } _state.update { it.copy(isSaving = false, isDeleted = true) }
onDone() onDone()
} }
@@ -27,12 +27,15 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.AttachFile import androidx.compose.material.icons.filled.AttachFile
import androidx.compose.material.icons.filled.CheckBox import androidx.compose.material.icons.filled.CheckBox
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Lock import androidx.compose.material.icons.filled.Lock
import androidx.compose.material.icons.filled.Menu import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.PhotoCamera 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.Search
import androidx.compose.material.icons.filled.ShoppingBasket
import androidx.compose.material.icons.filled.Star import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.outlined.StarOutline import androidx.compose.material.icons.outlined.StarOutline
import androidx.compose.material3.Card import androidx.compose.material3.Card
@@ -57,6 +60,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.asImageBitmap
@@ -72,6 +77,7 @@ import org.incido.domain.model.Note
import org.incido.domain.model.NoteAttachment import org.incido.domain.model.NoteAttachment
import org.incido.domain.model.NoteColor import org.incido.domain.model.NoteColor
import org.incido.domain.model.NoteFilter import org.incido.domain.model.NoteFilter
import org.incido.domain.model.NoteType
import org.incido.domain.repository.NoteRepository import org.incido.domain.repository.NoteRepository
/** /**
@@ -121,9 +127,18 @@ fun NoteListScreen(
) { ) {
val state by viewModel.uiState.collectAsStateWithLifecycle() val state by viewModel.uiState.collectAsStateWithLifecycle()
var localQuery by remember { mutableStateOf("") } var localQuery by remember { mutableStateOf("") }
val searchFocusRequester = remember { FocusRequester() }
LaunchedEffect(filterMode) { viewModel.setFilter(filterMode) } LaunchedEffect(filterMode) { viewModel.setFilter(filterMode) }
// Auto-focus the search field when it opens so typing can start
// immediately.
LaunchedEffect(state.isSearchActive) {
if (state.isSearchActive) {
runCatching { searchFocusRequester.requestFocus() }
}
}
Scaffold( Scaffold(
topBar = { topBar = {
CenterAlignedTopAppBar( CenterAlignedTopAppBar(
@@ -135,7 +150,7 @@ fun NoteListScreen(
}, },
actions = { actions = {
// v0.3.1.0: search is now context-aware on Home, // 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 // narrow by a single tag so the additional text
// query would be ambiguous. // query would be ambiguous.
if (filterMode !is NoteFilter.ByTag) { if (filterMode !is NoteFilter.ByTag) {
@@ -166,12 +181,25 @@ fun NoteListScreen(
localQuery = it localQuery = it
viewModel.onQueryChange(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) }, leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
trailingIcon = {
if (localQuery.isNotEmpty()) {
IconButton(onClick = {
localQuery = ""
viewModel.onQueryChange("")
}) {
Icon(Icons.Default.Close, contentDescription = "Clear search")
}
}
},
singleLine = true, singleLine = true,
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 8.dp), .padding(horizontal = 16.dp, vertical = 8.dp)
.focusRequester(searchFocusRequester),
) )
} }
@@ -182,7 +210,15 @@ fun NoteListScreen(
else -> NoteList( else -> NoteList(
notes = state.notes, notes = state.notes,
onClick = { onOpenEditor(it.id) }, 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, onToggleFavorite = viewModel::toggleFavorite,
repository = repository, repository = repository,
// v0.3.5.0: ONLY notes whose ciphertext passed the // v0.3.5.0: ONLY notes whose ciphertext passed the
@@ -198,6 +234,7 @@ private fun screenTitle(filter: NoteFilter): String = when (filter) {
NoteFilter.Home -> "Incido" NoteFilter.Home -> "Incido"
NoteFilter.Favorites -> "Favorites" NoteFilter.Favorites -> "Favorites"
NoteFilter.Untagged -> "Untagged" NoteFilter.Untagged -> "Untagged"
NoteFilter.Trash -> "Trash"
is NoteFilter.ByTag -> "#${filter.hashtag}" is NoteFilter.ByTag -> "#${filter.hashtag}"
} }
@@ -207,6 +244,7 @@ private fun EmptyState(filterMode: NoteFilter) {
NoteFilter.Home -> "No notes yet. Tap + to start." NoteFilter.Home -> "No notes yet. Tap + to start."
NoteFilter.Favorites -> "No favourites yet. Tap ⭐ on a card to add one." NoteFilter.Favorites -> "No favourites yet. Tap ⭐ on a card to add one."
NoteFilter.Untagged -> "All notes are tagged. 🎉" NoteFilter.Untagged -> "All notes are tagged. 🎉"
NoteFilter.Trash -> "Trash is empty."
is NoteFilter.ByTag -> "No notes tagged #${filterMode.hashtag} yet." is NoteFilter.ByTag -> "No notes tagged #${filterMode.hashtag} yet."
} }
Box( Box(
@@ -227,6 +265,7 @@ private fun EmptyState(filterMode: NoteFilter) {
private fun NoResultsState(filterMode: NoteFilter) { private fun NoResultsState(filterMode: NoteFilter) {
val message = when (filterMode) { val message = when (filterMode) {
NoteFilter.Home -> "No matching notes." NoteFilter.Home -> "No matching notes."
NoteFilter.Trash -> "No notes in Trash match your search."
else -> "Nothing here." else -> "Nothing here."
} }
Box( Box(
@@ -248,6 +287,8 @@ private fun NoteList(
notes: List<Note>, notes: List<Note>,
onClick: (Note) -> Unit, onClick: (Note) -> Unit,
onDelete: (Long) -> Unit, onDelete: (Long) -> Unit,
onRestore: (Long) -> Unit,
isTrash: Boolean,
onToggleFavorite: (Long, Boolean) -> Unit, onToggleFavorite: (Long, Boolean) -> Unit,
/** v0.3.1.0 — threaded through to [NoteCard] for thumbnail loading. */ /** v0.3.1.0 — threaded through to [NoteCard] for thumbnail loading. */
repository: NoteRepository?, repository: NoteRepository?,
@@ -271,8 +312,10 @@ private fun NoteList(
items(items = notes, key = { it.id }) { note -> items(items = notes, key = { it.id }) { note ->
NoteCard( NoteCard(
note = note, note = note,
onClick = { onClick(note) }, onClick = { if (!isTrash) onClick(note) },
onDelete = { onDelete(note.id) }, onDelete = { onDelete(note.id) },
onRestore = { onRestore(note.id) },
isTrash = isTrash,
onToggleFavorite = { onToggleFavorite(note.id, !note.isFavorite) }, onToggleFavorite = { onToggleFavorite(note.id, !note.isFavorite) },
repository = repository, repository = repository,
showEncryptionBadge = note.id in verifiedEncryptedIds, showEncryptionBadge = note.id in verifiedEncryptedIds,
@@ -293,10 +336,9 @@ private fun NoteList(
* *
* v0.3.3.0: * v0.3.3.0:
* - The bottom-right delete `IconButton` is gone. * - The bottom-right delete `IconButton` is gone.
* - A long-press anywhere on the card opens a `DropdownMenu` * - A long-press anywhere on the card opens a `DropdownMenu` anchored on
* anchored on the card itself, with a "Delete" entry as the first * the card itself. Active cards offer "Delete"; Trash cards offer
* item. The menu is designed to grow (Share, etc.) — additional * "Restore" and permanent "Delete" without opening the editor.
* entries are added as `DropdownMenuItem`s.
* - Card now uses `Modifier.combinedClickable` for click + long-click. * - Card now uses `Modifier.combinedClickable` for click + long-click.
* *
* v0.3.3.5: * v0.3.3.5:
@@ -330,6 +372,8 @@ private fun NoteCard(
note: Note, note: Note,
onClick: () -> Unit, onClick: () -> Unit,
onDelete: () -> Unit, onDelete: () -> Unit,
onRestore: () -> Unit,
isTrash: Boolean,
onToggleFavorite: () -> Unit, onToggleFavorite: () -> Unit,
/** v0.3.1.0 — used to load the first image attachment as a /** v0.3.1.0 — used to load the first image attachment as a
* thumbnail background. Null disables the feature (still works). */ * thumbnail background. Null disables the feature (still works). */
@@ -346,7 +390,11 @@ private fun NoteCard(
*/ */
showEncryptionBadge: Boolean = false, showEncryptionBadge: Boolean = false,
) { ) {
val (title, body) = Note.titleAndBody(note.content) // v0.3.8.0: task / shopping lists render marker-free on cards —
// header line becomes the title, items show as clean "Name ×qty @$X"
// text. The checkbox state lives in the summary row below instead.
val (title, body) = if (note.type == NoteType.TEXT) Note.titleAndBody(note.content)
else Note.cardPresentation(note.content, note.type)
val bodyPreview = Note.bodyPreview(body) val bodyPreview = Note.bodyPreview(body)
val checklistSummary = Note.checklistSummary(note.content) val checklistSummary = Note.checklistSummary(note.content)
val noteColor = note.color val noteColor = note.color
@@ -482,7 +530,11 @@ private fun NoteCard(
Spacer(modifier = Modifier.padding(top = 4.dp)) Spacer(modifier = Modifier.padding(top = 4.dp))
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
Icon( Icon(
Icons.Default.CheckBox, // v0.3.8.0: shopping lists carry a basket
// on the card instead of the plain check box.
imageVector = if (note.type == NoteType.SHOPPING_LIST)
Icons.Default.ShoppingBasket
else Icons.Default.CheckBox,
contentDescription = null, contentDescription = null,
modifier = Modifier.size(14.dp), modifier = Modifier.size(14.dp),
tint = secondaryColor, tint = secondaryColor,
@@ -569,8 +621,23 @@ private fun NoteCard(
expanded = showMenu, expanded = showMenu,
onDismissRequest = { showMenu = false }, onDismissRequest = { showMenu = false },
) { ) {
if (isTrash) {
DropdownMenuItem(
text = { Text("Restore") },
leadingIcon = {
Icon(
Icons.Filled.Restore,
contentDescription = null,
)
},
onClick = {
showMenu = false
onRestore()
},
)
}
DropdownMenuItem( DropdownMenuItem(
text = { Text("Delete") }, text = { Text(if (isTrash) "Delete permanently" else "Delete") },
leadingIcon = { leadingIcon = {
Icon( Icon(
Icons.Filled.Delete, Icons.Filled.Delete,
@@ -599,14 +666,16 @@ private fun NoteCard(
// Hotfix: favorite star moved from the title row to the // Hotfix: favorite star moved from the title row to the
// bottom-right corner, vertically aligned with the // bottom-right corner, vertically aligned with the
// three-dot overflow button above. // three-dot overflow button above.
Box(modifier = Modifier.align(Alignment.BottomEnd).padding(end = 4.dp, bottom = 4.dp)) { if (!isTrash) {
IconButton(onClick = onToggleFavorite) { Box(modifier = Modifier.align(Alignment.BottomEnd).padding(end = 4.dp, bottom = 4.dp)) {
Icon( IconButton(onClick = onToggleFavorite) {
imageVector = if (note.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline, Icon(
contentDescription = if (note.isFavorite) "Unfavorite" else "Favorite", imageVector = if (note.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline,
tint = if (note.isFavorite) favoriteActiveColor contentDescription = if (note.isFavorite) "Unfavorite" else "Favorite",
else secondaryColor, tint = if (note.isFavorite) favoriteActiveColor
) else secondaryColor,
)
}
} }
} }
@@ -42,7 +42,9 @@ data class NoteListUiState(
/** Encrypted rows that FAILED verification (corrupted / wrong key). */ /** Encrypted rows that FAILED verification (corrupted / wrong key). */
val unverifiedEncryptedNoteCount: Int = 0, 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 val noResults: Boolean get() = !isLoading && notes.isEmpty() && !isEmpty
} }
@@ -60,17 +62,18 @@ class NoteListViewModel(
/** Notes stream — switches on (filter, query) so the same ViewModel /** Notes stream — switches on (filter, query) so the same ViewModel
* instance handles Home, Favorites, Untagged, ByTag, and search. * instance handles Home, Favorites, Untagged, ByTag, and search.
* *
* v0.3.1.0: search is now **context-aware** — on Favorites or * v0.3.1.0: search is now **context-aware** — on Favorites,
* Untagged, the typed query is intersected with the active filter * Untagged, and Trash, the typed query is intersected with the
* (only favourites / only untagged) rather than ignored. On Home, * active filter rather than ignored. On Home, search spans all
* search spans everything. ByTag keeps the same behaviour (the * active notes. ByTag keeps the same behaviour (the tag itself is
* tag itself is already the filter). */ * already the filter). */
private val notesFlow = combine(filterMode, rawQuery) { f, q -> f to q } private val notesFlow = combine(filterMode, rawQuery) { f, q -> f to q }
.flatMapLatest { (f, q) -> .flatMapLatest { (f, q) ->
when (f) { when (f) {
NoteFilter.Home -> if (q.isBlank()) repository.observeAll() else repository.search(q) NoteFilter.Home -> if (q.isBlank()) repository.observeAll() else repository.search(q)
NoteFilter.Favorites -> if (q.isBlank()) repository.observeFavorites() else repository.searchFavorites(q) NoteFilter.Favorites -> if (q.isBlank()) repository.observeFavorites() else repository.searchFavorites(q)
NoteFilter.Untagged -> if (q.isBlank()) repository.observeUntagged() else repository.searchUntagged(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) is NoteFilter.ByTag -> repository.observeNotesForHashtag(f.hashtag)
} }
} }
@@ -143,10 +146,21 @@ class NoteListViewModel(
rawQuery.value = "" 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) } 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) { fun toggleFavorite(id: Long, isFavorite: Boolean) {
viewModelScope.launch { repository.setFavorite(id, isFavorite) } viewModelScope.launch { repository.setFavorite(id, isFavorite) }
} }
@@ -333,7 +333,7 @@ class SettingsViewModel(
/** The version string baked into backup payloads and shown on /** The version string baked into backup payloads and shown on
* the About card. Mirrors `app/build.gradle.kts` `versionName` * the About card. Mirrors `app/build.gradle.kts` `versionName`
* — if you bump one, bump both. */ * — if you bump one, bump both. */
const val APP_VERSION = "0.3.6.3" const val APP_VERSION = "0.3.8.0"
val Factory: ViewModelProvider.Factory = viewModelFactory { val Factory: ViewModelProvider.Factory = viewModelFactory {
initializer { initializer {
@@ -5,6 +5,7 @@ import io.objectbox.annotation.Id
import io.objectbox.annotation.Index import io.objectbox.annotation.Index
import org.incido.domain.model.Note import org.incido.domain.model.Note
import org.incido.domain.model.NoteColor import org.incido.domain.model.NoteColor
import org.incido.domain.model.NoteType
/** /**
* ObjectBox entity. The plugin generates a corresponding property mirror * ObjectBox entity. The plugin generates a corresponding property mirror
@@ -20,6 +21,11 @@ import org.incido.domain.model.NoteColor
* existing stores auto-migrate. The repository transparently * existing stores auto-migrate. The repository transparently
* encrypts/decrypts on write/read when a [org.incido.data.crypto.FieldCipher] * encrypts/decrypts on write/read when a [org.incido.data.crypto.FieldCipher]
* is supplied. * is supplied.
*
* v0.3.8.0 — [typeKey] records the note editor mode
* ([org.incido.domain.model.NoteType]: 0 text, 1 task list, 2 shopping
* list). Additive column — existing stores auto-migrate and old rows
* default to plain text.
*/ */
@Entity @Entity
data class NoteEntity( data class NoteEntity(
@@ -33,6 +39,10 @@ data class NoteEntity(
var cipherVersion: Int = 0, var cipherVersion: Int = 0,
/** Encrypted payload: `nonce (12) | ciphertext + GCM tag`. Empty when plaintext. */ /** Encrypted payload: `nonce (12) | ciphertext + GCM tag`. Empty when plaintext. */
var contentBlob: ByteArray = ByteArray(0), 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,
/** v0.3.8.0 — [org.incido.domain.model.NoteType] storage key (0 text, 1 task, 2 shopping). */
var typeKey: Short = 0,
) { ) {
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true
@@ -43,8 +53,10 @@ data class NoteEntity(
if (updatedAt != other.updatedAt) return false if (updatedAt != other.updatedAt) return false
if (isFavorite != other.isFavorite) return false if (isFavorite != other.isFavorite) return false
if (colorKey != other.colorKey) return false if (colorKey != other.colorKey) return false
if (isTrashed != other.isTrashed) return false
if (cipherVersion != other.cipherVersion) return false if (cipherVersion != other.cipherVersion) return false
if (!contentBlob.contentEquals(other.contentBlob)) return false if (!contentBlob.contentEquals(other.contentBlob)) return false
if (typeKey != other.typeKey) return false
return true return true
} }
@@ -55,8 +67,10 @@ data class NoteEntity(
result = 31 * result + updatedAt.hashCode() result = 31 * result + updatedAt.hashCode()
result = 31 * result + isFavorite.hashCode() result = 31 * result + isFavorite.hashCode()
result = 31 * result + colorKey.hashCode() result = 31 * result + colorKey.hashCode()
result = 31 * result + isTrashed.hashCode()
result = 31 * result + cipherVersion.hashCode() result = 31 * result + cipherVersion.hashCode()
result = 31 * result + contentBlob.contentHashCode() result = 31 * result + contentBlob.contentHashCode()
result = 31 * result + typeKey.hashCode()
return result return result
} }
} }
@@ -68,6 +82,8 @@ internal fun NoteEntity.toDomain(): Note = Note(
updatedAt = updatedAt, updatedAt = updatedAt,
isFavorite = isFavorite, isFavorite = isFavorite,
color = NoteColor.fromStorageKey(colorKey), color = NoteColor.fromStorageKey(colorKey),
isTrashed = isTrashed,
type = NoteType.fromStorageKey(typeKey),
) )
internal fun Note.toEntity(): NoteEntity = NoteEntity( internal fun Note.toEntity(): NoteEntity = NoteEntity(
@@ -77,4 +93,6 @@ internal fun Note.toEntity(): NoteEntity = NoteEntity(
updatedAt = updatedAt, updatedAt = updatedAt,
isFavorite = isFavorite, isFavorite = isFavorite,
colorKey = color.storageKey, colorKey = color.storageKey,
isTrashed = isTrashed,
typeKey = type.storageKey,
) )
@@ -34,6 +34,7 @@ import org.incido.domain.model.Hashtag
import org.incido.domain.model.HashtagUsage import org.incido.domain.model.HashtagUsage
import org.incido.domain.model.Note import org.incido.domain.model.Note
import org.incido.domain.model.NoteAttachment import org.incido.domain.model.NoteAttachment
import org.incido.domain.model.NoteType
import org.incido.domain.repository.NoteRepository import org.incido.domain.repository.NoteRepository
/** /**
@@ -82,6 +83,14 @@ class NoteRepositoryImpl(
awaitClose { sub.cancel() } awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default) }.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 { override fun search(query: String): Flow<List<Note>> = callbackFlow {
trySend(snapshotSearch(query)) trySend(snapshotSearch(query))
val sub = noteBox.query().build().subscribe().observer { trySend(snapshotSearch(query)) } val sub = noteBox.query().build().subscribe().observer { trySend(snapshotSearch(query)) }
@@ -100,6 +109,16 @@ class NoteRepositoryImpl(
awaitClose { sub.cancel() } awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default) }.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 { override fun observeNotesForHashtag(name: String): Flow<List<Note>> = callbackFlow {
trySend(snapshotForHashtag(name)) trySend(snapshotForHashtag(name))
val sub = noteBox.query().build().subscribe().observer { trySend(snapshotForHashtag(name)) } val sub = noteBox.query().build().subscribe().observer { trySend(snapshotForHashtag(name)) }
@@ -118,6 +137,12 @@ class NoteRepositoryImpl(
awaitClose { sub.cancel() } awaitClose { sub.cancel() }
}.flowOn(Dispatchers.Default) }.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 { override fun observeHashtagsByRecentUse(): Flow<List<HashtagUsage>> = callbackFlow {
// The snapshot reads from noteBox + xrefBox + tagBox, so we must // The snapshot reads from noteBox + xrefBox + tagBox, so we must
// subscribe to ALL three — otherwise a change that only touches // subscribe to ALL three — otherwise a change that only touches
@@ -285,19 +310,75 @@ class NoteRepositoryImpl(
* query cannot see ciphertext, so when encryption is active we * query cannot see ciphertext, so when encryption is active we
* decrypt and filter in-memory (fine at notes-app scale). Hashtag * decrypt and filter in-memory (fine at notes-app scale). Hashtag
* matching is unaffected — tag names stay plaintext. * 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> { private fun contentMatchingNoteIds(
if (fieldCipher == null) { query: String,
return noteBox.query() includeTrashed: Boolean = false,
.contains(NoteEntity_.content, query, QueryBuilder.StringOrder.CASE_INSENSITIVE) ): 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() .build()
.find() .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 } .map { it.id }
} }
val needle = query.lowercase()
return noteBox.all return (contentMatches + tagMatches).toSet()
.filter { toReadable(it).content.lowercase().contains(needle) }
.map { it.id }
} }
/** /**
@@ -372,6 +453,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) { override suspend fun setFavorite(id: Long, isFavorite: Boolean) {
val entity = noteBox.get(id) ?: return val entity = noteBox.get(id) ?: return
if (entity.isFavorite == isFavorite) return if (entity.isFavorite == isFavorite) return
@@ -500,14 +600,19 @@ class NoteRepositoryImpl(
.mapValues { (_, rows) -> rows.sortedBy { it.createdAt } } .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 tags = hashtagsByNoteId()
val attachments = attachmentsByNoteId() val attachments = attachmentsByNoteId()
return entities.sortedWith( return entities
compareByDescending<NoteEntity> { it.isFavorite } .filter { includeTrashed == null || it.isTrashed == includeTrashed }
.thenByDescending { it.updatedAt } .sortedWith(
).map { e -> compareByDescending<NoteEntity> { it.isFavorite }
val base = toReadable(e).toDomain() .thenByDescending { it.updatedAt },
).map { e ->
val base = toReadable(e).toDomain().withHealedListType()
base.copy( base.copy(
hashtags = tags[e.id].orEmpty(), hashtags = tags[e.id].orEmpty(),
attachments = attachments[e.id].orEmpty(), attachments = attachments[e.id].orEmpty(),
@@ -515,31 +620,26 @@ class NoteRepositoryImpl(
} }
} }
/**
* v0.3.8.0 FIX — notes whose bodies ARE checklist lines but which
* persisted with `typeKey = 0` (written by a build predating the
* column, or by a partial save of the list feature) would render as
* raw `- [ ] …` markdown on cards and open in the plain editor.
* Infer the list type from the content itself at READ time; the next
* save from the editor then persists the healed `typeKey` for good.
* TEXT notes containing only occasional hand-typed `- [ ]` lines in
* prose are left untouched (see [Note.inferListType]).
*/
private fun Note.withHealedListType(): Note =
if (type != NoteType.TEXT) this
else Note.inferListType(content)?.let { copy(type = it) } ?: this
private fun snapshotAll(): List<Note> = decorate(noteBox.all) 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> { private fun snapshotSearch(query: String): List<Note> {
val q = query.trim() val allIds = matchingNoteIds(query, includeTrashed = false)
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()
if (allIds.isEmpty()) return emptyList() if (allIds.isEmpty()) return emptyList()
val entities: List<NoteEntity> = allIds.mapNotNull { noteBox.get(it) } val entities: List<NoteEntity> = allIds.mapNotNull { noteBox.get(it) }
return decorate(entities) return decorate(entities)
@@ -553,9 +653,23 @@ class NoteRepositoryImpl(
return decorate(favEntities) 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> { private fun snapshotUntagged(): List<Note> {
val noteIdsWithTags: Set<Long> = xrefBox.all.map { it.noteId }.toSet() val activeIds = activeNoteIds()
val untaggedEntities: List<NoteEntity> = noteBox.all.filter { it.id !in noteIdsWithTags } 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) return decorate(untaggedEntities)
} }
@@ -568,13 +682,23 @@ class NoteRepositoryImpl(
private fun snapshotFavoritesSearch(query: String): List<Note> { private fun snapshotFavoritesSearch(query: String): List<Note> {
val q = query.trim() val q = query.trim()
if (q.isEmpty()) return snapshotFavorites() if (q.isEmpty()) return snapshotFavorites()
val allIds: Set<Long> = snapshotSearchMatchingNoteIds(q) val allIds: Set<Long> = matchingNoteIds(q, includeTrashed = false)
if (allIds.isEmpty()) return emptyList() if (allIds.isEmpty()) return emptyList()
val entities: List<NoteEntity> = allIds.mapNotNull { id -> noteBox.get(id) } val entities: List<NoteEntity> = allIds.mapNotNull { id -> noteBox.get(id) }
.filter { it.isFavorite } .filter { it.isFavorite }
return decorate(entities) 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] * Context-aware search across untagged notes only. Blank [query]
* degrades to [snapshotUntagged]. Otherwise runs the content * degrades to [snapshotUntagged]. Otherwise runs the content
@@ -584,38 +708,18 @@ class NoteRepositoryImpl(
private fun snapshotUntaggedSearch(query: String): List<Note> { private fun snapshotUntaggedSearch(query: String): List<Note> {
val q = query.trim() val q = query.trim()
if (q.isEmpty()) return snapshotUntagged() if (q.isEmpty()) return snapshotUntagged()
val noteIdsWithTags: Set<Long> = xrefBox.all.mapTo(HashSet(xrefBox.all.size)) { it.noteId } val activeIds = activeNoteIds()
val contentMatches: List<Long> = contentMatchingNoteIds(q) 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 val matching: List<NoteEntity> = contentMatches
.mapNotNull { id -> noteBox.get(id) } .mapNotNull { id -> noteBox.get(id) }
.filter { it.id !in noteIdsWithTags } .filter { it.id in activeIds && it.id !in noteIdsWithTags }
return decorate(matching) 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> { private fun snapshotForHashtag(name: String): List<Note> {
val normalised = Hashtag.normalise(name) val normalised = Hashtag.normalise(name)
val tag: HashtagEntity = tagBox.query() val tag: HashtagEntity = tagBox.query()
@@ -626,7 +730,10 @@ class NoteRepositoryImpl(
.equal(NoteHashtagCrossRef_.hashtagId, tag.id) .equal(NoteHashtagCrossRef_.hashtagId, tag.id)
.build() .build()
.find() .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() if (noteIds.isEmpty()) return emptyList()
val entities: List<NoteEntity> = noteIds.mapNotNull { noteBox.get(it) } val entities: List<NoteEntity> = noteIds.mapNotNull { noteBox.get(it) }
return decorate(entities) return decorate(entities)
@@ -636,7 +743,7 @@ class NoteRepositoryImpl(
val entity = noteBox.get(id) ?: return null val entity = noteBox.get(id) ?: return null
val tags = hashtagsByNoteId()[id].orEmpty() val tags = hashtagsByNoteId()[id].orEmpty()
val attachments = attachmentsByNoteId()[id].orEmpty() val attachments = attachmentsByNoteId()[id].orEmpty()
return toReadable(entity).toDomain().copy( return toReadable(entity).toDomain().withHealedListType().copy(
hashtags = tags, hashtags = tags,
attachments = attachments, attachments = attachments,
) )
@@ -644,7 +751,9 @@ class NoteRepositoryImpl(
/** Build [HashtagUsage] for every distinct tag, sorted by lastUsedAt DESC. */ /** Build [HashtagUsage] for every distinct tag, sorted by lastUsedAt DESC. */
private fun hashtagUsageSnapshot(): List<HashtagUsage> { private fun hashtagUsageSnapshot(): List<HashtagUsage> {
val activeIds = activeNoteIds()
val xrefs: List<NoteHashtagCrossRef> = xrefBox.all val xrefs: List<NoteHashtagCrossRef> = xrefBox.all
.filter { it.noteId in activeIds }
if (xrefs.isEmpty()) return emptyList() if (xrefs.isEmpty()) return emptyList()
// 1) Batch-load each unique noteId once (was once per xref, which // 1) Batch-load each unique noteId once (was once per xref, which
@@ -687,8 +796,12 @@ class NoteRepositoryImpl(
) )
} }
private fun allHashtagsSnapshot(): List<String> = private fun allHashtagsSnapshot(): List<String> {
tagBox.all.map { it.name } val activeTagIds = activeTagIds()
return tagBox.all
.filter { it.id in activeTagIds }
.map { it.name }
}
private fun searchHashtagsSnapshot(prefix: String): List<String> { private fun searchHashtagsSnapshot(prefix: String): List<String> {
val p = prefix.trim() val p = prefix.trim()
@@ -699,9 +812,17 @@ class NoteRepositoryImpl(
.build() .build()
.find() .find()
// Sort by usage count (most-used first), then name. // Trashed notes must not contribute to autocomplete suggestions.
val usageById: Map<Long, Int> = xrefBox.all.groupingBy { it.hashtagId }.eachCount() val activeTagIds = activeTagIds()
return byPrefix 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( .sortedWith(
compareByDescending<HashtagEntity> { usageById[it.id] ?: 0 } compareByDescending<HashtagEntity> { usageById[it.id] ?: 0 }
.thenBy { it.name } .thenBy { it.name }
@@ -0,0 +1,27 @@
package org.incido.domain.model
/**
* v0.3.8.0 — one row of a [NoteType.TASK_LIST] / [NoteType.SHOPPING_LIST]
* note while it is being edited. Rows live in the editor's UI state and
* are serialised back into `- [ ]` / `- [x]` content lines on every edit
* (see [Note.serializeListContent] / [Note.splitListContent]).
*/
data class ChecklistItem(
/** Item label; blank rows are skipped when serialising. */
val text: String,
/** Checkbox state — for shopping lists: "in the basket". */
val checked: Boolean = false,
/**
* Quantity as typed/picked (`""` = 1). Only meaningful for
* [NoteType.SHOPPING_LIST]; shopping rows offer a 1–9 picker so
* this stays tiny, but the parser accepts any small positive int.
*/
val quantity: String = "",
/**
* Price as entered, in CENTS DIGITS (`""` = none, `"199"` = $1.99 —
* supermarket-terminal style where the last two digits are cents).
* Only meaningful for [NoteType.SHOPPING_LIST]. Money maths runs
* on these integers so there is never binary-float drift.
*/
val cost: String = "",
)
@@ -22,6 +22,10 @@ data class Note(
* so the UI can render them in stable order. * so the UI can render them in stable order.
*/ */
val attachments: List<NoteAttachment> = emptyList(), val attachments: List<NoteAttachment> = emptyList(),
/** True only for notes moved to the Trash view; active-note queries exclude these rows. */
val isTrashed: Boolean = false,
/** v0.3.8.0 — which editor surface opens this note (see [NoteType]). */
val type: NoteType = NoteType.TEXT,
) { ) {
/** Convenience: the first image attachment, or `null` if none. */ /** Convenience: the first image attachment, or `null` if none. */
val firstImageAttachment: NoteAttachment? val firstImageAttachment: NoteAttachment?
@@ -105,5 +109,326 @@ data class Note(
else -> "$open open · $done done" else -> "$open open · $done done"
} }
} }
// -----------------------------------------------------------------
// v0.3.8.0 — task / shopping list parsing + serialisation.
//
// A list note's content is an optional header block (the title /
// preamble kept as plain lines) followed by GitHub-style checkbox
// lines. Shopping-list rows carry quantity + per-item price in an
// explicit end-of-line marker so the PRODUCT TEXT IS NEVER
// SCANNED FOR NUMBERS (a product called "Battery AA 3" or
// "Poster 50 x 60" is safe):
//
// - [ ] Milk no qty / price yet
// - [ ] Ham {p12.99} price only (qty 1)
// - [ ] Eggs {q12 p2.40} 12 × $2.40
//
// Hand-typed / legacy lines stay importable (Development Plan
// §6.1's trailing-numeric-token idea): `Milk 3.50` reads as a
// price, `Eggs 12 x 2.40` as qty × price. Those forms survive in
// task lists, where each row is just `- [ ] <text>`.
// -----------------------------------------------------------------
private val CHECKLIST_LINE: Regex = Regex("""^\s*-\s+\[([ xX])]\s*(.*)$""")
/** `Product {q12 p2.40}` / `{p2.40}` / `{q12}` (anchored, greedy-safe). */
private val BRACED_QP: Regex =
Regex("""^(.*?)\s*\{\s*(?:q(\d{1,3}))?\s*(?:p([\d.,]{1,12}))?\s*\}$""")
/** Legacy: `Product 12 x 2.40` (also `12x2.40`, `×`). A decimal on
* the price keeps lookalikes like "Poster 50 x 60" as plain text. */
private val LEGACY_QTY_PRICE: Regex =
Regex("""^(.+?)\s+(\d{1,3})\s*[xX×]\s*(\d{1,9}[.,]\d{1,2})$""")
/** Legacy (§6.1): `Product 3.50`. Decimal point REQUIRED, so a
* product named "Battery AA 3" is never mistaken for a price. */
private val TRAILING_COST: Regex = Regex("""^(.*\S)\s+(\d{1,9}[.,]\d{1,2})$""")
private val COST_PATTERN: Regex = Regex("""\d{1,9}(?:\.\d{1,2})?""")
/**
* Canonicalise a raw monetary amount token: trims, accepts `,` as
* decimal separator, tolerates a trailing `.` mid-typing, and
* returns `""` for anything that isn't a plain positive number
* with at most two decimals.
*/
fun normaliseCost(raw: String): String {
val trimmed = raw.trim().replace(',', '.')
if (trimmed.isEmpty()) return ""
val candidate = if (trimmed.endsWith(".")) trimmed.dropLast(1) else trimmed
return if (candidate.matches(COST_PATTERN)) candidate else ""
}
/**
* Convert a canonical amount ("2.40", "5", "0.05") into CENTS
* DIGITS ("240", "500", "5"). Returns `""` for invalid input.
*/
fun priceDigitsFromAmount(amount: String): String {
val canonical = normaliseCost(amount)
if (canonical.isEmpty()) return ""
val parts = canonical.split('.')
val units = parts[0].toLongOrNull() ?: return ""
val cents = if (parts.size > 1) parts[1].padEnd(2, '0').toLongOrNull() ?: return "" else 0L
val total = units * 100 + cents
if (total <= 0L) return ""
return total.toString()
}
/** Inverse: cents digits ("199") → canonical amount ("1.99"); "" → "". */
fun amountFromPriceDigits(digits: String): String {
val clean = digits.filter { it.isDigit() }.trimStart('0')
if (clean.isEmpty()) return ""
return clean.padStart(3, '0').let { "${it.dropLast(2)}.${it.takeLast(2)}" }
}
/** Digit-only normalisation of the quantity picker/keypad input. */
fun normaliseQuantity(raw: String): String =
raw.filter { it.isDigit() }.take(3).trimStart('0')
/** Digit-only normalisation of the price input ("2.4" → "24"). */
fun normalisePriceInput(raw: String): String =
raw.filter { it.isDigit() }.take(9).trimStart('0')
/** Numeric quantity of a row (blank ⇒ 1). */
fun quantityOf(item: ChecklistItem): Int =
item.quantity.toIntOrNull()?.coerceIn(1, 999) ?: 1
/** Per-line total in cents: quantity × unit price. */
fun lineTotalCents(item: ChecklistItem): Long =
quantityOf(item) * (item.cost.toLongOrNull() ?: 0L)
/**
* Split [content] into (header, items) for the structured list
* editors.
*
* When marker lines (`- [ ] …`) exist, the header is everything
* before the first one and every marker line becomes an item;
* other non-blank lines below the first marker become unchecked
* items so nothing is silently dropped. Without any marker line
* (a plain note being converted), the first non-blank line is
* kept as the title/header and the remaining non-blank lines
* become unchecked items.
*
* [interpretCosts] (shopping lists only) strips a trailing
* numeric token off each item text into [ChecklistItem.cost].
*/
fun splitListContent(
content: String,
interpretCosts: Boolean,
): Pair<String, List<ChecklistItem>> {
val lines = content.split('\n')
val firstMarker = lines.indexOfFirst { CHECKLIST_LINE.matches(it) }
val headerLines: List<String>
val itemLines: List<String>
if (firstMarker >= 0) {
headerLines = lines.take(firstMarker)
itemLines = lines.drop(firstMarker)
} else {
val titleIdx = lines.indexOfFirst { it.isNotBlank() }
headerLines = if (titleIdx >= 0) listOf(lines[titleIdx]) else emptyList()
itemLines = if (titleIdx >= 0) lines.drop(titleIdx + 1) else lines
}
val items = itemLines
.filter { it.isNotBlank() }
.map { line ->
val match = CHECKLIST_LINE.matchEntire(line)
var text: String
val checked: Boolean
if (match != null) {
checked = match.groupValues[1].equals("x", ignoreCase = true)
text = match.groupValues[2].trim()
} else {
checked = false
text = line.trim()
}
var quantity = ""
var cost = "" // cents digits
if (interpretCosts) {
val braced = BRACED_QP.matchEntire(text)
val legacyQtyPrice = if (braced == null) LEGACY_QTY_PRICE.matchEntire(text) else null
val legacyPrice = if (braced == null && legacyQtyPrice == null)
TRAILING_COST.matchEntire(text) else null
when {
braced != null -> {
// Structured form: everything before the
// marker is PRODUCT TEXT, unexamined.
val q = parsedQuantity(braced.groupValues[2])
val p = parsedPrice(braced.groupValues[3])
if (q.isEmpty() && p.isEmpty()) {
// "{}" or invalid slots — not a marker after all.
} else {
text = braced.groupValues[1].trim()
quantity = q
cost = p
}
}
legacyQtyPrice != null -> {
text = legacyQtyPrice.groupValues[1].trim()
quantity = parsedQuantity(legacyQtyPrice.groupValues[2])
cost = parsedPrice(legacyQtyPrice.groupValues[3])
}
legacyPrice != null -> {
text = legacyPrice.groupValues[1].trim()
cost = parsedPrice(legacyPrice.groupValues[2])
}
}
}
ChecklistItem(text = text, checked = checked, quantity = quantity, cost = cost)
}
return headerLines.joinToString("\n").trim() to items
}
/** Normalise a parsed quantity token (blank / 1 ⇒ default ""). */
private fun parsedQuantity(raw: String): String {
val n = normaliseQuantity(raw)
return if (n == "1" || n.isEmpty()) "" else n
}
/** Normalise a parsed amount token into cents digits. */
private fun parsedPrice(raw: String): String = priceDigitsFromAmount(raw)
/**
* Inverse of [splitListContent]: rebuild the note content from a
* header + item rows. Blank rows are skipped. Shopping rows
* serialise quantity + price into the `{q… p…}` marker (qty 1 is
* omitted); converting BACK to a task list folds the values into
* legacy text tokens (`Milk 2 x 3.90`) so they survive a
* round-trip through plain-text mode.
*/
fun serializeListContent(
header: String,
items: List<ChecklistItem>,
type: NoteType,
): String {
val isShopping = type == NoteType.SHOPPING_LIST
val bodyLines = items.mapNotNull { item ->
val amount = amountFromPriceDigits(item.cost)
// v0.3.8.0 FIX: parsedQuantity folds the default (1) to
// "" — a plain String, never null. Without takeIf, the
// shopping branch emitted a bare "q" slot (broken
// "{q p1.23}" markers) and the task branch folded a
// stray " x" onto every row. Null means "no quantity".
val qtyDigits = parsedQuantity(item.quantity).takeIf { it.isNotEmpty() }
val rawText = item.text.trim()
val rowText: String
if (isShopping) {
val slots = listOfNotNull(
qtyDigits?.let { "q$it" },
amount.ifEmpty { null }?.let { "p$it" },
)
rowText = if (slots.isEmpty()) rawText
else "$rawText {${slots.joinToString(" ")}}"
} else {
// Task list: fold structured values back into text so
// switching modes never silently drops them.
rowText = when {
rawText.isEmpty() && qtyDigits != null && amount.isNotEmpty() ->
"$qtyDigits x $amount"
rawText.isEmpty() && amount.isNotEmpty() -> amount
qtyDigits != null && amount.isNotEmpty() -> "$rawText $qtyDigits x $amount"
qtyDigits != null -> "$rawText $qtyDigits x"
amount.isNotEmpty() -> "$rawText $amount"
else -> rawText
}
}
when {
rowText.isBlank() -> null
else -> "- [" + (if (item.checked) "x" else " ") + "] " + rowText
}
}
val headerTrimmed = header.trimEnd()
return when {
bodyLines.isEmpty() -> headerTrimmed
headerTrimmed.isEmpty() -> bodyLines.joinToString("\n")
else -> headerTrimmed + "\n" + bodyLines.joinToString("\n")
}
}
/** Running shopping total in cents: quantity × price, CHECKED rows only. */
fun shoppingTotalCents(items: List<ChecklistItem>): Long =
items.filter { it.checked }.sumOf { lineTotalCents(it) }
/** Running shopping total as dollars (display helper). */
fun shoppingTotal(items: List<ChecklistItem>): Double =
shoppingTotalCents(items) / 100.0
/** "$0.00"-style display string for entered cents digits. */
fun formatMoney(centsDigits: String): String {
val clean = centsDigits.filter { it.isDigit() }.trimStart('0')
return "$" + if (clean.isEmpty()) "0.00" else amountFromPriceDigits(clean)
}
/**
* Card-friendly rendering for structured note types: (title, body)
* WITHOUT any markdown syntax. Title is the list header's first
* non-blank line (or "Untitled"); body is the item names joined
* with " · ", shopping rows carrying " ×qty" (when ≠ 1) and
* " @$price" suffixes. Plain-text notes keep using
* [titleAndBody] untouched.
*/
fun cardPresentation(content: String, type: NoteType): Pair<String, String> {
val isShopping = type == NoteType.SHOPPING_LIST
val (header, items) = splitListContent(
content,
interpretCosts = isShopping,
)
val title = header.lineSequence()
.firstOrNull { it.isNotBlank() }?.trim() ?: UNTITLED
val parts = items.mapNotNull { item ->
val text = item.text.trim()
if (text.isEmpty()) return@mapNotNull null
val qty = quantityOf(item)
val amount = if (isShopping) amountFromPriceDigits(item.cost) else ""
buildString {
append(text)
if (isShopping && qty > 1) append(" \u00d7$qty")
if (isShopping && amount.isNotEmpty()) {
append(" @")
append(amount)
}
}
}
return title to parts.joinToString(" \u00b7 ")
}
/**
* v0.3.8.0 FIX — heal notes stranded as [NoteType.TEXT] by builds
* that saved list content before the `typeKey` column existed (or
* by a partial write of the new feature). Returns the list type
* implied by [content], or null when the body is NOT unambiguously
* a checklist:
*
* * The first non-blank line is a header ONLY if it is not itself
* a checkbox line (headerless lists start straight at `- [ ]`).
* * EVERY remaining non-blank line must match [CHECKLIST_LINE]
* and at least one must exist — prose + an occasional hand-typed
* `- [ ]` stays plain TEXT.
* * Any line carrying a `{q…/p…}` marker implies SHOPPING_LIST.
*/
fun inferListType(content: String): NoteType? {
val lines = content.lines()
val firstNonBlank = lines.indexOfFirst { it.isNotBlank() }
if (firstNonBlank < 0) return null
val startIdx = if (CHECKLIST_LINE.matches(lines[firstNonBlank])) {
firstNonBlank // headerless list
} else {
firstNonBlank + 1 // first line is the header
}
var sawMarker = false
var sawBrace = false
for (i in startIdx until lines.size) {
val line = lines[i]
if (line.isBlank()) continue
val match = CHECKLIST_LINE.matchEntire(line) ?: return null
sawMarker = true
if (BRACED_QP.containsMatchIn(match.groupValues[2])) sawBrace = true
}
return when {
!sawMarker -> null
sawBrace -> NoteType.SHOPPING_LIST
else -> NoteType.TASK_LIST
}
}
} }
} }
@@ -5,15 +5,17 @@ package org.incido.domain.model
* `NoteListScreen` body and the selected entry in the navigation * `NoteListScreen` body and the selected entry in the navigation
* drawer. * drawer.
* *
* - [Home] — every note (the default). The search bar is enabled. * - [Home] — every active note (the default). The search bar is enabled.
* - [Favorites] — only notes with `isFavorite = true`. No search. * - [Favorites] — only notes with `isFavorite = true`; ordinary search is enabled.
* - [Untagged] — only notes that have zero hashtags. No search. * - [Untagged] — only notes that have zero hashtags; ordinary search is enabled.
* - [ByTag] — only notes tagged with [hashtag]. No search. * - [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 { sealed class NoteFilter {
object Home : NoteFilter() object Home : NoteFilter()
object Favorites : NoteFilter() object Favorites : NoteFilter()
object Untagged : NoteFilter() object Untagged : NoteFilter()
object Trash : NoteFilter()
data class ByTag(val hashtag: String) : NoteFilter() data class ByTag(val hashtag: String) : NoteFilter()
/** Stable identifier used by the drawer for `selected` matching. */ /** Stable identifier used by the drawer for `selected` matching. */
@@ -21,6 +23,7 @@ sealed class NoteFilter {
Home -> "home" Home -> "home"
Favorites -> "favorites" Favorites -> "favorites"
Untagged -> "untagged" Untagged -> "untagged"
Trash -> "trash"
is ByTag -> "tag:$hashtag" is ByTag -> "tag:$hashtag"
} }
} }
@@ -0,0 +1,31 @@
package org.incido.domain.model
/**
* v0.3.8.0 — which editor surface a note body uses.
*
* The note text itself stays the single source of truth: task and
* shopping lists are persisted as GitHub-flavoured checkbox lines
* (`- [ ] item` / `- [x] item`, with an optional trailing numeric
* cost token on shopping lists), so free-text search, at-rest
* encryption, backups, and the inline `- [ ]` markdown already
* supported in [Note.checklistCounts] keep working untouched.
*
* Stored as a `Short` in ObjectBox — additive-safe migration from
* the pre-v0.3.8.0 schema (rows without the column default to [TEXT]).
*/
enum class NoteType(val storageKey: Short) {
/** Free-form body edited in the plain multi-line field. */
TEXT(0),
/** Editable checklist: checkbox + item text rows. */
TASK_LIST(1),
/** Checklist plus a per-item cost (number pad) and a running total. */
SHOPPING_LIST(2);
companion object {
/** Convert from the stored [Short] back to the enum, defaulting to [TEXT]. */
fun fromStorageKey(key: Short): NoteType =
values().firstOrNull { it.storageKey == key } ?: TEXT
}
}
@@ -14,9 +14,12 @@ import org.incido.domain.model.NoteAttachment
* (case-insensitive equality). * (case-insensitive equality).
*/ */
interface NoteRepository { 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>> 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) * Stream of notes whose [Note.content] contains [query] (case-insensitive)
* OR whose hashtags contain [query] as one of the names. Favourites * 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]. */ /** Persist a new note or update an existing one. Returns the persisted [Note]. */
suspend fun upsert(note: Note): 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) 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. */ /** Toggle the favourite flag on a single note. */
suspend fun setFavorite(id: Long, isFavorite: Boolean) suspend fun setFavorite(id: Long, isFavorite: Boolean)
@@ -44,6 +53,9 @@ interface NoteRepository {
/** Only notes that have zero hashtags, sorted by updatedAt DESC. */ /** Only notes that have zero hashtags, sorted by updatedAt DESC. */
fun observeUntagged(): Flow<List<Note>> 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 * Context-aware search across **favourites only** — matches
* [Note.content] (contains, case-insensitive) AND any of the note's * [Note.content] (contains, case-insensitive) AND any of the note's
@@ -60,6 +72,9 @@ interface NoteRepository {
*/ */
fun searchUntagged(query: String): Flow<List<Note>> 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. */ /** Only notes tagged with [name] (normalised form), sorted by updatedAt DESC. */
fun observeNotesForHashtag(name: String): Flow<List<Note>> fun observeNotesForHashtag(name: String): Flow<List<Note>>
+1 -1
View File
@@ -1,5 +1,5 @@
# Gradle / Kotlin settings # 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.parallel=true
org.gradle.caching=true org.gradle.caching=true
org.gradle.configureondemand=false org.gradle.configureondemand=false
Binary file not shown.

After

Width:  |  Height:  |  Size: 502 KiB

+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# One-off helper: attach PREVIOUS_HISTORY.md notes to EXISTING Gitea
# releases that were published before the automatic pipeline existed.
#
# TOKEN=<gitea-token-with-release-write> ./backfill-release-notes.sh [version ...]
#
# With no arguments it walks every section of PREVIOUS_HISTORY.md and
# silently skips versions that have no release entry / no section.
# Idempotent: replaces both the description and the changes-file asset.
set -euo pipefail
API="${GITEA_API:-https://git.trevena.info/api/v1/repos/nick/incido}"
: "${TOKEN:?Set TOKEN to a Gitea token with release write access}"
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
NOTES_PY="$ROOT/scripts/ci/release-notes.py"
if [ "$#" -gt 0 ]; then
VERSIONS=("$@")
else
mapfile -t VERSIONS < <(grep -oE '^## v[0-9]+(\.[0-9]+)+' "$ROOT/PREVIOUS_HISTORY.md" | sed 's/^## v//')
fi
for V in "${VERSIONS[@]}"; do
TAG="v$V"
RID=$(curl -s "$API/releases/tags/$TAG" \
-H "Authorization: token $TOKEN" \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
if [ -z "$RID" ]; then echo "skip $TAG (no release entry)"; continue; fi
NOTES="/tmp/Incido-$V-changes.md"
if ! python3 "$NOTES_PY" "$V" --out "$NOTES"; then
echo "skip $TAG (no PREVIOUS_HISTORY.md section)"; continue
fi
# Refresh the description.
REL_NOTES_FILE="$NOTES" python3 -c "import json,os; print(json.dumps({'body': open(os.environ['REL_NOTES_FILE'],encoding='utf-8').read()}))" \
> /tmp/body_patch.json
curl -s -X PATCH "$API/releases/$RID" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d @/tmp/body_patch.json > /dev/null
# Replace a stale changes-file asset, then upload the fresh one.
curl -s "$API/releases/$RID/assets" -H "Authorization: token $TOKEN" \
| REL_ASSET_NAME="Incido-$V-changes.md" python3 -c "import sys,json,os; [print(a['id']) for a in json.load(sys.stdin) if a['name']==os.environ['REL_ASSET_NAME']]" \
| while read -r AID; do
curl -s -X DELETE "$API/releases/$RID/assets/$AID" -H "Authorization: token $TOKEN" > /dev/null
done
curl -s -f -X POST "$API/releases/$RID/assets?name=Incido-$V-changes.md" \
-H "Authorization: token $TOKEN" \
-F "attachment=@$NOTES" --max-time 600 > /dev/null \
|| echo "WARN $TAG: description patched, but the changes-file upload failed"
echo "done $TAG"
done
+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/env python3
"""Extract the release-notes section for one version from PREVIOUS_HISTORY.md.
Incido publishes its user-facing changelog through the Gitea Releases page:
for every tag push, `.gitea/workflows/release.yml` calls this script with
the released version. The matching `## v<VERSION> — <DATE>` section of
PREVIOUS_HISTORY.md becomes the release description and is also uploaded
next to the APKs as `Incido-<VERSION>-changes.md`.
Usage:
release-notes.py <version> [--out FILE] [--history FILE] [--no-footer]
Exits 0 and prints the Markdown (to --out FILE or stdout) when the section
exists; exits 1 (message on stderr) when it doesn't — the workflow then
falls back to its generic "Release <tag>" body.
"""
import argparse
import re
import sys
from pathlib import Path
# "## v0.3.8.0 — 2026-09-16" -> group(1) = "0.3.8.0"
HEADING = re.compile(r"^##\s+v?([0-9]+(?:\.[0-9]+)*)\b")
FOOTER = (
"\n\n---\n\n"
"_Full history: PREVIOUS_HISTORY.md at the repository root. "
"In-depth developer notes: Incido Development Plan \u00a710._\n"
)
def extract(history_text: str, version: str, footer: bool) -> str | None:
wanted = version.lstrip("vV").strip()
collected: list[str] = []
in_section = False
for line in history_text.splitlines():
match = HEADING.match(line)
if match:
in_section = match.group(1) == wanted
if in_section:
collected.append(line)
if not collected:
return None
body = "\n".join(collected).rstrip()
if not body:
return None
return body + (FOOTER if footer else "")
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("version", help="Version or tag, e.g. 0.3.8.0 or v0.3.8.0")
parser.add_argument("--out", type=Path, default=None,
help="Write the notes to this file instead of stdout")
parser.add_argument("--history", type=Path, default=None,
help="Path to PREVIOUS_HISTORY.md "
"(default: repo root, two levels above scripts/ci/)")
parser.add_argument("--no-footer", action="store_true",
help="Omit the standard cross-reference footer")
args = parser.parse_args()
history_path = args.history or (
Path(__file__).resolve().parents[2] / "PREVIOUS_HISTORY.md"
)
if not history_path.is_file():
print(f"release-notes: history file not found: {history_path}",
file=sys.stderr)
return 1
notes = extract(history_path.read_text(encoding="utf-8"),
args.version, footer=not args.no_footer)
if notes is None:
print(f"release-notes: no changelog section for {args.version} "
f"in {history_path.name}", file=sys.stderr)
return 1
if args.out:
args.out.write_text(notes, encoding="utf-8")
print(f"Wrote {len(notes)} chars for v{args.version.lstrip('vV')} "
f"to {args.out}")
else:
sys.stdout.write(notes)
return 0
if __name__ == "__main__":
sys.exit(main())