Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds an idle auto-lock feature that automatically locks the wallet after a configurable period of user inactivity. The feature integrates into the settings page with options for 5, 15, 30, or 60 minutes of idle timeout, or can be disabled (default). The auto-lock intelligently skips activation when the maker is running or a coinjoin is in progress to prevent disruption of ongoing operations.
Changes:
- Added idle tracking mechanism with activity event listeners (mousemove, keydown, etc.) and configurable timeout
- Integrated auto-lock setting into the settings store and UI with a dropdown selector
- Added comprehensive unit tests for the idle tracking functionality
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/store/jamSettingsStore.ts | Added autoLockTimeout optional field to JamSettings type |
| src/i18n/locales/en/translation.json | Added translations for auto-lock UI labels |
| src/hooks/useIdleAutoLock.ts | Implemented idle tracking hook with event listeners and timer management |
| src/hooks/useIdleAutoLock.test.ts | Added comprehensive unit tests for idle tracker behavior |
| src/components/settings/SettingsPage.tsx | Added AutoLockTimeoutSelector component with dropdown UI |
| src/App.tsx | Integrated IdleAutoLock component that conditionally activates based on settings and wallet state |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c9ef3a5 to
99f0acf
Compare
| privateMode: boolean | ||
| currencyUnit: Currency | ||
| cheatsheetForceOpenAt?: number | ||
| autoLockTimeout?: number |
There was a problem hiding this comment.
can this be seconds instead of minutes and called autoLockTimeoutInSeconds?: Seconds?
It is stored in local storage, so a user looking at it has no type information and does not know what unit it is.
| } | ||
|
|
||
| return { | ||
| start() { |
There was a problem hiding this comment.
Nit: If start returns the stop function, AbortController can be used to simplify the listener removal.
| start() { | ||
| resetTimer() | ||
| for (const event of ACTIVITY_EVENTS) { | ||
| win.addEventListener(event, resetTimer, { passive: true }) |
There was a problem hiding this comment.
Can/should resetTimer be debounced?
| } | ||
|
|
||
| export function useIdleAutoLock(onLock: () => void, timeoutMinutes: number) { | ||
| const onLockRef = useRef(onLock) |
There was a problem hiding this comment.
Just curious.. why does not the timer not reset when onLock changes?
|
@kunal-595 Are you still interested in integrating the feature? |
|
Yes, i am |
Awesome. 🧡 |
Locks the wallet after a configurable period of inactivity (5/15/30/60 min, disabled by default). Skips auto lock when maker or coinjoin is running.
