Fix crash when OS screensaver started before opening Wholphin (#1285)

## Description
If the Wholphin OS screensaver starts before Wholphin (the app) is
opened, a default image loader is used. Then when Wholphin is opened, it
will crash when trying to set the app's image loader.

This PR adds configuring the image loader to the screensaver as well. It
is safe to do this multiple times. It's only an error to try to replace
the default image loader.

### Related issues
None

### Testing
Emulator

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Ray 2026-04-20 17:41:24 -04:00 committed by GitHub
parent 36b7390c4e
commit d373b32da5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 9 deletions

View file

@ -28,7 +28,6 @@ import androidx.lifecycle.viewModelScope
import androidx.navigation3.runtime.NavBackStack
import androidx.tv.material3.ExperimentalTvMaterial3Api
import com.github.damontecres.wholphin.data.ServerRepository
import com.github.damontecres.wholphin.preferences.AppPreference
import com.github.damontecres.wholphin.preferences.AppPreferences
import com.github.damontecres.wholphin.preferences.PlayerBackend
import com.github.damontecres.wholphin.services.AppUpgradeHandler
@ -220,14 +219,7 @@ class MainActivity : AppCompatActivity() {
signInAuto = appPreferences.signInAutomatically
}
CoilConfig(
diskCacheSizeBytes =
appPreferences.advancedPreferences.imageDiskCacheSizeBytes.let {
if (it < AppPreference.ImageDiskCacheSize.min * AppPreference.MEGA_BIT) {
AppPreference.ImageDiskCacheSize.defaultValue * AppPreference.MEGA_BIT
} else {
it
}
},
prefs = appPreferences,
okHttpClient = okHttpClient,
debugLogging = false,
enableCache = true,