Mobile: Resolves #16002: Add note lock UI - #16069
Conversation
|
Possibly a flaky test introduced by the desktop PR, as it failed here (I triggered a rerun): [@joplin/app-desktop]: Summary of all failing tests |
|
Had a deeper look at this, it's not the test, it's a small bug from the desktop PR. The session effect in useFormNote should skip the first render, but it checks against undefined while usePrevious starts at null, so it refreshes the note on mount. That second load fires another pair of decrypt callbacks and the test asserts on the last one. Happens locally too, the test just usually wins the race. Fix is to seed usePrevious with the current value, plus an await on ItemChange.waitForAllSaved() in the test. Putting both on this PR as a separate commit. Also prevBuiltInEditorVisible just above has the same problem, from #11296. Not touching it here since it was there before this, can raise it separately if you want. |
|
Please put the test fix on a separate PR so it can be merged quicker to fix the flaky test. This PR's changes are not affected by the change anyway aside from intermittent ci failure.
If it does not cause any ui bug or a failing test, but is just inefficient, I'd say leave it as is. But if there is either a bug or a failing test, describe the reproduction steps and fix it on the same PR if it is a simple change. |
Yes, lock-plus-outline and lock-off-outline look good to me |
|
Please address these comments from Claude: 1. Event listener leak — buildStartupTasks.ts:351 2. setState-after-unmount — NoteLockPanel.tsx:68-79 3. 4. Missing test for the component wiring — 5. (Minor) Raw |
|
I have my exams till Aug 20 so I'm mostly off until then. Will pick up everything here right after, Claude findings, emulator bugs and the #16160 wording. |












Summary
Adds the mobile note lock UI behind the existing feature flag. Resolves #16002.
This was reviewed as keshav0479#4 by mrjo. The first commit is that reviewed work on current dev, and the later changes are separate commits.
Enable/Disable encryption and Lock encrypted notes live in the note screen menu and encrypted notes show a padlock in the note list. A locked note opens read-only with the locked panel instead of the body, and unlocking decrypts it in place. Enabling with no password asks to set one up and goes to the note lock config section, and the panel has a matching set up button.
Saves write the lock state, encrypted body and extracted resource ids together, and pending saves re-encrypt with the key captured at load. The last commit fixes two bugs found in testing: the to-do checkbox on a locked note now shows an error and reverts the tick (same treatment as desktop), and an internal marker no longer counts as a note modification, which could hide the locked panel and expose the encrypted body.
With the flag off, the note screen behaves exactly as before.
Testing
yarn tscyarn workspace @joplin/lib test(note-screen-shared, noteLock)yarn workspace @joplin/app-mobile test Note.testVideo
Full run-through:
video_20260728_222015.mp4
AI Assistance Disclosure
I used AI tools while working on this PR for code suggestions and review, checking scope and tests, and drafting parts of this description, including the disclosure. I reviewed the final changes and reran the tests listed above myself.