Skip to content

Commit

Permalink
Merge pull request #126 from tidal-music/alberto/fix-update-configura…
Browse files Browse the repository at this point in the history
…tion-offlineengine

[Player] Update configuration object inside OfflineEngine
  • Loading branch information
asendra authored Oct 23, 2024
2 parents b60a741 + 87f3abc commit 76a6274
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Player/Common/PlaybackInfo/PlaybackInfoFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation
// MARK: - PlaybackInfoFetcher

final class PlaybackInfoFetcher {
private let configuration: Configuration
private var configuration: Configuration
private let httpClient: HttpClient
private let credentialsProvider: CredentialsProvider
private let networkMonitor: NetworkMonitor
Expand Down Expand Up @@ -63,6 +63,10 @@ final class PlaybackInfoFetcher {
func cancellNetworkRequests() {
httpClient.cancelAllRequests()
}

func updateConfiguration(_ configuration: Configuration) {
self.configuration = configuration
}
}

private extension PlaybackInfoFetcher {
Expand Down
4 changes: 4 additions & 0 deletions Sources/Player/OfflineEngine/Internal/Downloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class Downloader {
func setObserver(observer: DownloadObserver) {
self.observer = observer
}

func updateConfiguration(_ configuration: Configuration) {
playbackInfoFetcher.updateConfiguration(configuration)
}
}

private extension Downloader {
Expand Down
4 changes: 4 additions & 0 deletions Sources/Player/OfflineEngine/OfflineEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public final class OfflineEngine {
}
return offlineEntry.state.publicState
}

func updateConfiguration(_ configuration: Configuration) {
downloader.updateConfiguration(configuration)
}
}

// MARK: DownloadObserver
Expand Down
1 change: 1 addition & 0 deletions Sources/Player/Player.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public final class Player {
// immediately.
didSet {
playerEngine.updateConfiguration(configuration)
offlineEngine.updateConfiguration(configuration)
streamingPrivilegesHandler.updateConfiguration(configuration)
}
}
Expand Down

0 comments on commit 76a6274

Please sign in to comment.