mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
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:
parent
ed2ec2f97e
commit
5e2c75bb70
10 changed files with 40 additions and 3 deletions
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue