Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions podcasts/PlaybackActionHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ class PlaybackActionHelper {
return
}

if !episode.downloaded(pathFinder: DownloadManager.shared) {
NetworkUtils.shared.streamEpisodeRequested({
performPlay(episode: episode, filterUuid: filterUuid, podcastUuid: podcastUuid)
}, disallowed: nil)
} else {
performPlay(episode: episode, filterUuid: filterUuid, podcastUuid: podcastUuid)
}
performPlay(episode: episode, filterUuid: filterUuid, podcastUuid: podcastUuid)
}

class func pause() {
Expand Down
17 changes: 16 additions & 1 deletion podcasts/PlaybackManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,24 @@ class PlaybackManager: ServerPlaybackDelegate {
}
}

func play(completion: (() -> Void)? = nil, userInitiated: Bool = true) {
private var cellularAllowedEpisodeUUID: String?

func play(completion: (() -> Void)? = nil, userInitiated: Bool = true, allowed: Bool = false) {
guard let currEpisode = currentEpisode() else { return }

if allowed {
cellularAllowedEpisodeUUID = currEpisode.uuid
}

#if !os(watchOS) && !APPCLIP
if !allowed && cellularAllowedEpisodeUUID != currEpisode.uuid && !currEpisode.downloaded(pathFinder: DownloadManager.shared) {
NetworkUtils.shared.streamEpisodeRequested({ [weak self] in
self?.play(completion: completion, userInitiated: userInitiated, allowed: true)
}, disallowed: nil)
return
}
#endif

FileLog.shared.addMessage("PlaybackManager Play \(currentEpisode()?.title ?? "unknown episode") userInitiated: \(userInitiated)")

if userInitiated {
Expand Down