Native Android client for Spotify, built with Jetpack Compose
Kotlin ad-freeadblockandroidjetpack-composekotlinlyricsmusic-playermusic-videomyspotispotifyspotify-adblockerspotify-clientspotify-connectspotui
A song heard is no longer shown as an advertisement
kota-zob37cc00884b4
diff --git a/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt b/base/app/src/main/java/com/music/spotui/di/SongPlayer.ktindex d713ae36..7107dffa 100644--- a/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt+++ b/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt@@ -23,6 +23,7 @@ import kotlinx.coroutines.withContextimport kotlinx.coroutines.asyncimport kotlinx.coroutines.launchimport kotlinx.coroutines.flow.collectLatest+import kotlinx.coroutines.flow.distinctUntilChangedimport kotlinx.coroutines.flow.firstimport kotlinx.coroutines.sync.withLockimport java.util.concurrent.ConcurrentHashMap@@ -314,7 +315,13 @@ object SongPlayer {// ad that is still on after AD_SHOW_AFTER_MS is shown: a blocked ad is gone within a second// (its audio is refused, the page moves on), and showing it only made the screens blink.scope.launch {- MyspotiRuntime.spotify.player.adPlaying.collectLatest { on ->+ // The local player plays (an extension's or a downloaded song): the ad is on the unheard page+ // that mirrors it, not what is heard. Shown, the song on screen became the ad and left the+ // notification until a restart (reported), also when that song began after the ad was shown.+ kotlinx.coroutines.flow.combine(+ MyspotiRuntime.spotify.player.adPlaying,+ androidx.compose.runtime.snapshotFlow { LocalPlayer.active.value },+ ) { ad, local -> ad && !local }.distinctUntilChanged().collectLatest { on ->if (on) {kotlinx.coroutines.delay(AD_SHOW_AFTER_MS)// Spotify limiting playback holds every repair, the ad's too: the limit is what@@ -322,9 +329,6 @@ object SongPlayer {// The same when it refuses the account its licences (#134): the ad it is stuck on// stays out of the screens, the toast said why nothing plays.while (MyspotiRuntime.host.licenseLimited() || MyspotiRuntime.spotify.player.licencesHeld) kotlinx.coroutines.delay(1_000)- // The local player plays (an extension's or a downloaded song): the ad is on the unheard- // page that mirrors it, not what is heard. Shown, the song on screen became the ad (reported).- if (LocalPlayer.active.value) return@collectLatest}onAdPlaying(on)}