Skip to content

Sort users by most recently used#1287

Open
Tryum wants to merge 2 commits into
damontecres:mainfrom
Tryum:sort-users-by-recency
Open

Sort users by most recently used#1287
Tryum wants to merge 2 commits into
damontecres:mainfrom
Tryum:sort-users-by-recency

Conversation

@Tryum
Copy link
Copy Markdown

@Tryum Tryum commented Apr 20, 2026

Description

Sort users by last recently used on User selection screen.

Testing

Manual testing on Fire TV Stick 4k Max

Screenshots

firetv-20260420-223109
firetv-20260420-223142

AI or LLM usage

Claude Opus used.
Tested on device.

Track a `lastUsedAt` timestamp on each saved JellyfinUser and order the
user-switcher by recency, so the account the user jumps between most
often lands first. Users that haven't been signed into since the upgrade
fall back to alphabetical.

- Add a nullable `lastUsedAt` column to the `users` table (autoMigration
  31 -> 32).
- Stamp the timestamp in `ServerRepository.changeUser`, the single
  chokepoint hit by direct user switch, username/password login,
  Quick Connect, and session restore.
- Replace the alphabetical sort in `SwitchUserViewModel.getUsers` with
  `lastUsedAt` descending, then case-insensitive name for ties.
@Tryum Tryum force-pushed the sort-users-by-recency branch from 6ddaccd to e09f0ae Compare April 20, 2026 22:49
Copy link
Copy Markdown
Owner

@damontecres damontecres left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

The official app has a setting to set the sort, so I think it would be a good idea to have a setting here too.

val serverId: UUID,
val accessToken: String?,
val pin: String? = null,
val lastUsedAt: Long? = null,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think Date or LocalDateTime would be better. Might need a add a converter for those.

@damontecres
Copy link
Copy Markdown
Owner

damontecres commented May 10, 2026

Just an FYI, since I had to make some databases changes in #1367, I also added the lastUsed field to the server & user models as a ZonedDateTime with a serializer.

So if you rebase on top of that, should be easier to implement this change.

@Tryum
Copy link
Copy Markdown
Author

Tryum commented May 10, 2026

Thanks !
I couldn´t spend time on fixing it unfortunately, but I should be able to make the change request at the end of next week.

@damontecres damontecres added the user interface Related to the user interface label May 11, 2026
damontecres added a commit that referenced this pull request May 20, 2026
## Description
This PR adds a new method of protecting a user profile when switching to
it: server login. When enabled, switching to the user requires
authenticating with the server again via Quick Connect or username &
password. This is basically the same as the official client.

### Related issues
Closes #321
Related to #1330 - might cause merge conflicts
Related to #1287 - definitely causes merge conflicts

### Testing
Emulator with various uses cases including auto sign-in, switching
between server login & PIN protection, and removing the protection

## Screenshots
N/A, the login looks identical as adding a new user

## AI or LLM usage
None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

user interface Related to the user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants