Fix some IO related crashes (#1008)

## Description
- Catch network exceptions when querying to populate the nav drawer
- Perform screensaver work on IO thread
- Fix possible crash if screensaver service runs while regular activity
is destroyed
- Fix genre images & backdrop images not loading

This PR also adds an Jellyfin SDK `ApiClient` wrapper to push all
network calls onto the IO thread. And tries to use a more strict
network-on-main policy for debug builds.

### Related issues
Fixes #994
Fixes #1001
Should fix #1003

### Testing
Emulator with simulated exception throws

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Ray 2026-02-26 15:48:39 -05:00 committed by GitHub
parent 37d52ef57e
commit 9b995bf6ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 147 additions and 42 deletions

View file

@ -42,8 +42,6 @@ class ServerRepository
val apiClient: ApiClient,
val userPreferencesDataStore: DataStore<AppPreferences>,
) {
private val sharedPreferences = getServerSharedPreferences(context)
private var _current = EqualityMutableLiveData<CurrentUser?>(null)
val current: LiveData<CurrentUser?> = _current
@ -107,7 +105,7 @@ class ServerRepository
_current.value = CurrentUser(updatedServer, updatedUser)
_currentUserDto.value = userDto
}
sharedPreferences.edit(true) {
getServerSharedPreferences(context).edit(true) {
putString(SERVER_URL_KEY, updatedServer.url)
putString(ACCESS_TOKEN_KEY, updatedUser.accessToken)
}