Skip to content

Commit

Permalink
Merge pull request #161 from tidal-music/alberto/offlineengine-hotfix
Browse files Browse the repository at this point in the history
[Player] OfflineEngine bug with offlinePrivilegeCheck
  • Loading branch information
asendra authored Nov 11, 2024
2 parents cadf7a4 + 19f0eda commit 3308fa3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.44] - 2024-11-11

### Fix
- Fix implementation of `offlinePrivilegeCheck` in PlayerEngine (Player)

## [0.3.43] - 2024-11-08

### Removed
Expand Down
18 changes: 12 additions & 6 deletions Sources/Player/Player.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public final class Player {
private let featureFlagProvider: FeatureFlagProvider
private var externalPlayersSupplier: (() -> [GenericMediaPlayer.Type])?
private let credentialsProvider: CredentialsProvider
private let offlinePlaybackPrivilegeCheck: (() -> Bool)?

// MARK: - Initialization

Expand All @@ -73,7 +74,8 @@ public final class Player {
offlineEngine: OfflineEngine,
featureFlagProvider: FeatureFlagProvider,
externalPlayersSupplier: (() -> [GenericMediaPlayer.Type])?,
credentialsProvider: CredentialsProvider
credentialsProvider: CredentialsProvider,
offlinePlaybackPrivilegeCheck: (() -> Bool)?
) {
self.queue = queue
playerURLSession = urlSession
Expand All @@ -90,6 +92,7 @@ public final class Player {
self.featureFlagProvider = featureFlagProvider
self.externalPlayersSupplier = externalPlayersSupplier
self.credentialsProvider = credentialsProvider
self.offlinePlaybackPrivilegeCheck = offlinePlaybackPrivilegeCheck
}
}

Expand Down Expand Up @@ -203,7 +206,8 @@ public extension Player {
notificationsHandler,
featureFlagProvider,
externalPlayersSupplier,
credentialsProvider
credentialsProvider,
offlinePlaybackPrivilegeCheck
)

shared = Player(
Expand All @@ -221,7 +225,8 @@ public extension Player {
offlineEngine: offlineEngine,
featureFlagProvider: featureFlagProvider,
externalPlayersSupplier: externalPlayersSupplier,
credentialsProvider: credentialsProvider
credentialsProvider: credentialsProvider,
offlinePlaybackPrivilegeCheck: offlinePlaybackPrivilegeCheck
)

return shared
Expand Down Expand Up @@ -410,7 +415,8 @@ private extension Player {
notificationsHandler,
featureFlagProvider,
externalPlayersSupplier,
credentialsProvider
credentialsProvider,
offlinePlaybackPrivilegeCheck
)
}

Expand All @@ -424,9 +430,9 @@ private extension Player {
_ playerEventSender: PlayerEventSender,
_ notificationsHandler: NotificationsHandler?,
_ featureFlagProvider: FeatureFlagProvider,
_ externalPlayersSupplier: (() -> [GenericMediaPlayer.Type])? = nil,
_ externalPlayersSupplier: (() -> [GenericMediaPlayer.Type])?,
_ credentialsProvider: CredentialsProvider,
_ offlinePlaybackPrivilegeCheck: (() -> Bool)? = nil
_ offlinePlaybackPrivilegeCheck: (() -> Bool)?
) -> PlayerEngine {
let internalPlayerLoader = InternalPlayerLoader(
with: configuration,
Expand Down
3 changes: 2 additions & 1 deletion Tests/PlayerTests/Player/PlayerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ final class PlayerTests: XCTestCase {
offlineEngine: offlineEngine,
featureFlagProvider: .mock,
externalPlayersSupplier: nil,
credentialsProvider: CredentialsProviderMock()
credentialsProvider: CredentialsProviderMock(),
offlinePlaybackPrivilegeCheck: nil
)
}
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.43
0.3.44

0 comments on commit 3308fa3

Please sign in to comment.