Log while navigating around the app (#195)

Just adds some logging while navigating around the app. If an error or
crash occurs and users want to share their logs, this information is
useful to know what page.

Logs are never sent without explicit user content and they are only
shared with the Jellyfin server the app is currently connected to. [See
here for more
details](https://github.com/damontecres/Wholphin/wiki/Gathering-app-logs#privacy)

Also stops theme music when the app is paused similar to #191
This commit is contained in:
damontecres 2025-11-11 20:10:16 -05:00 committed by GitHub
parent ed2ec2f97e
commit 5e2c75bb70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 40 additions and 3 deletions

View file

@ -16,6 +16,7 @@ class PlaybackLifecycleObserver
constructor(
private val navigationManager: NavigationManager,
private val playerFactory: PlayerFactory,
private val themeSongPlayer: ThemeSongPlayer,
) : DefaultLifecycleObserver {
private var wasPlaying: Boolean? = null
@ -36,11 +37,13 @@ class PlaybackLifecycleObserver
wasPlaying = it.isPlaying
it.pause()
}
themeSongPlayer.stop()
}
override fun onStop(owner: LifecycleOwner) {
if (navigationManager.backStack.lastOrNull() is Destination.Playback) {
navigationManager.goBack()
}
themeSongPlayer.stop()
}
}

View file

@ -78,7 +78,6 @@ class ThemeSongPlayer
volumeLevel: ThemeSongVolume,
url: String,
) {
stop()
val volumeLevel =
when (volumeLevel) {
ThemeSongVolume.UNRECOGNIZED,
@ -92,6 +91,7 @@ class ThemeSongPlayer
ThemeSongVolume.HIGHEST -> 75f
}
player.apply {
stop()
volume = volumeLevel
setMediaItem(MediaItem.fromUri(url))
prepare()