Add Invidious comments support

This commit is contained in:
Arkadiusz Fal
2022-07-02 00:14:04 +02:00
parent 4fcf57d755
commit 7c4ee9bf35
7 changed files with 43 additions and 70 deletions

View File

@@ -53,7 +53,6 @@ extension Defaults.Keys {
static let playerInstanceID = Key<Instance.ID?>("playerInstance")
static let showKeywords = Key<Bool>("showKeywords", default: false)
static let showHistoryInPlayer = Key<Bool>("showHistoryInPlayer", default: false)
static let commentsInstanceID = Key<Instance.ID?>("commentsInstance", default: nil)
#if !os(tvOS)
static let commentsPlacement = Key<CommentsPlacement>("commentsPlacement", default: .separate)
#endif

View File

@@ -255,23 +255,8 @@ struct VideoDetails: View {
}
}
}
if !video.isNil, CommentsModel.placement == .info {
Divider()
#if os(macOS)
.padding(.bottom, 20)
#else
.padding(.vertical, 10)
#endif
}
}
.padding(.horizontal)
LazyVStack {
if !video.isNil, CommentsModel.placement == .info {
CommentsView()
}
}
}
}

View File

@@ -5,7 +5,6 @@ struct PlayerSettings: View {
@Default(.instances) private var instances
@Default(.playerInstanceID) private var playerInstanceID
@Default(.quality) private var quality
@Default(.commentsInstanceID) private var commentsInstanceID
@Default(.playerSidebar) private var playerSidebar
@Default(.showHistoryInPlayer) private var showHistory
@@ -64,10 +63,6 @@ struct PlayerSettings: View {
closeLastItemOnPlaybackEndToggle
}
Section(header: SettingsHeader(text: "Comments")) {
commentsInstancePicker
}
Section(header: SettingsHeader(text: "Interface")) {
#if os(iOS)
if idiom == .pad {
@@ -135,22 +130,6 @@ struct PlayerSettings: View {
#endif
}
private var commentsInstancePicker: some View {
Picker("Source", selection: $commentsInstanceID) {
Text("Disabled").tag(Optional(""))
ForEach(InstancesModel.all.filter { $0.app.supportsComments }) { instance in
Text(instance.description).tag(Optional(instance.id))
}
}
.labelsHidden()
#if os(iOS)
.pickerStyle(.automatic)
#elseif os(tvOS)
.pickerStyle(.inline)
#endif
}
private var sidebarPicker: some View {
Picker("Sidebar", selection: $playerSidebar) {
#if os(macOS)

View File

@@ -190,7 +190,7 @@ struct SettingsView: View {
case .browsing:
return 390
case .player:
return 500
return 390
case .history:
return 480
case .sponsorBlock: