2022-06-18 18:09:49 +05:30
|
|
|
import Foundation
|
|
|
|
import SDWebImageSwiftUI
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ChaptersView: View {
|
|
|
|
@EnvironmentObject<PlayerModel> private var player
|
|
|
|
|
|
|
|
var body: some View {
|
2022-06-25 05:09:29 +05:30
|
|
|
if let chapters = player.currentVideo?.chapters, !chapters.isEmpty {
|
|
|
|
List {
|
2022-06-18 18:09:49 +05:30
|
|
|
Section(header: Text("Chapters")) {
|
|
|
|
ForEach(chapters) { chapter in
|
2022-08-21 02:35:40 +05:30
|
|
|
ChapterView(chapter: chapter)
|
2022-06-18 18:09:49 +05:30
|
|
|
}
|
|
|
|
}
|
2022-08-09 22:58:16 +05:30
|
|
|
.listRowBackground(Color.clear)
|
2022-06-18 18:09:49 +05:30
|
|
|
}
|
2022-06-25 05:09:29 +05:30
|
|
|
#if os(macOS)
|
2022-06-18 18:09:49 +05:30
|
|
|
.listStyle(.inset)
|
2022-06-25 05:09:29 +05:30
|
|
|
#elseif os(iOS)
|
2022-06-18 18:09:49 +05:30
|
|
|
.listStyle(.grouped)
|
2022-08-09 22:58:16 +05:30
|
|
|
.backport
|
|
|
|
.scrollContentBackground(false)
|
2022-06-25 05:09:29 +05:30
|
|
|
#else
|
2022-06-18 18:09:49 +05:30
|
|
|
.listStyle(.plain)
|
2022-06-25 05:09:29 +05:30
|
|
|
#endif
|
|
|
|
} else {
|
2022-09-28 21:15:05 +05:30
|
|
|
NoCommentsView(text: "No chapters information available".localized(), systemImage: "xmark.circle.fill")
|
2022-06-25 05:09:29 +05:30
|
|
|
}
|
2022-06-18 18:09:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-21 02:35:40 +05:30
|
|
|
struct ChaptersView_Previews: PreviewProvider {
|
2022-06-18 18:09:49 +05:30
|
|
|
static var previews: some View {
|
|
|
|
ChaptersView()
|
|
|
|
.injectFixtureEnvironmentObjects()
|
|
|
|
}
|
|
|
|
}
|