Skip to content

Commit

Permalink
fixed watchnext button
Browse files Browse the repository at this point in the history
  • Loading branch information
cranci1 committed Feb 2, 2025
1 parent 2658f7e commit 7b2da2e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Sora/Views/MediaInfoView/MediaInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct MediaInfoView: View {
@State var isRefetching: Bool = true
@State var isFetchingEpisode: Bool = false

@State private var selectedEpisode: String = ""
@State private var selectedEpisodeNumber: Int = 0

@AppStorage("externalPlayer") private var externalPlayer: String = "Default"
Expand Down Expand Up @@ -427,18 +426,17 @@ struct MediaInfoView: View {
}
}
}

private func selectNextEpisode() {
guard let currentEpisodeIndex = episodeLinks.firstIndex(where: { $0.href == selectedEpisode }) else { return }
let nextEpisodeIndex = currentEpisodeIndex + 1
print(nextEpisodeIndex)
if nextEpisodeIndex < episodeLinks.count {
selectedEpisode = episodeLinks[nextEpisodeIndex].href
selectedEpisodeNumber = episodeLinks[nextEpisodeIndex].number
let nextEpisodeURL = episodeLinks[nextEpisodeIndex].href
fetchStream(href: nextEpisodeURL)
print(nextEpisodeURL)
guard selectedEpisodeNumber + 1 < episodeLinks.count else {
Logger.shared.log("No more episodes to play", type: "Info")
return
}

selectedEpisodeNumber += 1
let nextEpisode = episodeLinks[selectedEpisodeNumber]
fetchStream(href: nextEpisode.href)
DropManager.shared.showDrop(title: "Fetching Next Episode", subtitle: "", duration: 0.5, icon: UIImage(systemName: "arrow.triangle.2.circlepath"))
}

private func openSafariViewController(with urlString: String) {
Expand Down

0 comments on commit 7b2da2e

Please sign in to comment.