Skip to content

Add idle auto-lock setting#1153

Open
kunal-595 wants to merge 1 commit intojoinmarket-webui:v2from
kunal-595:feat/idle-auto-lock
Open

Add idle auto-lock setting#1153
kunal-595 wants to merge 1 commit intojoinmarket-webui:v2from
kunal-595:feat/idle-auto-lock

Conversation

@kunal-595
Copy link
Copy Markdown
Contributor

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.
image

Copilot AI review requested due to automatic review settings February 24, 2026 22:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/App.tsx
privateMode: boolean
currencyUnit: Currency
cheatsheetForceOpenAt?: number
autoLockTimeout?: number
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 })
Copy link
Copy Markdown
Collaborator

@theborakompanioni theborakompanioni Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can/should resetTimer be debounced?

}

export function useIdleAutoLock(onLock: () => void, timeoutMinutes: number) {
const onLockRef = useRef(onLock)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious.. why does not the timer not reset when onLock changes?

@theborakompanioni
Copy link
Copy Markdown
Collaborator

@kunal-595 Are you still interested in integrating the feature?

@theborakompanioni theborakompanioni added enhancement New feature or request v2 Related to the redesigned v2 release labels Mar 29, 2026
@kunal-595
Copy link
Copy Markdown
Contributor Author

Yes, i am

@theborakompanioni
Copy link
Copy Markdown
Collaborator

Yes, i am

Awesome. 🧡
Can you rebase and address the review comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request v2 Related to the redesigned v2 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants