Updates to session restoration (#1905)

## Description
This PR reworks some of the internal handling of changing users and auto
sign in.

1. Most recently used server/user is migrated from `AppPreferences` to
`MostRecentServerProvider`
2. Checking if a user profile is protected occurs at a lower level in
`ServerRepository` so fewer services need to check for this
3. Now always defaults to the most recent server's user list in cases
where the most recent user can't be switched to such as if the profile
is protected, auto signin is disabled, or and error occurred

The default implementation for `MostRecentServerProvider` uses Android's
`SharedPreferences`. `SharedPreferences` was already was being used to
track the most recent server for crash reporting (the crash reporting
process cannot use the Hilt DI). This PR enhances this and adds a better
API for saving/retrieving.

This also removes the last bit of "user specific" data from
`AppPreferences`.

### Related issues
None specific, but there have been a few related to auto sign-in &
intents that were recently fixed. This PR is a more detailed approach to
those same problems.

### Testing
Manually via the emulator. There are also unit tests for most (all?) of
the different settings and state combinations.

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-10-11 20:11:09 -04:00 • committed by GitHub
parent a11cd9fb74
commit f01c5d367c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 786 additions and 493 deletions

View file

@ -233,9 +233,8 @@ message ExperimentalPreferences {
}
message AppPreferences {
// The currently signed in server and user IDs, mostly for restoring a session
string current_server_id = 1;
string current_user_id = 2;
string current_server_id = 1 [deprecated = true];
string current_user_id = 2 [deprecated = true];
PlaybackPreferences playback_preferences = 3;
HomePagePreferences home_page_preferences = 4;